Skip to main content

API Tokens

ProxCenter issues API tokens so external tooling can read, and optionally drive, your fleet without borrowing a person's account. A token is a service account: it carries its own scopes, its own perimeter of connections, its own quota, and it is deleted on its own without touching anybody's sign-in.

Architecture diagram of the API token model. Your integration calls with Bearer pxc_ and reaches an API token, a service account holding *:read scopes and up to 13 write scopes. Reads count against a read quota of 600 per minute; writes count against a separate write quota of 60 per minute, then pass a creator check that asks, on every write with a 60-second cache, whether the account that minted the token still holds the rights. Both paths reach only the connections perimeter inside the token's single tenant, here pve-cluster-a and pve-cluster-b, while pve-cluster-c, not chosen, stays out of reach. Left empty, the perimeter is every connection of the tenant, present and future, and a disabled tenant stops the token.Architecture diagram of the API token model. Your integration calls with Bearer pxc_ and reaches an API token, a service account holding *:read scopes and up to 13 write scopes. Reads count against a read quota of 600 per minute; writes count against a separate write quota of 60 per minute, then pass a creator check that asks, on every write with a 60-second cache, whether the account that minted the token still holds the rights. Both paths reach only the connections perimeter inside the token's single tenant, here pve-cluster-a and pve-cluster-b, while pve-cluster-c, not chosen, stays out of reach. Left empty, the perimeter is every connection of the tenant, present and future, and a disabled tenant stops the token.
A token belongs to one tenant and reaches only the connections you give it. Reads and writes have separate quotas, and only writes depend on the creator still holding the rights.

A token is a read-only credential by default, for dashboards, Prometheus-style scrapers, CI checks and any monitoring tool that only needs to look. A token can also carry write scopes, so scripts, CI pipelines and infrastructure-as-code tooling can create, change, power and delete guests, backups, storage, HA, pools, networks and firewall rules through ProxCenter instead of the raw Proxmox API. Writes keep everything ProxCenter adds on top of Proxmox: multi-cluster routing, tenant and vDC confinement, RBAC, quotas and audit. See Write tokens.

info

These are ProxCenter's own tokens. The Proxmox API tokens used to declare a PVE or PBS connection are a different thing, described in Connect Your Infrastructure.

Enterprise Feature

API access, read and write, is unlocked by the ProxCenter API Access add-on license on top of an Enterprise edition. Without it, creating a token is refused and every token call answers HTTP 403 Feature not licensed. If the option lapses, existing tokens stop working but can still be listed and deleted, so you can clean up after the add-on rather than being locked out of your own token table.

Settings API tab showing the ProxCenter API Access add-on requirement
An active Enterprise license still needs the API Access add-on before tokens can be created and used.

Quick Path​

Before you start

Create a read token and make a first call

  1. Open Settings > API, click New token, and enter a Name.
  2. Select the Tenant, leave Connections empty for all of its connections, and set at least one domain to Read under Scopes.
  3. Click Create, then copy the secret from Copy your token now into your secret manager. It is displayed only once.
  4. Send it as a bearer token, for example to /api/v1/public/health, see Authenticating a call.

Check the result

  • The call answers with the application status and the reachability of each connection the token can see; a refused call answers with one of the statuses listed under Authenticating a call.
  • The token's row in Settings > API shows the date and the caller's IP address under Last used.

Choose Your Path​

You want toPage
Read the fleet from a script: authentication, endpoints, quotasCalling the API
Change the fleet from a script or a CI pipelineWrite Tokens
Manage guests and firewall objects from Terraform or AnsibleTerraform and Ansible
Scrape metrics into Prometheus and use the Grafana dashboardsPrometheus and Grafana
Delete a token, offboard its creator, read the audit trailDeleting a token, Offboarding a user and Audit trail, on this page

Read by default, write by explicit scope​

A token with only *:read scopes cannot change anything, and that is enforced rather than assumed:

  • A request is accepted only if its method is the one the matched endpoint declares (HEAD rides on GET). Any other method answers HTTP 405 Method not allowed for this API token route with an Allow header listing the methods that exist on that path, decided before any scope or database lookup.
  • Only the endpoints listed under Endpoints and Write endpoints are reachable. Everywhere else a token is not an authenticated caller at all and receives the ordinary HTTP 401.
  • A write endpoint demands a write scope. A token holding only *:read scopes is refused with HTTP 403 Route not available to API tokens.

Creating a token​

Tokens live in Settings > API. The tab is provider-only: you must be a super_admin in the provider tenant, and the routes behind it require the admin.apitokens permission.

Create an API token dialog for a read-only monitoring token: name, description, Expiration set to 90 days, VMs and containers, Backups, Storage and Nodes and cluster on Read, Automation, Alerts and Reports on None, Default tenant and Connections left empty for all connections of the tenant
A monitoring token only needs Read on the domains it scrapes. Leave Connections empty to cover every connection of the tenant, including future ones.
  1. Open Settings > API and click New token.
  2. Enter a Name, and a Description if you want one.
  3. Choose an Expiration: No expiration, 30 days, 90 days, 1 year, or Custom with a number of days.
  4. Select the Tenant the token reads for.
  5. Under Connections, pick the connections it may read. Left empty it means All connections of the tenant, including connections added later.
  6. Under Scopes, set at least one domain (VMs and containers, Backups, Storage, Nodes and cluster, Automation, Alerts, Reports) to Read or Write. Write includes Read. On a domain with several write scopes, toggles appear under the row to pick them: everything is selected except Delete, which you select explicitly. Automation, Alerts and Reports are read only. Hover a row or a toggle to see the exact scope ids it grants.
  7. If a domain is on Write, a warning appears; check the Writes per minute (60 by default) and the expiration, which switches to 90 days and can still be changed.
  8. Click Create.
The same dialog with VMs and containers on Write: the warning about write scopes, the Power, Edit, Snapshots and Migrate toggles selected, the red Delete toggle left unselected (1), and Writes per minute at 60 (2)
Setting a domain to Write shows its sub-scopes. Everything is selected except Delete (1), which you must select yourself; Writes per minute (2) caps the write requests separately from reads.
Nodes and cluster set to Write in the token dialog, with the HA, Pools, Network and Firewall toggles below it and a tooltip listing Read: nodes:read and Write: ha:write, pools:write, network:write, firewall:write
Hover a scope row to see the exact scope ids it grants.

A write scope the creating account is not allowed to grant is greyed out, see Who can mint a write token. ProxCenter then shows Copy your token now with the full secret. Copy it into your secret manager and click Done.

Copy your token now dialog with the warning that the secret will never be shown again, the token secret (example value) with its copy button, and Done
The secret is shown once, right after Create. Copy it into your secret manager before clicking Done.
danger

The secret is displayed exactly once. Only a peppered HMAC-SHA-256 of it is stored, next to the first 12 characters kept as a lookup prefix, so no one, administrator or database owner, can recover it afterwards. A lost secret means deleting the token and creating another one.

The listing then shows one row per token with its Prefix, Name, Tenant, Scopes, Expires, Last used and Created by, plus the Delete action. Never under Expires means the token has no expiry date, and Never under Last used means it has not been called yet; once it has, that cell carries the date and the caller's IP address.

Settings API tab titled API tokens with API reference and New token, listing three tokens with Prefix, Name, Tenant, Scopes, Expires, Last used and Created by: the pxc_ prefix (1), Never under Expires (2), a last-use date with the caller IP 192.0.2.10 (3), Never under Last used for a token not called yet (4), and the creator email (5)
Each token shows its prefix (1), its expiry, Never when it has none (2), when and from which IP address it was last used (3), Never if it has not been called yet (4), and who created it (5).

Created by​

Created by carries the email address of the account that minted the token, captured at creation and never refreshed afterwards. Freezing it is deliberate: the point of the column is to answer "who issued this thing" months later, including after that person has left and their account has been deleted. A token whose creator cannot be resolved shows Unknown.

Because the provenance is frozen on the token, deleting a user never deletes the trail of what they issued. It does, however, leave their tokens working: see Offboarding a user.

Token format​

A secret is pxc_ followed by 32 random bytes in base64url, 47 characters in all. The Prefix column shows pxc_ plus the first 8 characters of the random part, which is the only part of the secret ProxCenter ever stores in clear or displays again.

Scopes​

A scope is a bundle of RBAC permissions. The read scopes below bundle read permissions only; the write scopes have their own page, Write Tokens. Endpoints that name several scopes are satisfied by any one of them.

ScopeOpens
vms:readThe VM and container list, and the proxcenter_vm_* metrics
nodes:readThe inventory tree, and the proxcenter_node_* metrics
storage:readThe storage list, and the proxcenter_storage_* metrics
backups:readPBS snapshots, fleet backup freshness, and the proxcenter_backup_* metrics
automation:readNo endpoint
alerts:readNo endpoint
reports:readNo endpoint

The last three are selectable in the creation dialog but no endpoint requires them, so granting them changes nothing. Grant only what your integration reads.

A token carrying an unknown scope

An unknown scope, such as compliance:read, contributes no permission at all: the token is simply evaluated on its other scopes.

On the metrics endpoint a missing scope filters the corresponding metric families out of an otherwise normal 200, rather than failing the scrape.

Tenant and connection perimeter​

A token is bound to one tenant, and reads only what that tenant owns. If the tenant is disabled, the token stops working.

Within the tenant, the Connections field narrows the perimeter further. Left empty the token sees every connection of the tenant, present and future; filled in it sees exactly those connections, and a connection that later moves out of the tenant drops out of the perimeter on its own. Every response is filtered through that intersection, and a perimeter that cannot be resolved is treated as empty rather than as unrestricted.

Deleting a token​

Click Delete on the row and confirm. The dialog states the consequence plainly: Delete this token? Integrations using it stop working immediately, and this cannot be undone.

Delete confirmation dialog reading Delete this token? Integrations using it stop working immediately, and this cannot be undone, with Cancel and Confirm
Deleting a token cannot be undone: integrations that use it stop working at once.

Deletion takes effect on the very next call, because every call resolves the token with a fresh indexed lookup and nothing is cached.

warning

Deleting is immediate and final. Integrations using that token stop working at once, and there is no un-delete: issue a new token and update the integration.

The row is removed from the table. What survives is the audit trail: the apitoken.create entry written when the token was issued and the apitoken.delete entry written in the same transaction as the deletion, both carrying the prefix. The token table is therefore a list of tokens that exist, not a history of tokens that once did.

Tokens marked Revoked

A token that carries a read-only Revoked chip is refused at authentication. Its Delete button removes the row like any other token.

An expiry date stops a token at its due time without removing anything, and the caller cannot tell an expired token from a deleted or an unknown one: all three answer the same HTTP 401.

Offboarding a user​

A token authenticates on its own. It does not ride on its creator's session, so disabling or deleting the account that minted it does not stop its reads: it keeps reading your fleet at the same quota until someone deletes it. Writes are different: they are refused within 60 seconds once the creator is disabled, deleted, removed from the tenant or loses the rights behind the scope, see Who can mint a write token.

The user dialogs on Security & Access > Users say so. When you disable or delete an account that minted tokens, the dialog lists them, each with its name, its prefix and when it was last used, under one of two warnings:

  • Disabling: This account created N active API token(s). Disabling the account does not stop them: a token authenticates on its own.
  • Deleting: This account created N active API token(s). They survive the deletion: a token authenticates on its own.

A checkbox, Delete these tokens as well, deletes them in the same gesture. It is unchecked by default, on both dialogs, and it is reset every time the dialog opens: keeping a token alive past its creator is a legitimate choice, so nothing is destroyed unless you ask for it in that exact dialog.

When the box is ticked, the tokens are deleted before the account is written. If the deletion fails, the account stays as it was rather than ending up disabled or deleted with live tokens behind it. The audit log records how many tokens went, and which prefixes, alongside the account change.

Listing the tokens of a user requires admin.users, the permission that already governs the Users page, rather than admin.apitokens: an administrator offboarding somebody needs to see what that person issued without being handed the keys to the whole token table.

tip

The same information is available the other way round from Settings > API, where the Created by column names the account that issued each token.

Audit trail​

Token management, token writes and refusals are written to the audit log under category api_tokens:

ActionNotes
apitoken.createWritten in the same transaction as the token itself, with the tenant, the scopes, the connections and the expiry date
apitoken.deleteWritten in the same transaction as the deletion, once per token, with the prefix. This is the only trace left once the row is gone
apitoken.writeEvery write made with a token, success or failure, after the handler has answered. It carries the token name and prefix, the method, the path, the endpoint id, the HTTP status and the Proxmox UPID(s) when the answer holds any. The handler's own audit entry, when it has one, is kept as well
apitoken.deniedEvery refused call, with the reason, the HTTP status and the token prefix. Never the secret

Tokens deleted while offboarding a user are recorded on the user's own audit entry, with the number of tokens and their prefixes.

note

Older entries may carry the action apitoken.revoke. They are kept and read normally.

Successful reads are not audited one by one, the Last used timestamp carries that. Writes are: each one is journaled as apitoken.write, and the actor column of the audit page shows the token name and its prefix instead of a user. A failed audit write never turns an answered request into an error. Rows written while a token is the caller are attributed to the token, not to a user, and the UPID stored on the row is what lets a vDC token read the outcome of a task it started.

Audit & Logs filtered on apitoken: two apitoken.write rows and one apitoken.denied row whose Users column shows a key icon with the token name and prefix, one write in error, the denied call in error, and three apitoken.create rows by the administrator
Calls made with a token show the token name and prefix in the Users column; refused calls appear as apitoken.denied.

Permissions​

PermissionDescription
admin.apitokensCreate, list and delete API tokens

Creating a token with a write scope additionally requires the permissions of that scope, see Who can mint a write token.

The Settings > API tab and the Settings > API reference page are additionally reserved for a super_admin acting in the provider tenant.