Inactivate Agreement

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 agreementId path parameter is returned by the Get Workers endpoint
  • Use Get Workers filtered by statusId=0 to list only ACTIVE workers

Parameters

Path Parameters

ParameterTypeRequiredDescription
agreementIdintegerYesID of the worker's agreement, obtained from Get Workers

Body Parameters

ParameterTypeRequiredDescription
statusstringYesNew status for the worker. Accepted value: inactivated

Headers

Authorization: Bearer <token>
Content-Type: application/json
Accept: application/json

Workflow

  1. Call Get Workers, optionally filtered by statusId=0 to retrieve only ACTIVE workers
  2. Take the agreementId of the worker you want to inactivate
  3. 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

FieldTypeDescription
agreement_idintegerID of the updated agreement
statusstringNew status of the worker
status_idintegerNumeric ID of the new status (5 = INACTIVATED)
changedbooleantrue 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_id 5, so they won't be returned when filtering Get Workers by statusId=0 (ACTIVE)
  • This endpoint returns fields in snake_case (agreement_id), while Get Workers uses camelCase (agreementId)