Authentication
Every REST request uses HTTP Basic authentication with an API token as the username and its API key as the password. (The cXML endpoint carries the same token and key inside the cXML header instead; see the cXML section.)
Getting a token and key
In the PrintNow admin, go to Settings > API Keys and generate a token. The admin shows the token and its key together; the key is derived from the token, so they only work as a pair. Copy both when they're shown and keep them secret.
- A token/key pair works for every storefront in your PrintNow account. Use the Storefronts endpoints to find storefront ids.
- You can have up to 5 pairs, deactivated ones included; delete a pair to free a slot. Give each integration its own pair so you can revoke one without affecting the others.
Sending credentials
Combine them as token:key, Base64-encode the result, and send it in the Authorization header of every request:
curl https://api.printnow.com/api/v2/ping \
-H "Authorization: Basic $(printf '%s' 'YOUR_API_TOKEN:YOUR_API_KEY' | base64)"Most HTTP clients do this for you. With cURL, use -u:
curl -u "YOUR_API_TOKEN:YOUR_API_KEY" https://api.printnow.com/api/v2/pingCall ping first: 204 No Content means the credentials work.
How a request is checked
In this order:
- Credentials present. The
Authorizationheader must carry Basic credentials. - Valid pair. The key must match the token, and the token must exist, be active, and not be deleted.
- HTTPS. Requests over plain HTTP are refused.
- Rate limit. 100 calls per 10 seconds per account (see the introduction).
- Section access. Your account must include the section of the API you're calling.
Errors
| Status | Message | Cause |
|---|---|---|
401 | Authorization credentials missing. | No Authorization header, or it's empty. |
401 | Invalid key or token. | Malformed credentials, a key that doesn't match the token, or a token that doesn't exist, is inactive or was deleted. |
401 | Invalid scheme, please use https. | The request used HTTP. |
429 | Rate limit exceeded: 100 calls per 10 seconds. | Too many calls; wait for Retry-After seconds. |
403 | Your license does not include the Orders API. | Your account doesn't include that section (the message names it). |
A test call to ensure that your API credentials are working correctly.
Authorization
basic Your API token as the username and your API key as the password.
In: header
Response Body
application/json
application/json
curl -X GET "https://api.printnow.com/api/v2/ping"The key or token is missing, does not match, or the token is inactive or deleted.
{
"Message": "Invalid key or token."
}Each license may make 100 calls per 10 seconds across all its API keys. Wait for the Retry-After header (seconds) before calling again.
{
"Message": "Rate limit exceeded: 100 calls per 10 seconds."
}