API Tokens
API tokens are long-lived credentials for server integrations, scripts, and automated workflows. They stay valid until you revoke them.
Creating tokens
In the admin panel:
- Go to Settings > API Tokens
- Click Create Token
- Enter a name that identifies the token's purpose
- Select permissions (see below)
- Click Create
Copy your token
Via the API:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
mutation {
createPyloApiKey(
input: {
name: "CI/CD Integration"
permissions: ["read", "write"]
}
) {
data {
id
name
token
}
}
}Using tokens
Send the token in the pylo-api-key header:
1
2
3
4
curl -X POST https://api.pyloapp.com/graphql \
-H "Content-Type: application/json" \
-H "pylo-api-key: YOUR_API_TOKEN" \
-d '{"query": "{ customerList { data { id name } } }"}'In the SDKs, store the token in the PYLO_API_KEY environment variable and pass it as
apiKey: process.env.PYLO_API_KEY! in pylo.config.ts (codegen) and createPyloNode /
createPyloServer (data access). See the quickstarts.
Permissions
| Permission | Description |
|---|---|
read | Query entities (list and by-ID) |
write | Create, update, and delete entities |
admin | Full access including user management and settings |
Permissions combine: a token with ["read", "write"] can query and mutate data but cannot manage
users or app settings.
Least privilege
Create tokens with the minimum permissions required. Give a read-only integration read and
nothing else.
Revoking tokens
In the admin panel: Settings > API Tokens, find the token, click Delete. Via the API:
1
2
3
4
5
6
7
mutation {
deletePyloApiKey(ids: ["token-id"]) {
data {
success
}
}
}Revoked tokens stop working immediately, and requests carrying one get an UNAUTHORIZED error.