Skip to content

API keys and authentication

Developers

Every request to the Shipr API, except the health check, carries an API key. The key tells Shipr which merchant account the request is for and what it may do.

Ask Shipr support for an API key. Tell them:

You receive the key once. Shipr keeps only a fingerprint of it, so nobody can look it up later. If you lose it, ask for a new one.

Production keys start with sk_live_. Keys for Shipr’s test environments start with sk_test_.

Put the key in the Authorization header as a bearer token on every request.

Terminal window
curl https://api.shipr.tech/v1/locations \
-H "Authorization: Bearer $SHIPR_API_KEY"

A missing, mistyped or revoked key gets 401 with the message Invalid API key. A key that lacks a scope the endpoint needs gets 403 with Insufficient scope. See Errors, limits and retries.

Each key has a list of scopes. An endpoint checks for the scope it needs and refuses the request without it.

Scope What it allows
deliveries:read Get quotes. List and get deliveries, their tracking and labels. Print store delivery labels.
deliveries:write Create, change, re-pack, cancel and rebook deliveries.
manifests:read List and get manifests and download a manifest summary.
manifests:write Create manifests.
returns:read List and get returns.
returns:write Create returns.
webhooks:read List and get webhook endpoints and their delivery history.
webhooks:write Create, change, delete and test webhook endpoints, change their signing secret and resend events.
locations:read List and get locations and their self-delivery settings.
locations:write Create, change and delete locations and change self-delivery settings.
drivers:read List your store delivery drivers and invitations.
drivers:write Invite drivers, change their locations and remove them.
rate_overrides:read Read your rate overrides. You change them in the dashboard; the API can’t.
box_configs:read Read the box configurations Shipr packs parcels into.

Shipr sets up your carrier accounts for you, so an integration doesn’t need carrier scopes. If a carrier account needs changing, ask Shipr support.

A key with only deliveries:read and deliveries:write covers the usual flow: quote, book, label and track. Add webhooks:write if your code registers its own webhook endpoint.

A key can work for every location, or only for the locations Shipr support names when they make it. A limited key suits a single store’s point-of-sale system.

A key limited to some locations:

  • only sees deliveries, manifests, returns and trips from its locations
  • must send origin.location_id with one of its locations to quote or book. Any other location gets 400 with Invalid origin location
  • keeps only these scopes, whatever else it was given: deliveries:read, deliveries:write, manifests:read, manifests:write, returns:read, returns:write, locations:read, box_configs:read, drivers:read, drivers:write
  • can’t manage webhooks, read rate overrides or change locations. Those endpoints answer 403 with Not available to users limited to specific locations

Keys don’t expire. A key works until Shipr revokes it. Your account can have more than one key at once, so you can replace a key without downtime.

  1. Ask Shipr support for a new key with the same scopes and locations.
  2. Put the new key into your integration and deploy it.
  3. Check your requests succeed with the new key.
  4. Ask Shipr support to revoke the old key. From then on it gets 401.

If a key may have leaked, ask Shipr support to revoke it straight away, then follow the steps above.