Update a cost centre
const url = 'https://api2.recruso.co.uk/v1/branches/1/cost-centres/1';const options = { method: 'PUT', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"branchId":4,"id":31,"costCentreName":"Warehouse Operatives","sageDepartmentId":21,"nominalCode":4001}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api2.recruso.co.uk/v1/branches/1/cost-centres/1 \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "branchId": 4, "id": 31, "costCentreName": "Warehouse Operatives", "sageDepartmentId": 21, "nominalCode": 4001 }'Replaces the name and accounting fields of a cost centre. This is a full replacement — sageDepartmentId and nominalCode omitted from the request are written as null, so send the complete object.
A cost centre cannot be moved between branches; branchId identifies it, it does not reassign it.
The new name must stay unique within the branch: a clash with another active cost centre returns 400, and a clash with a deleted one returns 409 carrying that record’s costCentreId. A cost centre outside your agency, already deleted, or under a branch you cannot access returns 404.
Access. Requires a client-credentials access token. Tokens issued through the interactive user login are rejected.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The branchId path parameter
The id path parameter
Request Bodyrequired
Section titled “Request Bodyrequired”The replacement state of a cost centre. This is a full replacement, not a merge: an omitted sageDepartmentId or nominalCode is written as null rather than left alone, so send the complete object.
object
The branch the cost centre belongs to. Bound from the route. This identifies the cost centre; it does not move it to a different branch.
Example
4The cost centre to update. Bound from the route.
Example
31The cost centre name. Required, up to 50 characters, and unique among the branch’s cost centres including deleted ones: a clash with another active one returns 400, a clash with a deleted one returns 409. Leading and trailing whitespace is trimmed.
Example
Warehouse OperativesThe cost centre’s Sage department. Not verified against Sage by this endpoint — an unknown department is accepted here and fails later at posting time.
Example
21The nominal (general-ledger) code this cost centre posts against.
Example
4001Responses
Section titled “Responses”OK
The cost centre as it stands after the update.
object
The cost centre’s identifier. Unchanged by the update.
The branch the cost centre belongs to. Unchanged by the update.
The cost centre name, trimmed. Unique among the branch’s cost centres, deleted ones included.
The cost centre’s Sage department. The parent branch carries a sageDepartmentId of its own; which one a posting uses is decided by the Sage integration, not by this endpoint.
The nominal (general-ledger) code this cost centre posts against.
Example
{ "costCentreId": 31, "branchId": 4, "costCentreName": "Warehouse Operatives", "sageDepartmentId": 21, "nominalCode": 4001}Bad Request
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Unauthorized
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Forbidden
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Not Found
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Conflict
Returned with 409 when a cost centre name is already held by a deleted cost centre in the same branch. Restore that record or choose a different name.
object
The identifier of the deleted cost centre holding the name. Pass it to RestoreCostCentre to bring that record back instead of creating a new one.
A human-readable explanation of the conflict. Diagnostic text, not a stable machine-readable code — branch on the 409 status and costCentreId instead.
Example
{ "costCentreId": 31, "message": "A cost centre with this name was previously deleted for this branch."}
