Skip to content

Authentication

The ShipRules AI REST API uses API keys for authentication. Each key is tied to a specific shop and has a permission level.

  1. Go to Settings > API Keys in the ShipRules AI dashboard.
  2. Click “Create API Key”.
  3. Enter a label (e.g., “Production”, “Staging”, “CI/CD”).
  4. Choose a permission level:
    • Read — can read rules, methods, zones, groups, versions, and simulate rates.
    • Write — everything Read can do, plus create, update, and delete entities.
    • Admin — everything Write can do, plus manage API keys and billing settings.
  5. Click “Create”.
  6. Copy the key immediately. It’s shown only once. The key starts with sr_live_ followed by 32 hex characters.

Include the key in the Authorization header of every API request:

Authorization: Bearer sr_live_a1b2c3d4e5f6...
PermissionReadWriteDeleteManage Keys
ReadYesNoNoNo
WriteYesYesYesNo
AdminYesYesYesYes
PlanAPI KeysAPI Access
Starter0No API access
Pro2Yes
Enterprise10Yes

Go to Settings > API Keys, find the key by its label and prefix (first 8 characters), and click “Revoke”. The key is immediately disabled — any requests using it will return a 401 error.

All API errors return a consistent JSON format:

{
"error": {
"code": "UNAUTHORIZED",
"message": "Invalid or expired API key"
}
}

Common authentication errors:

StatusCodeMeaning
401UNAUTHORIZEDMissing, invalid, or revoked API key
403FORBIDDENKey doesn’t have the required permission level
429RATE_LIMITEDToo many requests — slow down