curl \
-H "Authorization: Bearer API_KEY" \
-H 'Profile-Key: PROFILE_KEY' \
-X GET https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID
const API_KEY = "API_KEY";
const PROFILE_KEY = "PROFILE_KEY";
const SESSION_ID = "SESSION_ID";
fetch(`https://api.ayrshare.com/api/profiles/link-sessions/${SESSION_ID}`, {
headers: {
Authorization: `Bearer ${API_KEY}`,
"Profile-Key": PROFILE_KEY,
},
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY',
'Profile-Key': 'PROFILE_KEY'}
response = requests.get(
'https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID',
headers=headers)
print(response.json())
<?php
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'GET',
'https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID',
[
'headers' => [
'Authorization' => 'Bearer API_KEY',
'Profile-Key' => 'PROFILE_KEY'
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace GetLinkSession_csharp
{
class GetLinkSession
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string PROFILE_KEY = "PROFILE_KEY";
string url = "https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID";
try
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
client.DefaultRequestHeaders.Add("Profile-Key", PROFILE_KEY);
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
catch (HttpRequestException e)
{
Console.WriteLine($"HTTP request error: {e.Message}");
}
}
}
}
{
"status": "success",
"sessionId": "c7a2434e72e91bde27579efde0fd6dd0b74ceee29a471fd368407f273708c2e8",
"state": "active", // pending | active | expired | revoked - see Link States above.
"createdAt": "2026-09-01T08:03:26.838Z", // When the link was created, as an ISO 8601 timestamp.
"expiresAt": "2026-09-02T08:03:26.838Z", // When the link stops working.
"firstUsedAt": "2026-09-01T08:14:02.104Z", // When the link was first opened. Absent if it never has been.
"lastUsedAt": "2026-09-01T08:14:02.104Z", // When the link was most recently opened. Absent if it never has been.
"useCount": 1, // How many times the link has been opened. A reload or an OAuth retry increments this.
"completedAt": "2026-09-01T08:15:44.870Z", // When the first account was connected. Absent until one is.
"lastCompletedAt": "2026-09-01T08:16:20.412Z", // When the most recent was connected. Absent until one is.
"completedNetworks": ["reddit", "bluesky"] // Every network connected on this link, append-only. Absent until one is.
}
{
"status": "success",
"sessionId": "c7a2434e72e91bde27579efde0fd6dd0b74ceee29a471fd368407f273708c2e8",
"state": "pending", // Created but never opened, so firstUsedAt and lastUsedAt are absent.
"createdAt": "2026-09-01T08:03:26.838Z",
"expiresAt": "2026-09-02T08:03:26.838Z",
"useCount": 0
}
{
"action": "link session",
"status": "error",
"code": 502,
"message": "Social linking session not found. Please request a new linking URL."
}
Profiles
Consultar uma Link Session
Verifique se uma URL de vinculação social foi aberta, se ainda é válida ou se foi revogada.
GET
/
profiles
/
link-sessions
/
{sessionId}
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Profile-Key: PROFILE_KEY' \
-X GET https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID
const API_KEY = "API_KEY";
const PROFILE_KEY = "PROFILE_KEY";
const SESSION_ID = "SESSION_ID";
fetch(`https://api.ayrshare.com/api/profiles/link-sessions/${SESSION_ID}`, {
headers: {
Authorization: `Bearer ${API_KEY}`,
"Profile-Key": PROFILE_KEY,
},
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY',
'Profile-Key': 'PROFILE_KEY'}
response = requests.get(
'https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID',
headers=headers)
print(response.json())
<?php
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'GET',
'https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID',
[
'headers' => [
'Authorization' => 'Bearer API_KEY',
'Profile-Key' => 'PROFILE_KEY'
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace GetLinkSession_csharp
{
class GetLinkSession
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string PROFILE_KEY = "PROFILE_KEY";
string url = "https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID";
try
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
client.DefaultRequestHeaders.Add("Profile-Key", PROFILE_KEY);
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
catch (HttpRequestException e)
{
Console.WriteLine($"HTTP request error: {e.Message}");
}
}
}
}
{
"status": "success",
"sessionId": "c7a2434e72e91bde27579efde0fd6dd0b74ceee29a471fd368407f273708c2e8",
"state": "active", // pending | active | expired | revoked - see Link States above.
"createdAt": "2026-09-01T08:03:26.838Z", // When the link was created, as an ISO 8601 timestamp.
"expiresAt": "2026-09-02T08:03:26.838Z", // When the link stops working.
"firstUsedAt": "2026-09-01T08:14:02.104Z", // When the link was first opened. Absent if it never has been.
"lastUsedAt": "2026-09-01T08:14:02.104Z", // When the link was most recently opened. Absent if it never has been.
"useCount": 1, // How many times the link has been opened. A reload or an OAuth retry increments this.
"completedAt": "2026-09-01T08:15:44.870Z", // When the first account was connected. Absent until one is.
"lastCompletedAt": "2026-09-01T08:16:20.412Z", // When the most recent was connected. Absent until one is.
"completedNetworks": ["reddit", "bluesky"] // Every network connected on this link, append-only. Absent until one is.
}
{
"status": "success",
"sessionId": "c7a2434e72e91bde27579efde0fd6dd0b74ceee29a471fd368407f273708c2e8",
"state": "pending", // Created but never opened, so firstUsedAt and lastUsedAt are absent.
"createdAt": "2026-09-01T08:03:26.838Z",
"expiresAt": "2026-09-02T08:03:26.838Z",
"useCount": 0
}
{
"action": "link session",
"status": "error",
"code": 502,
"message": "Social linking session not found. Please request a new linking URL."
}
Verifique o estado de uma URL de vinculação que você criou com
Criar uma Link Session — se o seu usuário a abriu,
se ela ainda é válida e quantas vezes foi usada.
Útil quando você quer saber se um usuário começou a conectar suas contas sem
perguntar a ele, ou para confirmar que um link está morto antes de criar um substituto.
Um
sessionId que não existe, ou que pertence a outra conta, retorna a mesma resposta
not found. Isso é deliberado, para que o endpoint não possa ser usado para descobrir
se um identificador é real.Parâmetros do cabeçalho
Parâmetros de caminho
string
obrigatório
O
sessionId retornado quando o link foi criado.Estados do link
O campostate é um destes:
pending: criado, nunca aberto.active: aberto pelo menos uma vez, ainda dentro da sua janela.expired: passou deexpiresAt.revoked: eliminado com Revogar uma Link Session.
revoked mesmo depois que sua janela passa, já que essa é a
resposta mais útil.
Contas conectadas
Quando seu usuário conecta uma conta, o link a registra. Três campos aparecem quando algo foi conectado, e estão ausentes até então:completedAt: quando a primeira conta foi conectada.lastCompletedAt: quando a mais recente foi.completedNetworks: todas as redes conectadas neste link.
state, e ambos respondem a perguntas reais: um link pode estar active
e ainda não ter conectado nada, ou expired e ter conectado três contas antes de
esgotar. Fazer polling em completedNetworks é como um app renderizado no servidor ou um app mobile
sabe que uma conexão terminou, e é o único sinal para o Telegram, que conclui fora
do fluxo.
completedNetworks é um histórico desta link session, não o estado atual do
profile. Ele é append-only: uma rede é adicionada quando conecta por esta sessão e
nunca é removida, então ela permanece listada depois que a conta é desvinculada, revinculada por uma
sessão diferente ou desconectada do lado da rede. Para ver quais redes estão
vinculadas ao User Profile agora, chame
Consultar User Profiles com include=state.curl \
-H "Authorization: Bearer API_KEY" \
-H 'Profile-Key: PROFILE_KEY' \
-X GET https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID
const API_KEY = "API_KEY";
const PROFILE_KEY = "PROFILE_KEY";
const SESSION_ID = "SESSION_ID";
fetch(`https://api.ayrshare.com/api/profiles/link-sessions/${SESSION_ID}`, {
headers: {
Authorization: `Bearer ${API_KEY}`,
"Profile-Key": PROFILE_KEY,
},
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY',
'Profile-Key': 'PROFILE_KEY'}
response = requests.get(
'https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID',
headers=headers)
print(response.json())
<?php
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See .../guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'GET',
'https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID',
[
'headers' => [
'Authorization' => 'Bearer API_KEY',
'Profile-Key' => 'PROFILE_KEY'
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace GetLinkSession_csharp
{
class GetLinkSession
{
static async Task Main(string[] args)
{
string API_KEY = "API_KEY";
string PROFILE_KEY = "PROFILE_KEY";
string url = "https://api.ayrshare.com/api/profiles/link-sessions/SESSION_ID";
try
{
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);
client.DefaultRequestHeaders.Add("Profile-Key", PROFILE_KEY);
HttpResponseMessage response = await client.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseBody);
}
}
catch (HttpRequestException e)
{
Console.WriteLine($"HTTP request error: {e.Message}");
}
}
}
}
{
"status": "success",
"sessionId": "c7a2434e72e91bde27579efde0fd6dd0b74ceee29a471fd368407f273708c2e8",
"state": "active", // pending | active | expired | revoked - see Link States above.
"createdAt": "2026-09-01T08:03:26.838Z", // When the link was created, as an ISO 8601 timestamp.
"expiresAt": "2026-09-02T08:03:26.838Z", // When the link stops working.
"firstUsedAt": "2026-09-01T08:14:02.104Z", // When the link was first opened. Absent if it never has been.
"lastUsedAt": "2026-09-01T08:14:02.104Z", // When the link was most recently opened. Absent if it never has been.
"useCount": 1, // How many times the link has been opened. A reload or an OAuth retry increments this.
"completedAt": "2026-09-01T08:15:44.870Z", // When the first account was connected. Absent until one is.
"lastCompletedAt": "2026-09-01T08:16:20.412Z", // When the most recent was connected. Absent until one is.
"completedNetworks": ["reddit", "bluesky"] // Every network connected on this link, append-only. Absent until one is.
}
{
"status": "success",
"sessionId": "c7a2434e72e91bde27579efde0fd6dd0b74ceee29a471fd368407f273708c2e8",
"state": "pending", // Created but never opened, so firstUsedAt and lastUsedAt are absent.
"createdAt": "2026-09-01T08:03:26.838Z",
"expiresAt": "2026-09-02T08:03:26.838Z",
"useCount": 0
}
{
"action": "link session",
"status": "error",
"code": 502,
"message": "Social linking session not found. Please request a new linking URL."
}