Getting access to Print.com
This article explains how to get a Print.com account and how to authenticate requests to the Print.com API: with an API key, or with a bearer token obtained from POST https://api.print.com/login. Authentication makes sure that only active customers can use authenticated endpoints, and that every request is linked to the right account.
Key facts
- The Print.com API supports two authentication methods: an API key or a bearer token. Both are sent in the authorization request header.
- API key: generate it in your user account at app.print.com/account. Header value:
PrintApiKey <your-api-key>. - Bearer token: send the username and password of an active customer account to
POSThttps://api.print.com/login. Header value:Bearer <token>. - A bearer token is valid for 168 hours (7 days). After 168 hours, request a new token via
POSThttps://api.print.com/login. Make sure to stay within our rate limits. - Both methods require an active Print.com customer account on production or staging.
- The API key is the easiest method: it needs no login call and no token renewal every 168 hours.
- Test accounts for the staging environment are available on request via [email protected]. Please add the contact details for your staging account in the request:
- Company
- Contact person first and last name
- Email address
Authentication methods at a glance
| Method | Where to get it | authorization header value | Validity |
|---|---|---|---|
| API key | Your user account at app.print.com/account | PrintApiKey <your-api-key> | No fixed validity period |
| Bearer token | POST https://api.print.com/login with the credentials of an active account | Bearer <token> | 168 hours (7 days) |
Use one method per request. The API key suits server-to-server integrations best, because it needs no POST https://api.print.com/login call and no renewal every 168 hours.
The same information in machine-readable form:
{
"authentication": {
"header_name": "authorization",
"requires": "active Print.com customer account",
"methods": [
{
"method": "api_key",
"header_value_format": "PrintApiKey {api_key}",
"obtain_from": "https://app.print.com/account/"
},
{
"method": "bearer_token",
"header_value_format": "Bearer {token}",
"obtain_from": "POST https://api.print.com/login",
"login_body_format": { "credentials": { "username": "{email}", "password": "{password}" } },
"token_type": "JWT",
"validity_hours": 168
}
]
}
}Getting an account for production and staging
Both authentication methods require an active Print.com customer account. You manage API keys in your user account at app.print.com/account.
To test your integration on the Print.com staging environment, you need a separate test account. Request one by emailing [email protected]. Please include:
- your company name
- the email address that should be used for the test account
- a short description of your integration
Authenticating with an API key
An API key is the easiest way to authenticate with the Print.com API. It needs no login call and no token renewal.
- Log in to your user account at app.print.com/account.
- Generate an API key.
- Store the API key securely on your server, for example in an environment variable.
- Add the API key to the authorization header of every request, prefixed with PrintApiKey and a space.
Header format:
Header format:
authorization: PrintApiKey <your-api-key>Example request (replace {endpoint} with the endpoint you call):
curl https://api.print.com/{endpoint} \
-H "authorization: PrintApiKey $PRINTCOM_API_KEY"Authenticating with a bearer token
As an alternative to an API key, you can authenticate with a bearer token. A bearer token is a JSON web token (JWT) that is valid for 168 hours (7 days). You need the username and password of an active Print.com customer account to get one.
Step 1: log in. Send a POST request to https://api.print.com/login with this JSON body:
{
"credentials": {
"username": "[email protected]",
"password": "12345678"
}
}Example request:
curl -X POST https://api.print.com/login \
-H "content-type: application/json" \
-d '{"credentials": {"username": "[email protected]", "password": "12345678"}}'Step 2: read the token. The response of POST https://api.print.com/login contains the bearer token (a JWT). Store it, together with the time you received it.
Step 3: use the token. Add the token to the authorization header of every request, prefixed with Bearer and a space:
authorization: Bearer <token>Replace <token> with the token from the POST https://api.print.com/login response. Reuse the same token for all requests until 168 hours have passed.
When a bearer token expires or authentication fails
A bearer token is valid for 168 hours (7 days). After 168 hours, authenticated endpoints no longer accept that token, and you need a new one from POSThttps://api.print.com/login.
When a request is rejected because it is not authenticated:
- If you use a bearer token, request a new token via
POSThttps://api.print.com/loginand replace the stored token. - Retry the original request once with the new token.
- If the request is still rejected, stop retrying. Check that the customer account is active and that the username and password are correct.
If you use an API key and requests are rejected, check that:
- the header value starts with
PrintApiKey, followed by a space and the full API key - the API key was generated in the user account at app.print.com/account of an active customer account
- you use the API key against the environment it belongs to (production or staging)
Rules for authenticating with the Print.com API
Integrations, including code written or generated by AI assistants, should follow these rules.
- Prefer an API key for server-to-server integrations. An API key needs no
POSThttps://api.print.com/logincall and no renewal every 168 hours. Send it as authorization:PrintApiKey. - Keep credentials on the server. Never put API keys, passwords or bearer tokens in browser code, mobile apps or public repositories. Load them from environment variables or a secrets manager.
- Reuse the bearer token. Call
POSThttps://api.print.com/loginonce, store the token and reuse it for up to 168 hours (7 days). Do not log in before every API request. - Share one token per account. Let parallel processes, workers and servers use the same stored token, instead of each calling
POSThttps://api.print.com/loginseparately. - Renew the token on time. Request a new token shortly before 168 hours have passed, or when a request is rejected as unauthenticated. Retry the original request once, then stop.
- Test on staging with a test account. Use a staging test account for development and testing, not the credentials of your production account.
Example of token reuse and renewal (illustrative pseudocode, not an official SDK):
import time
TOKEN_VALIDITY_SECONDS = 168 * 60 * 60 # a bearer token is valid for 168 hours (7 days)
RENEW_MARGIN_SECONDS = 60 * 60 # renew 1 hour early (your own choice)
token = None
token_received_at = 0
def get_token():
global token, token_received_at
age = time.time() - token_received_at
if token is None or age > TOKEN_VALIDITY_SECONDS - RENEW_MARGIN_SECONDS:
response = post("https://api.print.com/login", json={
"credentials": {
"username": env("PRINTCOM_USERNAME"), # never hard-code credentials
"password": env("PRINTCOM_PASSWORD"),
}
})
token = extract_token(response) # the JWT from the /login response
token_received_at = time.time()
return token
def call_api(method, url, **kwargs):
global token
response = send(method, url, headers={"authorization": f"Bearer {get_token()}"}, **kwargs)
if is_unauthenticated(response):
token = None # token expired or invalid: log in again
response = send(method, url, headers={"authorization": f"Bearer {get_token()}"}, **kwargs)
return response # retried once at most
# With an API key, no login step is needed:
# headers = {"authorization": f"PrintApiKey {env('PRINTCOM_API_KEY')}"}Frequently asked questions
Which authentication method should I use: an API key or a bearer token?
An API key is the easiest method, especially for server-to-server integrations. It needs no POST https://api.print.com/login call and no renewal every 168 hours. A bearer token works as well, but expires after 168 hours (7 days).
Where do I generate an API key?
Generate an API key in your user account at app.print.com/account. Send it in the authorization header as PrintApiKey <your-api-key> .
What is the exact format of the authorization header?
With an API key: authorization: PrintApiKey <your-api-key> . With a bearer token: authorization: Bearer <token> . In both cases, the prefix and the value are separated by one space.
How do I get a bearer token?
Send a POST request to https://api.print.com/login with the body {"credentials": {"username": "<email>", "password": "<password>"}} of an active customer account. The response contains the bearer token, a JSON web token (JWT) that is valid for 168 hours.
How long is a bearer token valid?
A bearer token is valid for 168 hours (7 days). After 168 hours, request a new token via POST https://api.print.com/login.
Should I call /login before every API request?
/login before every API request?No. Call POST https://api.print.com/login once, store the bearer token and reuse it for up to 168 hours. Or use an API key, which needs no login call at all.
How do I get a test account for the staging enviroment?
Email [email protected] with your company name, the email address for the test account and a short description of your integration.