Tokens API

Mint short-lived credentials restricted to a single company, employee, or contractor and a controlled set of scopes.

🚧

Early access

The Tokens API is enabled per organization. If it is not enabled for yours, the token endpoints respond as if they do not exist. Contact your Check representative to request access.

A Check API key acts as your whole partner account. Anything that holds it can reach every company you manage and do everything your account can do. That is right for your own backend, but not for a credential you hand to an AI agent, a vendor, a support tool, or a session that acts for one employer.

The Tokens API lets you mint a token: a short-lived bearer credential that is restricted to a single company, employee, or contractor and carries only the scopes you choose. A token authenticates exactly like an API key, using the Authorization: Bearer header, so anything that already works with an API key works with a token. The difference is the blast radius. A leaked token is bounded to one entity, one scope set, and at most seven days.

Common uses:

  • An assistant for each employer. Mint a token per company and open an AI session with it, so each employer's agent sees only its own payroll data. See Company-Scoped MCP Sessions for the end-to-end flow with the hosted Check MCP Server.
  • A third-party integration. Give a vendor or a contractor-built tool a credential that can only touch the one company it works on.
  • A support or operations task. Hand a short-lived, read-only token to an internal tool instead of sharing your API key.

Who can mint tokens

Call the Tokens API with a Check API key or a Check Console session access token. Minting and revoking require the token:write scope; reading a token or the scope catalog requires token:read. In Console, Admin users can read tokens and Cost owners can mint and revoke them, mirroring the permissions for API keys.

Tokens minted through this API cannot call it. Neither can Onboard access tokens or partner OAuth application tokens. Those callers receive 403, so a token can never widen its own access.

What a token looks like

See the token object for the full schema. Each token has:

  • An id prefixed with tok_ and a human-readable label.
  • Exactly one grant. The grant names an entity (company, employee, or contractor plus its ID) and the list of scopes the token carries. resource is always null: resource-scoped tokens are not implemented yet, so a grant always covers the whole entity.
  • An expires_at timestamp and a status of active, revoked, or expired.
  • A secret, which is the bearer credential. It is an opaque 30-character string with no prefix, returned only in the response to Create a token and null everywhere else.

Store the id alongside wherever you keep the secret. There is no list endpoint, so the ID is how you read the token back or revoke it later.

Minting a token

Call POST /tokens with a label, an expiry, and one grant. For the scopes, pass either a preset or an explicit scopes list, never both.

curl -X POST https://sandbox.checkhq.com/tokens \
  -H "Authorization: Bearer your-api-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Acme Co. assistant",
    "expires_at": "2026-12-02T18:30:00Z",
    "grants": [
      {
        "entity": { "type": "company", "id": "com_097YZQ" },
        "resource": null,
        "preset": "read_only"
      }
    ]
  }'

The response returns 201 with the token and its secret. Capture the secret now; it is not returned again.

{
  "id": "tok_abc123",
  "label": "Acme Co. assistant",
  "grants": [
    {
      "entity": { "type": "company", "id": "com_097YZQ" },
      "resource": null,
      "scopes": ["company:read", "employee:read", "..."]
    }
  ],
  "expires_at": "2026-12-02T18:30:00Z",
  "status": "active",
  "secret": "k3Vx9QmT2pLw8RzN5bHc1YfJ7sGd4A"
}

Rules that apply to every mint:

  • Expiry is capped at seven days. expires_at must be in the future and at most seven days ahead. Mint a token per session or per task rather than treating it as a long-lived credential.
  • Scopes are narrowed to the caller's. The granted scopes are intersected with the scopes your own credential holds. A full-access API key can grant anything in the catalog; a Console user with a limited role mints a smaller token. If nothing survives the intersection, the mint fails with empty_scopes.
  • The response shows literal scopes. Whether you pass a preset or a list, grants[0].scopes in the response is the expanded list. A read_only token shows every scope in that preset, never the word read_only.
  • Tokens are environment-bound. A token minted in sandbox only works against sandbox, and a production token only against production.
  • The entity must be yours. Naming a company, employee, or contractor that does not belong to your account fails with entity_not_found.
  • Create does not honor Idempotency-Key. Each call mints a new token, so the secret is never served from a cached response.

Choosing scopes

read_only gives an inspect-only credential. read_write adds the ability to create, update, and delete resources. Neither preset can approve a payroll or move money. To grant one of those actions, pass an explicit scopes list that names it alongside the read scopes the caller needs:

{
  "entity": { "type": "company", "id": "com_097YZQ" },
  "resource": null,
  "scopes": ["company:read", "payroll:read", "payroll:approve"]
}

An unknown scope name fails with invalid_scopes, and the response names each bad scope. List scopes returns every scope a token may hold and which presets include it. The catalog is the source of truth and grows as new resources ship; the lists below reflect it at the time of writing.

What each preset grants

The same catalog applies to company, employee, and contractor grants. The entity decides which records the scopes apply to, not which scopes are available.

read_only grants these 59 scopes:

agency:read, bank_account:list, bank_account:read, bank_account:retrieve,
benefits:list, benefits:retrieve, bulk_create_job:read,
company:contractor_template:retrieve, company:earning_rate_template:retrieve,
company:employee_template:retrieve, company:external_payroll_import_fields:retrieve,
company:historical_payroll_template:retrieve, company:jurisdictions:retrieve,
company:paydays:retrieve, company:payroll_total_categories:retrieve, company:read,
company:reports:applied_for_ids_detailed:retrieve,
company:reports:child_support_payments:retrieve,
company:reports:contractor_payments:retrieve,
company:reports:employee_setup_params:retrieve,
company:reports:payroll_journal:retrieve, company:reports:payroll_summary:retrieve,
company:reports:tax_liabilities:retrieve, company:reports:w2_preview:retrieve,
company:reports:w4_exemption_status:retrieve, company_benefit:read,
company_funds_transfer:read, company_tax_setup:setting:retrieve,
contractor:payments:retrieve, contractor:read, contractor_payment:paper_check:retrieve,
contractor_payment:read, correction:read, earning_code:read, earning_rate:read,
employee:paystubes:retrieve, employee:read, employee:reciprocity_elections:retrieve,
employee_tax_setup:setting:retrieve, external_payroll:read,
historical_payroll_data:read, net_pay_split:read, pay_schedule:paydays:retrieve,
pay_schedule:read, payments:read, payroll:audit_report,
payroll:paper_checks:retrieve, payroll:read, payroll_item:paper_check:retrieve,
payroll_item:read, post_tax_deduction:list, requirement:read, sensitive_info:read,
setup:read, tax:read, tax_agency:read, tax_notice:read, void_support:read,
workplace:read

read_write grants everything in read_only plus these 60 write scopes, for 119 in total:

bank_account:create, bank_account:destroy, bank_account:partial_update,
bank_account:update, bank_account:write, benefits:create, benefits:destroy,
benefits:partial_update, benefits:update, bulk_create_job:write,
company:historical_payroll:delete, company:implementation:create, company:write,
company_benefit:delete, company_benefit:write, company_document:delete,
company_tax_setup:setting:create, company_tax_setup:setting:delete,
company_tax_setup:setting:partial_update, company_tax_setup:setting:update,
contractor:write, contractor_payment:delete, contractor_payment:write,
correction:delete, correction:write, document:download, earning_code:write,
earning_rate:write, employee:authorize_partner, employee:delete,
employee:reciprocity_elections:create, employee:reciprocity_elections:delete,
employee:reciprocity_elections:destroy, employee:reciprocity_elections:partial_update,
employee:reciprocity_elections:update, employee:write,
employee_tax_setup:setting:create, employee_tax_setup:setting:delete,
employee_tax_setup:setting:partial_update, employee_tax_setup:setting:update,
external_payroll:delete, external_payroll:write, historical_payroll_data:delete,
historical_payroll_data:write, net_pay_split:write, pay_schedule:write,
payments:write, payroll:delete, payroll:payroll_import, payroll:preview,
payroll:write, payroll_item:delete, payroll_item:write, post_tax_deduction:create,
post_tax_deduction:destroy, post_tax_deduction:partial_update, requirement:write,
setup:write, tax_notice:write, workplace:write

Explicit scopes only. These seven scopes approve payrolls or move money and belong to no preset:

correction:approve, payment:cancel, payment:refund, payment:retry,
payment:reverse, payroll:approve, payroll:reopen

Using a token

Send the secret as a bearer token, exactly as you would an API key:

curl https://sandbox.checkhq.com/companies/com_097YZQ \
  -H "Authorization: Bearer k3Vx9QmT2pLw8RzN5bHc1YfJ7sGd4A"

The Check API authenticates the token and enforces its grant on every request:

  • One entity. Requests for the granted company succeed. Requests for any other company return 404, the same as a resource that does not exist. An employee or contractor grant restricts the token to that worker's records in the same way.
  • Filtered lists. List endpoints such as /companies and /employees return only resources that belong to the grant. The caller sees a one-company account, not an empty one.
  • Only the granted scopes. A request that needs a scope the token does not hold returns 403 with the error type permission_denied. A read_only token cannot create, update, approve, or delete anything.
  • No access to the Tokens API. Calls to /tokens or /scopes with a minted token return 403.

Because a token is a standard bearer credential, it also works with the hosted Check MCP Server. Pass it in the Authorization header when connecting and the whole AI session inherits the grant. Company-Scoped MCP Sessions walks through that setup with client examples.

Checking a token

GET /tokens/{token} returns the token's metadata, including its current status. The secret is always null on this endpoint; if you lose the secret, mint a new token.

curl https://sandbox.checkhq.com/tokens/tok_abc123 \
  -H "Authorization: Bearer your-api-key-here"

A token's status moves from active to expired when expires_at passes, or to revoked when you revoke it. Neither transition can be reversed.

Revoking a token

POST /tokens/{token}/revoke revokes a token immediately and returns it with status: "revoked". Revoke a token as soon as the task it was minted for is done, or whenever the secret may have leaked.

curl -X POST https://sandbox.checkhq.com/tokens/tok_abc123/revoke \
  -H "Authorization: Bearer your-api-key-here"

Revoking an already-revoked token returns it unchanged. After revocation, any request that still uses the secret fails with 401, the error type authentication_failed, and the message Access token expired.. An expired token produces the same response, so do not rely on the message to tell the two apart; read the token's status instead.

Errors

Create validation failures return 400 with one of these error types in error.type. See Create a token for the full table.

Error typeCause
validation_errorThe body is malformed. This includes providing both preset and scopes, an empty scopes list, or an unknown preset. input_errors names the field.
token_expires_invalidexpires_at is in the past or more than seven days out.
entity_not_foundThe entity does not exist or is not yours.
invalid_scopesOne or more scope names are unknown. The response maps each bad name to a reason.
empty_scopesNothing remains after narrowing to the caller's scopes.

Across all endpoints, a caller that may not use the Tokens API receives 403, and an organization without the Tokens API enabled receives 404.

Handling secrets

  • Mint tokens from your backend and keep your API key there. Only the token's secret should reach the agent, tool, or vendor that needs it.
  • Give each token a label that identifies who or what holds it, so a token you find later is easy to trace.
  • Set expires_at as short as the task allows. Hours is often enough for an interactive session.
  • Revoke when the task ends rather than waiting for expiry.
  • Never log the secret. Log the token id instead; it is safe to record and is all you need to revoke.

Did this page help you?