Cost Centres

Authentication: All endpoints require an Authorization: Bearer <access token> header.

Most endpoints require an X-Company-ID: <company_id> header to scope requests to a specific company. This is the recommended header for most API operations.

Some endpoints require an X-Location-ID: <location_id> header when the query doesn't accept a locationId parameter.

See Authentication for details on how to obtain and use these headers.

Query Cost Centres

GraphQL Query

query CostCentres($showArchived: Boolean!) {
  costCentres(showArchived: $showArchived) {
    id
    name
    externalId
    hidden
    modifiedAt
    modifiedBy {
      fullName
    }
  }
}

Example Variables

{
  "showArchived": false
}

Example Response

{
  "data": {
    "costCentres": [
      {
        "id": "41",
        "name": "Development",
        "externalId": null,
        "hidden": false,
        "modifiedAt": "2024-06-06T03:39:32.291Z",
        "modifiedBy": {
          "fullName": "Roubler Support"
        }
      },
      {
        "id": "42",
        "name": "Sales",
        "externalId": null,
        "hidden": false,
        "modifiedAt": "2024-06-06T03:39:35.917Z",
        "modifiedBy": {
          "fullName": "Roubler Support"
        }
      },
      {
        "id": "43",
        "name": "Customer Services",
        "externalId": null,
        "hidden": false,
        "modifiedAt": "2024-06-06T03:39:42.389Z",
        "modifiedBy": {
          "fullName": "Roubler Support"
        }
      }
    ]
  }
}

Add Cost Centre

GraphQL Mutation

mutation AddCostCentre($input: CostCentreInput!) {
  addCostCentre(input: $input) {
    id
    name
    externalId
    hidden
  }
}

Example Variables

{
  "input": {
    "name": "Brisbane Office",
    "externalId": "BCD234",
    "hidden": false
  }
}

Example Response

{
  "data": {
    "addCostCentre": {
      "id": "45",
      "name": "Brisbane Office",
      "externalId": "BCD234",
      "hidden": false
    }
  }
}