Authentication
The GoodDay API authenticates every request with a merchant-scoped bearer token. Tokens are created from the GoodDay admin UI embedded in Shopify and are tied to one merchant account; they cannot be shared across merchants.
This guide walks through creating a token, scoping it to the endpoints you need, making your first call, and handling the two auth errors you will see most often.
1. Create a token
- In Shopify, open your GoodDay app.
- Navigate to Settings → API tokens.
- Click Create token.
- Give the token a human-readable name (e.g.
warehouse-syncoranalytics-read-only). You will use this name to find the token later when rotating or revoking it. - Select the scopes the token needs.
Scope selection
Scopes are strings of the form action:resource:
| Action | What it grants |
|---|---|
read |
Read-only access (GET) |
write |
Create and update access (POST, PATCH) |
delete |
Delete access (DELETE) — granted separately from write |
| Resource | Example endpoints |
|---|---|
purchase_orders |
GET /v1/purchase-orders |
sales_orders |
GET /v1/sales-orders |
items |
Item endpoints |
inventory |
Inventory endpoints |
Choose the narrowest set of scopes that lets your integration do its job.
A token that only needs to pull sales orders should have
read:sales_orders and nothing else. You can use the Read only
shortcut to grant every read:* scope in one click.
After you click Create, the token is shown once. Copy it immediately and store it in a secrets manager (1Password, AWS Secrets Manager, Google Secret Manager, etc.). If you lose the value, revoke the token and create a new one — there is no recovery flow.
Tokens start with the prefix gd_ so they are easy to spot in code reviews
and logs.
2. Make your first API call
Every request goes to https://api.gooddayai.com/v1/... and includes
the token in the Authorization header:
Authorization: Bearer gd_yourTokenValueHere
curl
curl https://api.gooddayai.com/v1/purchase-orders \
-H "Authorization: Bearer gd_yourTokenValueHere" \
-H "Accept: application/json"
JavaScript (Node 18+)
const response = await fetch('https://api.gooddayai.com/v1/purchase-orders', {
headers: {
Authorization: `Bearer ${process.env.GOODDAY_API_TOKEN}`,
Accept: 'application/json',
},
});
if (!response.ok) {
throw new Error(`GoodDay API ${response.status}: ${await response.text()}`);
}
const body = await response.json();
console.log(body.data);
Python
import os
import requests
resp = requests.get(
"https://api.gooddayai.com/v1/purchase-orders",
headers={
"Authorization": f"Bearer {os.environ['GOODDAY_API_TOKEN']}",
"Accept": "application/json",
},
timeout=30,
)
resp.raise_for_status()
print(resp.json()["data"])
3. Handle auth errors
There are two error classes you will hit regularly. Both return a JSON body
with an error.code field so you can branch on them programmatically. The
GoodDay API wraps every error in a consistent envelope:
{
"error": {
"code": "<UPPER_SNAKE_CASE_CODE>",
"message": "Human-readable message",
"documentationUrl": "https://api.gooddayai.com/docs/reference#errors"
}
}
401 — bad or missing token
Returned when:
- The
Authorizationheader is missing. - The token value is wrong or has been revoked.
- The token has expired (tokens do not expire by default, but a merchant admin can set an expiration).
Example response:
{
"error": {
"code": "AUTHENTICATION_FAILED",
"message": "Invalid or missing API token",
"documentationUrl": "https://api.gooddayai.com/docs/reference#errors"
}
}
What to do: confirm the token is still valid in the admin UI and that
your secret store has the full, untruncated value (including the gd_
prefix). Do not retry 401s in a loop — the token will not become valid.
403 — insufficient scope
Returned when the token is valid but does not include the scope required
for the endpoint you are calling. For example, a token with only
read:sales_orders calling POST /v1/purchase-orders.
Example response:
{
"error": {
"code": "AUTHORIZATION_ERROR",
"message": "Token is missing required scope 'write:purchase_orders'",
"documentationUrl": "https://api.gooddayai.com/docs/reference#errors"
}
}
What to do: update the token's scopes in the admin UI (no new token required) or create a new token with the correct scopes and rotate to it. Do not retry 403s — add the scope first.
4. Rotating and revoking tokens
- Rotate by creating a second token with the same scopes, deploying your integration with the new token, then revoking the old one. There is no downtime if you overlap the two tokens briefly.
- Revoke from the admin UI. Revocation takes effect immediately; subsequent requests with that token will return 401.
Next steps
- Create a purchase order end-to-end
- List and filter sales orders
- Open the full API reference for every endpoint, schema, and example.