Every endpoint on both APIs supports OAuth 2.0. For background, see oAuth 2.0.
To send authenticated requests:
- Exchange your
client_idandclient_secretfor an access token. Client credentials, and the tokens exchanged from them, differ between staging and production. They do not differ between Fulfilment and Last-mile. A Bearer token generated in Quiqdash needs none of this: generate it on the dashboard of the environment you will call. Its lifetime is the Expiration chosen at creation, one of Never, 1 Day, 7 Days, 30 Days or 60 Days. See Which credentials cross environments. - The response carries an access token and a refresh token. The lifetimes are stated once, in Token lifetime. Read
expires_infrom the response rather than hard-coding it. - Handle renewal. Before the access token expires, or on a 401, either send
grant_type=refresh_tokenwith the refresh token, or exchange the client id and secret again. A refresh token works once, see Refreshing.
Call the token endpoint on the host you are about to use. Within one environment the token is accepted on both, so a single exchange is enough for an integration that spans the two APIs.
Three options:
- Billing identifiers. Avoids Client ID and Client Secret entirely. You use your own API keys and pass a billing identifier, which maps the order to a specific customer. You remain the author of these orders; the client owns them. A client with several brands can only see each brand in its own dashboard.
- API keys per account. The client gets its own keys and becomes both author and owner. Again, a client with multiple brands has one account per brand.
- Master account keys plus billing identifiers per brand. A combination of the two. The client gets keys and Quiqup configures billing IDs per brand.
Billing IDs can come from the client, from the platform, or from Quiqup. How an identifier behaves on an order is described in billing_identifier.
Send the parameters in the body, form-encoded or as JSON. The endpoint also reads them from the query string, but a client_secret in a URL ends up in server, proxy and browser logs, so do not send it that way.
- Last-mile, staginghttps://api.staging.quiqup.com/oauth/token
- Last-mile, productionhttps://api-ae.quiqup.com/oauth/token
- Fulfilment, staginghttps://platform-api.staging.quiqup.com/oauth/token
- Fulfilment, productionhttps://platform-api.quiqup.com/oauth/token
curl -i -X POST \
https://api.staging.quiqup.com/oauth/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode grant_type=client_credentials \
--data-urlencode client_id=your_client_id \
--data-urlencode client_secret=your_client_secretexpires_in is how many seconds the returned access_token is valid for. After that, refresh it with the refresh_token, or request this endpoint again with the client id and secret.
Check the body, not the status. A client_id that does not exist is rejected with {"error": "invalid_client", "error_description": "..."} and no access_token, and that response is HTTP 200 on staging and HTTP 401 on production. A wrong secret for a real client id is a 401. Branch on the presence of access_token, not on the status code. A request with no grant_type returns 401 with unsupported_grant_type. A refresh token that was already used, or has expired, is rejected with invalid_grant.
{ "access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.example.signature", "token_type": "Bearer", "expires_in": 604800, "refresh_token": "EXAMPLEREFRESHTOKEN0123456789ABCDEF0123456789AB", "created_at": 1616571253 }