Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/GuillermoNavarro/Proyecto_comunidades/llms.txt

Use this file to discover all available pages before exploring further.

The Communities API provides full lifecycle management for Comunidad resources — the top-level organisational unit of the platform. Every user, fee, and receipt belongs to exactly one community. Most write operations are restricted to the SUPER_ADMIN role (platform managers), while read access to an individual community is available to community-level ADMIN users as well. All endpoints require a valid JWT Bearer token in the Authorization header.

GET /api/comunidades

Returns every community registered on the platform.
Required role: SUPER_ADMIN
curl -X GET https://api.example.com/api/comunidades \
  -H "Authorization: Bearer <token>"
Response 200 OK — array of Comunidad objects.
[].id
number
Unique identifier of the community (auto-generated).
[].nombre
string
Display name of the community (e.g. "Comunidad Los Pinos").
[].direccion
string
Street address of the community building.
[].ciudad
string
City where the community is located.
[].codPostal
string
Postal code of the community.
Example response
[
  {
    "id": 1,
    "nombre": "Comunidad Los Pinos",
    "direccion": "Calle Mayor 10",
    "ciudad": "Madrid",
    "codPostal": "28001"
  },
  {
    "id": 2,
    "nombre": "Residencial La Fuente",
    "direccion": "Avenida del Parque 45",
    "ciudad": "Sevilla",
    "codPostal": "41001"
  }
]
StatusMeaning
200OK — list returned (may be empty).
403Forbidden — caller does not have SUPER_ADMIN role.

GET /api/comunidades/activos

Returns a summary of every community together with its count of currently active users (i.e. users whose estado is true).
Required role: SUPER_ADMIN
curl -X GET https://api.example.com/api/comunidades/activos \
  -H "Authorization: Bearer <token>"
Response 200 OK — array of ActivoComunidad projection objects.
[].id
number
Unique identifier of the community.
[].nombre
string
Display name of the community.
[].codPostal
string
Postal code of the community.
[].usuarios
number
Number of users with estado = true (active residents) in this community.
Example response
[
  {
    "id": 1,
    "nombre": "Comunidad Los Pinos",
    "codPostal": "28001",
    "usuarios": 12
  },
  {
    "id": 2,
    "nombre": "Residencial La Fuente",
    "codPostal": "41001",
    "usuarios": 7
  }
]
StatusMeaning
200OK — list returned (may be empty).
403Forbidden — caller does not have SUPER_ADMIN role.

GET /api/comunidades/{id}

Retrieves a single community by its numeric id.
Required role: ADMIN or SUPER_ADMIN

Path parameters

id
number
required
The unique identifier of the community to retrieve.
curl -X GET https://api.example.com/api/comunidades/1 \
  -H "Authorization: Bearer <token>"
Response 200 OK — a single Comunidad object.
id
number
Unique identifier of the community.
nombre
string
Display name of the community.
direccion
string
Street address of the community building.
ciudad
string
City where the community is located.
codPostal
string
Postal code of the community.
Example response
{
  "id": 1,
  "nombre": "Comunidad Los Pinos",
  "direccion": "Calle Mayor 10",
  "ciudad": "Madrid",
  "codPostal": "28001"
}
StatusMeaning
200OK — community found and returned.
404Not Found — no community exists with the given id.
403Forbidden — caller does not have the required role.

POST /api/comunidades

Creates a new community. The id field is auto-generated and should not be included in the request body.
Required role: SUPER_ADMIN

Request body

nombre
string
required
Display name of the community.
direccion
string
required
Street address of the community building.
ciudad
string
required
City where the community is located.
codPostal
string
required
Postal / ZIP code of the community.
curl -X POST https://api.example.com/api/comunidades \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Comunidad Los Pinos",
    "direccion": "Calle Mayor 10",
    "ciudad": "Madrid",
    "codPostal": "28001"
  }'
Response 200 OK — the newly created Comunidad object including its generated id.
Example response
{
  "id": 3,
  "nombre": "Comunidad Los Pinos",
  "direccion": "Calle Mayor 10",
  "ciudad": "Madrid",
  "codPostal": "28001"
}
StatusMeaning
200OK — community created successfully.
403Forbidden — caller does not have SUPER_ADMIN role.

PUT /api/comunidades/{id}

Replaces all editable fields on an existing community with the values provided in the request body.
Required role: SUPER_ADMIN

Path parameters

id
number
required
The unique identifier of the community to update.

Request body

nombre
string
New display name of the community.
direccion
string
New street address.
ciudad
string
New city.
codPostal
string
New postal code.
curl -X PUT https://api.example.com/api/comunidades/1 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Comunidad Los Pinos (Bloque B)",
    "direccion": "Calle Mayor 10",
    "ciudad": "Madrid",
    "codPostal": "28001"
  }'
Response 200 OK — the updated Comunidad object.
Example response
{
  "id": 1,
  "nombre": "Comunidad Los Pinos (Bloque B)",
  "direccion": "Calle Mayor 10",
  "ciudad": "Madrid",
  "codPostal": "28001"
}
StatusMeaning
200OK — community updated and returned.
404Not Found — no community exists with the given id. Returns the string "Comunidad no encontrada.".
403Forbidden — caller does not have SUPER_ADMIN role.

Build docs developers (and LLMs) love