Endpoint Profile
Para obtener el perfil completo del usuario, utilice el endpoint a continuación.
URLs
| Método | URL | Acción | Descripción |
|---|---|---|---|
| GET | /api/profile/{clientId}?identity={identity} | Visualizar | Muestra el perfil completo del usuario por ID |
Producción:
{security-producao}/api/profile/{clientId}?identity={identity}Homologación:
{security-homologacao}/api/profile/{clientId}?identity={identity}Parámetros
- clientId: Obligatorio.
- identity: Opcional si usa JWT en el header Authorization. Obligatorio si usa AccessToken en el header AccessToken.
Autenticación (Headers)
- Con JWT:
Authorization: Bearer <token> - Con AccessToken:
AccessToken: <token>
Ejemplo de Solicitud con JWT
javascript
const response = await fetch(`{security-producao}/api/profile/${clientId}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${jwtToken}`
}
});
const profile = await response.json();Ejemplo de Solicitud con 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();Respuesta 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"
}
]
}
}Estructura de la Respuesta
header
| Campo | Tipo | Descripción |
|---|---|---|
codigo | number | Código de estado de la respuesta |
msg | string | Mensaje de estado |
data
| Campo | Tipo | Descripción |
|---|---|---|
fanId | string | ID único del usuario |
profilePic | string | URL de la foto de perfil |
name1 | string | Primer nombre |
name2 | string/null | Apellido |
socialName | string | Nombre social |
cpf | string | CPF del usuario |
verifiedCpf | boolean | Indica si el CPF fue verificado |
otherdoc | string/null | Otro documento |
doctype | string | Tipo de documento |
registertype | string | Tipo de registro |
lastupdate | string | Fecha de la última actualización |
birthdate | string | Fecha de nacimiento |
gender | string | Género (M/F) |
emails | array | Lista de emails |
phones | array | Lista de teléfonos |
address | object | Dirección completa |
optins | array | Lista de opt-ins del usuario |
emails
| Campo | Tipo | Descripción |
|---|---|---|
value | string | Dirección de email |
verified | boolean | Indica si el email fue verificado |
phones
| Campo | Tipo | Descripción |
|---|---|---|
value | string | Número de teléfono |
verified | boolean | Indica si el teléfono fue verificado |
address
| Campo | Tipo | Descripción |
|---|---|---|
street | string | Calle y número |
city | string | Ciudad |
state | string | Estado |
country | string | País |
optins
| Campo | Tipo | Descripción |
|---|---|---|
optinName | string | Nombre del opt-in |
optinCode | string | Código del opt-in |
optinDate | string | Fecha del opt-in (ISO 8601) |
Ejemplo Completo
javascript
async function obtenerPerfilCompleto(clientId, jwtToken) {
try {
const response = await fetch(`{security-producao}/api/profile/${clientId}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${jwtToken}`
}
});
if (!response.ok) {
throw new Error(`Error ${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('Error al obtener perfil:', error);
throw error;
}
}