Endpoint Profile
Para obter o perfil completo do usuário, utilize o endpoint abaixo.
URLs
| Método | URL | Ação | Descrição |
|---|---|---|---|
| GET | /api/profile/{clientId}?identity={identity} | Visualizar | Exibe o perfil completo do usuário pelo ID |
Produção:
{security-producao}/api/profile/{clientId}?identity={identity}Homologação:
{security-homologacao}/api/profile/{clientId}?identity={identity}Parâmetros
- clientId: Obrigatório.
- identity: Opcional se usar JWT no header Authorization. Obrigatório se usar AccessToken no header AccessToken.
Autenticação (Headers)
- Com JWT:
Authorization: Bearer <token> - Com AccessToken:
AccessToken: <token>
Exemplo de Requisição com JWT
javascript
const response = await fetch(`{security-producao}/api/profile/${clientId}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${jwtToken}`
}
});
const profile = await response.json();Exemplo de Requisição com AccessToken
javascript
const userId = '000001';
const response = await fetch(`{security-producao}/api/profile/${clientId}?identity=${userId}`, {
method: 'GET',
headers: {
'AccessToken': accessToken
}
});
const profile = await response.json();Resposta Esperada
json
{
"header": {
"codigo": 1,
"msg": "Ok."
},
"data": {
"fanId": "000001",
"profilePic": "",
"name1": "XXXXX",
"name2": null,
"socialName": "XXX",
"cpf": "00000000001",
"verifiedCpf": true,
"otherdoc": null,
"doctype": "CPF",
"registertype": "standard",
"lastupdate": "14/10/2025 10:58",
"birthdate": "06/09/2000",
"gender": "M",
"emails": [
{
"value": "xxxxx@xxxx.com",
"verified": true
}
],
"phones": [
{
"value": "+55 (11) 111111111",
"verified": false
}
],
"address": {
"street": "XXXXX",
"city": "XXXXX",
"state": "XXX",
"country": "BR"
},
"optins": [
{
"optinName": "xxxxxxxx",
"optinCode": "xxxxxxxx",
"optinDate": "2025-10-14T10:58:26"
}
]
}
}Estrutura da Resposta
header
| Campo | Tipo | Descrição |
|---|---|---|
codigo | number | Código de status da resposta |
msg | string | Mensagem de status |
data
| Campo | Tipo | Descrição |
|---|---|---|
fanId | string | ID único do usuário |
profilePic | string | URL da foto de perfil |
name1 | string | Primeiro nome |
name2 | string/null | Sobrenome |
socialName | string | Nome social |
cpf | string | CPF do usuário |
verifiedCpf | boolean | Indica se o CPF foi verificado |
otherdoc | string/null | Outro documento |
doctype | string | Tipo de documento |
registertype | string | Tipo de registro |
lastupdate | string | Data da última atualização |
birthdate | string | Data de nascimento |
gender | string | Gênero (M/F) |
emails | array | Lista de emails |
phones | array | Lista de telefones |
address | object | Endereço completo |
optins | array | Lista de opt-ins do usuário |
emails
| Campo | Tipo | Descrição |
|---|---|---|
value | string | Endereço de email |
verified | boolean | Indica se o email foi verificado |
phones
| Campo | Tipo | Descrição |
|---|---|---|
value | string | Número de telefone |
verified | boolean | Indica se o telefone foi verificado |
address
| Campo | Tipo | Descrição |
|---|---|---|
street | string | Rua e número |
city | string | Cidade |
state | string | Estado |
country | string | País |
optins
| Campo | Tipo | Descrição |
|---|---|---|
optinName | string | Nome do opt-in |
optinCode | string | Código do opt-in |
optinDate | string | Data do opt-in (ISO 8601) |
Exemplo Completo
javascript
async function obterPerfilCompleto(clientId, jwtToken) {
try {
const response = await fetch(`{security-producao}/api/profile/${clientId}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${jwtToken}`
}
});
if (!response.ok) {
throw new Error(`Erro ${response.status}: ${response.statusText}`);
}
const resultado = await response.json();
if (resultado.header.codigo !== 1) {
throw new Error(resultado.header.msg);
}
return resultado.data;
} catch (error) {
console.error('Erro ao obter perfil:', error);
throw error;
}
}