POST /contract-server/v2/general/worker/agreements/{agreementId}/status
Inactivates a worker's agreement linked to the Client. The client_id is obtained through the authentication token.
Prerequisites
- The
agreementIdpath parameter is returned by the Get Workers endpoint - Use Get Workers filtered by
statusId=0to list only ACTIVE workers
Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
agreementId | integer | Yes | ID of the worker's agreement, obtained from Get Workers |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
status | string | Yes | New status for the worker. Accepted value: inactivated |
Headers
Authorization: Bearer <token>
Content-Type: application/json
Accept: application/json
Workflow
- Call Get Workers, optionally filtered by
statusId=0to retrieve only ACTIVE workers - Take the
agreementIdof the worker you want to inactivate - Send it in the path of this endpoint along with
"status": "inactivated"in the body
Example: Step 1 - Get the Agreement ID
curl --location 'https://api.demo.getontop.com/contract/workers/list?statusId=0' \
--header 'Authorization: Bearer <token>'Response:
{
"content": [
{
"agreementId": 16,
"firstName": "Juan",
"lastName": "Perez",
"legalName": null,
"email": "[email protected]",
"jobTitle": "Ingeniero de Software",
"country": "Argentina",
"externalId": "SFK005",
"workerCreationDate": "2023-09-21T14:42:38.793+00:00",
"status": "ACTIVE"
}
]
}Example: Step 2 - Inactivate the Agreement
curl --location --request POST 'https://api.demo.getontop.com/contract-server/v2/general/worker/agreements/16/status' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"status": "inactivated"
}'Response
Status: 200 OK
{
"agreement_id": 16,
"status": "inactivated",
"status_id": 5,
"changed": true
}Response Fields
| Field | Type | Description |
|---|---|---|
agreement_id | integer | ID of the updated agreement |
status | string | New status of the worker |
status_id | integer | Numeric ID of the new status (5 = INACTIVATED) |
changed | boolean | true if the status was updated; false if the worker already had that status |
Important Notes
⚠️ The worker must belong to the Client identified by the token. Otherwise, the request will be rejected.
Additional Information
- Inactivated workers have
status_id5, so they won't be returned when filtering Get Workers bystatusId=0(ACTIVE) - This endpoint returns fields in snake_case (
agreement_id), while Get Workers uses camelCase (agreementId)
