Authentication

You'll need to authenticate your requests to access any of the endpoints in the API. In this guide, we'll look at how authentication works. You'll need to have generated an API key within the OCS platform to be able to use our API.

API Key

To authenticate you need to supply an apikey in the Authorization header of your request. If you don't have your API key be sure to generate one within the OCS platform. Here's an example of setting the apikey in the request header using cURL:

Example request with API key

curl https://graphql.ocsoftware.co.uk \
  -H "Authorization: apikey {token}"

Always keep your token safe and delete it if you suspect it has been compromised. You can always generate another!

Account ID

Every request to our platform must have an X-OCS-ID header to identify the account that the request is being made on behalf of. This header should contain the account ID of the account you are making the request for. Here's an example of setting the X-OCS-ID in the request header using cURL:

Example request with account ID

curl https://graphql.ocsoftware.co.uk \
  -H "Authorization: apikey {token}" \
  -H "X-OCS-ID: {accountId}"

Unsure where to find this? Please reach out!

Was this page helpful?