Perfil y Organizaciones
Endpoints para gestionar el perfil de usuario y las organizaciones
curl https://app.getplea.com/api/profile \
-H "Authorization: Bearer TOKEN"
const profile = await fetch('https://app.getplea.com/api/profile', {
headers: { 'Authorization': 'Bearer TOKEN' }
}).then(r => r.json());
{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"email": "ana.lopez@despacho.com",
"fullName": "Ana López Fernández",
"phone": "+34 612 345 678",
"avatar": "https://storage.googleapis.com/plea-uploads/avatar.jpg",
"activeOrganizationId": "org-uuid-1234",
"organizations": [
{
"id": "org-uuid-1234",
"name": "Bufete López & Asociados",
"role": "owner"
}
]
}
curl -X PATCH https://app.getplea.com/api/profile \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{
"fullName": "Ana López Fernández-Ruiz",
"phone": "+34 612 345 678"
}'
await fetch('https://app.getplea.com/api/profile', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
fullName: 'Ana López Fernández-Ruiz',
phone: '+34 612 345 678'
})
});
{
"id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"email": "ana.lopez@despacho.com",
"fullName": "Ana López Fernández-Ruiz",
"phone": "+34 612 345 678"
}
curl -X POST https://app.getplea.com/api/profile/switch-organization \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"organizationId": "org-uuid-5678"}'
await fetch('https://app.getplea.com/api/profile/switch-organization', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({ organizationId: 'org-uuid-5678' })
});
{
"message": "Organización activa cambiada",
"activeOrganizationId": "org-uuid-5678"
}
curl https://app.getplea.com/api/organizations \
-H "Authorization: Bearer TOKEN"
const orgs = await fetch('https://app.getplea.com/api/organizations', {
headers: { 'Authorization': 'Bearer TOKEN' }
}).then(r => r.json());
[
{
"id": "org-uuid-1234",
"name": "Bufete López & Asociados",
"taxId": "B12345678",
"address": "Calle Gran Vía 42, 28013 Madrid",
"role": "owner",
"membersCount": 5
},
{
"id": "org-uuid-5678",
"name": "Consultoría Legal Madrid",
"taxId": "B87654321",
"role": "member",
"membersCount": 12
}
]
curl https://app.getplea.com/api/organizations/org-uuid-1234 \
-H "Authorization: Bearer TOKEN"
const org = await fetch('https://app.getplea.com/api/organizations/org-uuid-1234', {
headers: { 'Authorization': 'Bearer TOKEN' }
}).then(r => r.json());
{
"id": "org-uuid-1234",
"name": "Bufete López & Asociados",
"taxId": "B12345678",
"address": "Calle Gran Vía 42, 28013 Madrid",
"phone": "+34 915 555 555",
"email": "info@lopezasociados.com",
"website": "https://lopezasociados.com",
"members": [
{
"id": "user-uuid-1",
"fullName": "Ana López Fernández",
"email": "ana.lopez@despacho.com",
"role": "owner"
},
{
"id": "user-uuid-2",
"fullName": "Pedro Martín Sánchez",
"email": "pedro@despacho.com",
"role": "member"
}
]
}
{
"error": "Not Found",
"message": "Organización no encontrada"
}
curl -X POST https://app.getplea.com/api/organizations \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Nuevo Despacho Legal",
"taxId": "B99887766",
"address": "Av. Diagonal 500, Barcelona"
}'
const org = await fetch('https://app.getplea.com/api/organizations', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'Nuevo Despacho Legal',
taxId: 'B99887766',
address: 'Av. Diagonal 500, Barcelona'
})
}).then(r => r.json());
{
"id": "org-uuid-new",
"name": "Nuevo Despacho Legal",
"taxId": "B99887766",
"address": "Av. Diagonal 500, Barcelona",
"createdAt": "2026-03-07T10:00:00Z"
}
curl -X PATCH https://app.getplea.com/api/organizations/org-uuid-1234 \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Bufete López & Partners"}'
await fetch('https://app.getplea.com/api/organizations/org-uuid-1234', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({ name: 'Bufete López & Partners' })
});
{
"id": "org-uuid-1234",
"name": "Bufete López & Partners",
"taxId": "B12345678",
"address": "Calle Gran Vía 42, 28013 Madrid"
}
Endpoints para consultar y actualizar el perfil del usuario autenticado, y para gestionar las organizaciones a las que pertenece.
GET /api/profile
Obtiene el perfil completo del usuario autenticado.
PATCH /api/profile
Actualiza los datos del perfil del usuario.
Nombre completo.
Número de teléfono.
URL de la imagen de perfil.
POST /api/profile/switch-organization
Cambia la organización activa del usuario.
UUID de la organización a la que cambiar.
GET /api/organizations
Lista todas las organizaciones del usuario.
GET /api/organizations/:id
Obtiene los detalles de una organización específica.
UUID de la organización.
POST /api/organizations
Crea una nueva organización.
Nombre de la organización o despacho.
NIF o CIF de la organización.
Dirección postal.
Teléfono de contacto.
PATCH /api/organizations/:id
Actualiza los datos de una organización.
UUID de la organización.
Nuevo nombre.
NIF/CIF actualizado.
Nueva dirección.
Last updated today