Skip to main content

List Members by Center

GET /api/collection-centers/:centerId/members Retrieve all members for a specific collection center, sorted by name.

Path Parameters

centerId
string
required
Collection center ID

Response

Returns an array of member objects sorted by full_name.

Example Request

curl http://localhost:4000/api/collection-centers/center-1/members

Example Response

[
  {
    "id": "member-1",
    "center_id": "center-1",
    "full_name": "Juan Pérez",
    "cedula": "V-12345678",
    "phone": "+58 414 1234567",
    "role": "Recolector",
    "is_active": true,
    "created_at": "2026-01-05T09:00:00Z"
  },
  {
    "id": "member-2",
    "center_id": "center-1",
    "full_name": "María González",
    "cedula": "V-87654321",
    "phone": "+58 424 7654321",
    "role": "Coordinador",
    "is_active": true,
    "created_at": "2026-01-10T10:30:00Z"
  }
]

Create Member

POST /api/collection-center-members Create a new collection center member.

Request Body

id
string
required
Unique member identifier (UUID)
centerId
string
required
Collection center ID this member belongs to
fullName
string
required
Full name of the member
cedula
string
National ID number (cédula)
phone
string
Contact phone number
role
string
default:"Recolector"
Role at the collection center (e.g., “Recolector”, “Coordinador”, “Supervisor”)
isActive
boolean
default:"true"
Whether the member is currently active

Response

Returns the created member object with created_at timestamp.

Example Request

curl -X POST http://localhost:4000/api/collection-center-members \
  -H "Content-Type: application/json" \
  -d '{
    "id": "member-new-1",
    "centerId": "center-1",
    "fullName": "Carlos Rodríguez",
    "cedula": "V-11223344",
    "phone": "+58 412 3344556",
    "role": "Recolector",
    "isActive": true
  }'

Example Response

{
  "id": "member-new-1",
  "center_id": "center-1",
  "full_name": "Carlos Rodríguez",
  "cedula": "V-11223344",
  "phone": "+58 412 3344556",
  "role": "Recolector",
  "is_active": true,
  "created_at": "2026-03-09T12:00:00Z"
}

Update Member

PUT /api/collection-center-members/:id Update an existing collection center member.

Path Parameters

id
string
required
Member ID

Request Body

centerId
string
required
Collection center ID
fullName
string
required
Full name of the member
cedula
string
National ID number
phone
string
Contact phone number
role
string
required
Role at the collection center
isActive
boolean
required
Whether the member is active

Response

Returns the updated member object.

Example Request

curl -X PUT http://localhost:4000/api/collection-center-members/member-1 \
  -H "Content-Type: application/json" \
  -d '{
    "centerId": "center-1",
    "fullName": "Juan Pérez Martínez",
    "cedula": "V-12345678",
    "phone": "+58 414 1234567",
    "role": "Supervisor",
    "isActive": true
  }'

Example Response

{
  "id": "member-1",
  "center_id": "center-1",
  "full_name": "Juan Pérez Martínez",
  "cedula": "V-12345678",
  "phone": "+58 414 1234567",
  "role": "Supervisor",
  "is_active": true,
  "created_at": "2026-01-05T09:00:00Z"
}

Delete Member

DELETE /api/collection-center-members/:id Delete a collection center member by their ID.
Deleting a member will set the collector_member_id to NULL in related tickets due to ON DELETE SET NULL foreign key constraint. The collector name is cached in tickets, so historical data is preserved.

Path Parameters

id
string
required
Member ID

Response

ok
boolean
Returns true if deletion was successful

Example Request

curl -X DELETE http://localhost:4000/api/collection-center-members/member-2

Example Response

{
  "ok": true
}

Error Response

{
  "error": "DB delete error"
}

Build docs developers (and LLMs) love