Link a cost centre to a site
const url = 'https://api2.recruso.co.uk/v1/clients/1/sites/1/cost-centres';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"costCentreId":19}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api2.recruso.co.uk/v1/clients/1/sites/1/cost-centres \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "costCentreId": 19 }'Links one of your agency’s cost centres to a site, so work at that site can be booked against it. The link is the whole record — there is nothing to update, only add and remove.
The cost centre must belong to the same branch as the site. Cost centres are branch-scoped, and a cross-branch link returns 400. A site with no branch assigned cannot be linked to any cost centre, which also returns 400.
A cost centre already linked to the site returns 400 rather than creating a duplicate, and a cost centre that does not exist returns 400.
The site must belong to the client named in the route, otherwise 404. On success the Location header points at ListSiteCostCentres, since a single link has no endpoint of its own.
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 clientId path parameter
The siteId path parameter
Request Bodyrequired
Section titled “Request Bodyrequired”The cost centre to link to the site.
object
The cost centre being linked. Must belong to the same branch as the site.
Example
19Responses
Section titled “Responses”Created
A newly created site cost centre link.
object
The link’s own identifier. This is what RemoveSiteCostCentre takes, not the cost centre id.
The site the cost centre is linked to.
The cost centre being linked. Must belong to the same branch as the site.
Example
{ "siteCostCenterId": 631, "siteId": 512, "costCentreId": 19}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"}
