Skip to main content

PCH-SIG API Reference

The PCH-SIG API is a REST API that allows interaction with all system features.

Base URL

https://sig.ucp-pch.org/api

Authentication

The API uses JSON Web Tokens (JWT) for authentication.

Obtain a Token

curl -X POST https://sig.ucp-pch.org/api/login \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com", "password": "password"}'

Response:

{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"refresh_token": "abc123...",
"user": {
"id": 1,
"email": "user@example.com",
"roles": ["ROLE_USER", "ROLE_ADMIN"]
}
}

Using the Token

Include the token in the Authorization header:

curl https://sig.ucp-pch.org/api/menages \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9..."

HTTP Status Codes

CodeDescription
200Success
201Resource created
204Success with no content (DELETE)
400Invalid request
401Not authenticated
403Access denied
404Resource not found
422Validation error
500Server error

Pagination

Collections are paginated by default (30 items per page).

Parameters

ParameterDescriptionExample
pagePage number?page=2
itemsPerPageItems per page?itemsPerPage=50

Main Endpoints

Authentication

MethodEndpointDescription
POST/api/loginLogin
POST/api/token/refreshRefresh token
POST/api/logoutLogout

Households

MethodEndpointDescription
GET/api/menagesList of households
GET/api/menages/\{id\}Household detail
POST/api/menagesCreate a household
PUT/api/menages/\{id\}Modify a household
DELETE/api/menages/\{id\}Delete a household

Beneficiaries

MethodEndpointDescription
GET/api/beneficiairesList of beneficiaries
GET/api/beneficiaires/\{id\}Beneficiary detail

Payment Cycles

MethodEndpointDescription
GET/api/cyclesList of cycles
POST/api/cyclesCreate a cycle
POST/api/cycles/\{id\}/generateGenerate payments
POST/api/cycles/\{id\}/validateValidate the cycle