Team API
Manage Clients, Grants, Products and Client Tokens from your own systems, and read your Packs and download statistics.
The Team API lets your billing or licensing system do what an Admin does for a customer: create a Client when they buy, grant them Packs, issue their Token and send them their setup, end the Grant when the subscription lapses. It also reads your Team's Packs, Versions and download statistics.
API keys
An Admin creates one in the panel under Access → API keys. It looks like polypack_key_ followed by 38 characters, is shown once, and belongs to the Team rather than a person, so it keeps working when people leave. Choose what it can do:
- Read: GET requests only.
- Read and write: create, change and remove Clients, Grants, Clients' Products and Client Tokens too.
Keep it in a secret store. The panel shows when each key was last used and from where; revoke one there and its next request is refused. An API key is not a Token: it never installs a package, and a Token never works on the API.
Making a request
curl -H 'Authorization: Bearer polypack_key_…' https://api.polypack.io/v1/team
Every request is JSON over HTTPS to https://api.polypack.io/v1. The key decides the Team; there is no Team in the URL. Lists come 50 to a page, with meta (page, total, last page) and links (next, previous); ask for another with ?page=2. Dates are ISO 8601 in UTC.
A customer's whole life
curl -X POST https://api.polypack.io/v1/clients -H 'Authorization: Bearer polypack_key_…' -H 'Content-Type: application/json' -d '{"name": "Knuth Press"}'
curl -X POST https://api.polypack.io/v1/clients/42/grants -H 'Authorization: Bearer polypack_key_…' -H 'Content-Type: application/json' -d '{"pack_id": 7, "ends_on": "2027-11-30", "version_constraint": "^1.0"}'
curl -X POST https://api.polypack.io/v1/clients/42/tokens -H 'Authorization: Bearer polypack_key_…' -H 'Content-Type: application/json' -d '{"name": "Production"}'
Selling a tier? Define it once as a Product in the panel, then give the whole set with POST /clients/42/products and {"product_id": 3}: its default terms apply unless you send others, and every Pack you add to the Product later reaches the Client too (Products).
Later: change the Grant's end date with PATCH /clients/42/grants/{grant}, withdraw it with DELETE, revoke a Token with DELETE /clients/42/tokens/{token}, or remove the Client and all its Tokens with DELETE /clients/42.
Every endpoint
GET /team: your Team, its Plan and usage.GET /packs,GET /packs/{pack}(with its Versions),GET /packs/{pack}/downloads,GET /packs/{pack}/adoption(which versions each Client is on).GET /products,GET /products/{product}(with its Packs and default terms).GETandPOST /clients;GET,PATCHandDELETE /clients/{client};GET /clients/{client}/downloads.GETandPOST /clients/{client}/grants;PATCHandDELETE /clients/{client}/grants/{grant}. A Grant that comes from a Product carries itsproduct_grant_id, and is changed through the Product.GETandPOST /clients/{client}/products;PATCHandDELETE /clients/{client}/products/{productGrant}.GETandPOST /clients/{client}/tokens;DELETE /clients/{client}/tokens/{token}.
The full description, with every field, is an OpenAPI 3.1 document at https://api.polypack.io/v1/openapi.json: load it into your API client or generate one from it.
Errors
Every error has the same shape: {"error": {"code": "…", "message": "…"}}, with fields for validation. Match on code; the message is for people and may change.
- 401
unauthenticated: no key, or one that is wrong, revoked or expired. - 403
forbidden: a read-only key tried to change something.team_suspended: your Team is suspended. - 404
not_found: no such id in your Team. - 422
validation_failed, orlimit_reachedwhen your Plan has no room (the message says which limit). - 429
rate_limited: over 120 requests a minute for one key. Wait forRetry-Afterseconds.
Stability
Everything under /v1/ stays as it is: new fields and error codes may be added, but none is changed or removed. A change that would break a caller comes as /v2/, with /v1/ kept alongside.