Skip to main content
API requests are authenticated with a Bearer token:
Authorization: Bearer apf_live_<64 hex chars>
The apf_live_ prefix identifies these as AutoPrintFarm production keys. It also lets GitHub’s secret scanning flag accidental commits.

Creating a key

Only owners and admins can mint API keys.
  1. Open Settings → API Keys in the dashboard.
  2. Click Create API Key.
  3. Enter a descriptive name (e.g. warehouse-dashboard-prod).
  4. Choose the scopes you need:
    • printers:read
    • jobs:read
    • inventory:read
  5. Click Create key.
The full key is shown exactly once after creation. AutoPrintFarm only stores its SHA-256 hash, so we can’t recover it for you. Copy it immediately into your secret manager.

Using a key

Send the key in the Authorization header on every request:
Terminal
curl -H "Authorization: Bearer apf_live_xxx..." \
  https://api.autoprintfarm.com/public/v1/printers
JavaScript
const res = await fetch("https://api.autoprintfarm.com/public/v1/printers", {
  headers: { Authorization: `Bearer ${process.env.APF_API_KEY}` },
});
const { data } = await res.json();
Python
import os, requests
r = requests.get(
    "https://api.autoprintfarm.com/public/v1/printers",
    headers={"Authorization": f"Bearer {os.environ['APF_API_KEY']}"},
)
r.raise_for_status()
print(r.json()["data"])

Scopes

Each request checks for the scope the endpoint requires. A key without the right scope gets 403 INSUFFICIENT_SCOPE.
ScopeGrants
printers:readGET /printers
jobs:readGET /jobs
inventory:readGET /inventory
Keys can hold any combination of scopes. Grant only what you need.

Revoking a key

Open Settings → API Keys and click the trash icon on a row. Revocation is immediate — the next request using that key returns 401 TOKEN_REVOKED. If you think a key may have leaked, revoke it and mint a new one. There is no rotation flow — just create + revoke.

Error codes

HTTPCodeMeaning
401UNAUTHORIZEDMissing Authorization header
401TOKEN_INVALIDBad prefix or unknown hash
401TOKEN_REVOKEDKey was revoked
401TOKEN_EXPIREDKey expired (if expiration was set)
403INSUFFICIENT_SCOPEKey doesn’t have the scope the endpoint needs
429RATE_LIMITEDYou exceeded the per-key rate limit