Crystallize Access Tokens
Crystallize Access Tokens allow you to make API requests that require authentication, such as fetching and creating orders via the Order API.
Creating a Crystallize Access Token
Creating access tokens is very straightforward within Crystallize. Simply head over to the Settings page within the Crystallize App and click on Access tokens.
Click on Generate a new token +, provide a name for the token, and click Generate token. This will generate an access key with an ID and a secret. You should make a note of these, as the secret will not be shown again.
Making Requests
Once you have your access token, you can make requests where authentication is required, such as the Order API. You can add your token ID and secret with the headers X-Crystallize-Access-Token-Id and X-Crystallize-Access-Token-Secret respectively.
Below is an example of how you might make a request to the Order API via cURL.
curl \
-X POST \
-H "Content-Type: application/json" \
-H "X-Crystallize-Access-Token-Id: [your-crystallize-token-id]" \
-H "X-Crystallize-Access-Token-Secret: [your-crystallize-token-secret]" \
--data '{ "query": "{ orders { get(id: \"[order-id]\") { total { gross } } } }" }' \
https://api.crystallize.com/[your-tenant-identifier]/orders