Skip to content

Authentication

Every request to the Flint API carries one credential, in the Authorization header as a bearer token. For a server integration, that credential is a secret API key. The key decides everything else: a flint_test_... key runs in test mode against the one sandbox it's bound to, and a flint_live_... key runs against your live account with real money. Test and live requests go to the same host, https://api.withflintpay.com, with no mode flag. Every Flint key is secret and belongs on your server.

Send your key#

Put the key after Bearer in the Authorization header. GET /v1/auth-context accepts API keys, CLI login tokens, workload tokens, partner app tokens, and onboarding sessions. It needs no scope and returns the credential's identity, mode, and current access:

cURL
curl https://api.withflintpay.com/v1/auth-context \
  -H "Authorization: Bearer YOUR_API_KEY"
Response
{
  "data": {
    "auth_type": "api_key",
    "partner_app_install_id": null,
    "api_key_id": "key_01KWJ93G11C7MF8REX91MDS0CD",
    "name": "Local development",
    "merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
    "organization_id": "org_01KEZF7C00MTFBRRKJA6QQX04J",
    "mode": "test",
    "access": "restricted",
    "sandbox_id": "test_01KNB061AGD0CYYF16M5QAQE3N",
    "scopes": ["commerce.orders.write", "payments.payment_intents.write"]
  },
  "request_id": "req_01KWM6SZJQGQWNFPTAF5HE7MHH"
}

mode is test or live. Test credentials include sandbox_id; live credentials omit it. access is full, read_only, or restricted. scopes lists what the key can do today, including resolved scopes for full and read_only keys. Scoped tokens report access: restricted. Onboarding sessions instead report user_id, can_manage_api_keys, expires_at, and fresh_verification_expires_at; they have no access or scopes. Their merchant_id and sandbox_id are null when that setup context does not exist yet. The five auth_type values select separate response shapes. Dashboard sessions are refused with wrong_credential_type. Every authenticated response also carries a Flint-Mode header, test or live, and test-mode responses add Flint-Sandbox-Id, so you can assert the mode in a deploy check without an extra call.

For credentials bound to one context, Flint-Merchant-Id, Flint-Mode, and Flint-Sandbox-Id are optional assertions. Send them only when they match the credential's merchant, mode, and public sandbox ID. A conflicting value returns 403 FORBIDDEN with details[0].reason: context_mismatch, retry: none, error_source: caller, and param naming the header. A live credential cannot name a sandbox. This applies to API keys, CLI login and workload tokens, onboarding sessions, checkout tokens, customer sessions, and invoice access tokens. Onboarding sessions in test mode assert the merchant's default sandbox. Dashboard sessions use these headers to select a context.

Send exactly one Authorization header. Repeating it, even with the same value, returns 400 INVALID_REQUEST with a NOT_ALLOWED detail and param: Authorization, including on OAuth credential exchanges.

Returns non-secret metadata for the credential that sent the request.

Every response has an X-Request-Id header, and the body repeats it as request_id, or as error.request_id on a failure. It's req_ followed by 26 characters and identifies one request, so quote it when you ask Flint Help. A failure returns an error object in place of data.

What Flint reads#

Flint reads credentials only from one Authorization header, with the case-insensitive Bearer scheme (bearer and BEARER also work):

HTTP
Authorization: Bearer YOUR_API_KEY
  • Send one Authorization header. Repeating it, even with the same value, returns 400 INVALID_REQUEST, detail NOT_ALLOWED, and param: Authorization. Spaces or tabs may separate the scheme and token, and may surround the header value. Whitespace inside the token and non-ASCII bytes are refused.
  • Other credential headers are refused. An authenticated endpoint rejects a request that carries X-API-Key, X-Onboarding-Session-Token, or X-Developer-Session-Token, even when the header is empty and Authorization holds a valid key. The response is 401 INVALID_CREDENTIAL with details[0].reason malformed, and param names the header to remove. Endpoints that take no credential ignore these headers.
  • HTTP Basic and other schemes are refused with 401 INVALID_CREDENTIAL, reason malformed, and param Authorization.
  • A key in the query string isn't read. The request has no credential, so it fails with 401 AUTHENTICATION_REQUIRED.

Test and live keys#

The key prefix picks the mode on every request.

flint_test_

Test keys

Run against one sandbox with its own orders, customers, and payments. Card charges are simulated and no money moves. Each test key is bound to one sandbox when it's created, so the key you send selects the sandbox. Keys from the dashboard are bound for you.

flint_live_

Live keys

Run against your live account and charge real cards. Live keys are never bound to a sandbox. Create one when you're ready to take real payments, with only the scopes that integration needs.

Test and live data never mix. An order created with a test key is invisible to a live key and to a key for another sandbox. To work somewhere else, send a key for that environment; a request can't switch it.

Two test-key failures come from the binding, and both are fixed by creating a key in an active sandbox:

  • A test key that isn't bound to a sandbox returns 401 INVALID_CREDENTIAL with details[0].reason mode_mismatch.
  • A test key whose sandbox was archived returns 401 INVALID_CREDENTIAL with details[0].reason revoked.

Sandboxes & test mode covers creating more sandboxes, resetting test data, and test cards. Going live covers swapping in a live key.

Get a key#

  • The dashboard. Create test and live keys on the API keys page.
  • The CLI. After flint login, flint api-keys create creates a key in the login's context. A live login from flint login --live creates live keys; see Going live.
  • API onboarding. A script or an agent can create the merchant account and its first sandbox key; see API & agent onboarding.
  • A sandbox. A live full-access key or a freshly verified onboarding session can issue a test key bound to a sandbox with POST /v1/api-keys and that sandbox's sandbox_id. A live key or a session can name any of your active sandboxes. See Issue a key for an existing sandbox.
  • The API keys endpoints. A key with accounts.api_keys.write creates more keys in its own mode; see Manage keys over the API.

The full secret, secret_key, comes back only in the response that creates the key. Flint can't show it again. If you lose it, create a replacement and revoke the old key.

The key object#

A key has a non-secret ID for managing it and a secret for authenticating with it.

FieldDescription
api_key_idThe key's ID, such as key_01KWJ93G11C7MF8REX91MDS0CD. Use it to retrieve, update, or revoke the key. Safe to log.
key_prefixThe mode prefix and the first 8 characters of the secret, such as flint_test_9f8e7d6c. Safe to show in a UI or log to tell keys apart.
secret_keyThe full secret you send in Authorization. Present only in the create response.
nameYour label for the key, up to 100 characters.
accessfull, read_only, or restricted. See Key access.
scopesThe scopes the key holds now. For full and read_only keys, the list grows when Flint adds scopes. See Scopes.
statusactive, expired, or revoked. Only an active key authenticates. A key reads expired once expires_at has passed, and revoked after it's revoked, even if it also expired.
expires_atWhen the key stops authenticating. Absent when the key never expires.
versionIncreases each time the key is updated or revoked. Send it as expected_version when you change access or scopes.
merchant_idThe merchant the key belongs to.
sandbox_idThe sandbox a test key is bound to. Absent on live keys.
partner_app_install_idAlways present. The connected app install the key is linked to, or null when unlinked. Immutable. Revoking the install or its grant for this key's environment revokes the key.
created_byThe API key or user that created the key, as a resource_type and resource_id. A live key can create a sandbox's test key, so the creator can be in another mode. Absent when the creator is unavailable.
revoked_atWhen the key was revoked. Present only on revoked keys.
last_used_atWhen the key last authenticated a request. It updates at most once a minute.
created_at, updated_atWhen the key was created and last changed.

Timestamps are RFC 3339.

Scopes#

Each key holds scopes such as commerce.orders.read, payments.payment_intents.write, or webhooks.write. Each endpoint checks for the scopes it needs, and a key without them gets 403 INSUFFICIENT_SCOPE. Give each key the fewest scopes its job needs, so a leaked key can do less.

  • A write scope satisfies its own read scope. A key with commerce.orders.write can read and write orders, so it doesn't need commerce.orders.read too.
  • A write scope doesn't cover another resource, and an unqualified scope doesn't cover a qualified one such as commerce.refunds.tax_overrides.write.
  • Some endpoints accept one of several scopes. Reading orders accepts commerce.orders.read or commerce.orders.write. The reference lists each operation's scopes and whether it needs all of them or any one.

A scope failure names the requirement and what's missing:

JSON
{
  "error": {
    "type": "authorization_error",
    "code": "INSUFFICIENT_SCOPE",
    "message": "The API key must include all required scopes: commerce.orders.write.",
    "param": "scope",
    "error_source": "caller",
    "doc_url": "https://developers.withflintpay.com/docs/errors#insufficient_scope",
    "request_id": "req_01KWM63GKKF3Z0ZEXED5ZD807C",
    "remediation": {
      "retry": "none",
      "next_steps": "Create or use an API key with the required scope, then retry the request."
    },
    "details": [
      {
        "code": "INSUFFICIENT_SCOPE",
        "param": "scope",
        "message": "The API key must include all required scopes: commerce.orders.write.",
        "scope_requirement": {
          "mode": "all",
          "scopes": ["commerce.orders.write"]
        },
        "missing_scopes": ["commerce.orders.write"]
      }
    ]
  }
}

In details[0], scope_requirement.mode is all when the endpoint needs every listed scope and any when one is enough. missing_scopes lists the ones your key doesn't satisfy. Add them to the key, or use a key that has them.

API key scope catalogEvery scope, the operations it grants, and which scope each payment route checks.

Key access#

Every key declares access, and creating a key requires it:

accessThe key holdsWhen Flint adds a scope
fullEvery scope full access includes for the key's modeThe key gains it
read_onlyThe read scopes of full access for the key's modeThe key gains new read scopes
restrictedExactly the scopes you listNothing changes

Flint resolves full and read_only keys on each request, so their scopes show what they hold today. A test key never holds a scope that only live keys can have. The scope catalog shows what full and read-only access include in each mode.

A full-access key suits local development or an agent you control. Give a production workload a restricted key with the scopes it needs, because a full key also gains every scope Flint adds later. See Scope keys to the job.

Send scopes only with access restricted, where it's required and must list at least one scope, each once. Keys created before access existed are restricted with the scopes they had.

Credentials that can mint keys#

Creating a key, workload identity, CLI login, or partner app install can grant access that outlasts the current session. A Dashboard or onboarding session needs identity verification within the last 300 seconds to grant full, read_only, or any scope outside this list.

  • commerce.bundles.read
  • commerce.catalog.read
  • commerce.products.read
  • commerce.subscription_plans.read

Among API credentials, only a full-access key can grant full, read_only, or these scopes.

  • accounts.api_keys.write
  • accounts.workload_identities.write
  • commerce.gift_cards.secrets.write
  • commerce.license_keys.secrets.write

A session also needs a role that can manage the merchant's API keys. Without it, the request returns 403 FORBIDDEN with reason merchant_role_insufficient. If the session needs fresh verification, the response returns 403 IDENTITY_VERIFICATION_REQUIRED and reports its last verification in details[0].verified_at. Verify again in the Dashboard or start a new onboarding session, then retry. The response can identify the access field or a scope such as scopes[1] in param.

A test credential can't mint a live key at all: it mints only in its own sandbox. A scope the caller doesn't hold returns 403 INSUFFICIENT_SCOPE with reason scope_not_held, param scopes, and the scopes it lacks in details[0].missing_scopes. So a restricted key that can manage keys can't mint its own replacement with key management: use a full-access key or a freshly verified session. Keys that already hold a step-up scope keep it.

Manage keys over the API#

Listing and retrieving keys needs accounts.api_keys.read or accounts.api_keys.write. Creating, updating, and revoking keys needs accounts.api_keys.write.

  • GET/v1/api-keysRequired API key scopes: accounts.api_keys.read or accounts.api_keys.writeReference for GET /v1/api-keys

    List keys. Filter with status, such as status=active, which leaves out expired and revoked keys. partner_app_install_id is a single-value, exact-match filter for one connected app's linked keys.

  • POST/v1/api-keysRequired API key scope: accounts.api_keys.writeReference for POST /v1/api-keys

    Create a key. Returns secret_key once.

  • GET/v1/api-keys/{api_key_id}Required API key scopes: accounts.api_keys.read or accounts.api_keys.writeReference for GET /v1/api-keys/{api_key_id}

    Retrieve one key. Never returns the secret.

  • PATCH/v1/api-keys/{api_key_id}Required API key scope: accounts.api_keys.writeReference for PATCH /v1/api-keys/{api_key_id}

    Change name, access, scopes, or expires_at.

  • POST/v1/api-keys/{api_key_id}/revokeRequired API key scope: accounts.api_keys.writeReference for POST /v1/api-keys/{api_key_id}/revoke

    Revoke a key permanently.

Three rules decide what a key can manage:

  • A key manages keys in its own mode. A test key sees and edits keys bound to its sandbox, and mints new keys there. A live key sees, edits, and mints live keys. Any other key's ID returns 404 RESOURCE_NOT_FOUND with param api_key_id.
  • sandbox_id picks a test key's sandbox. On POST /v1/api-keys, a live key, a live CLI login, or a Dashboard session sends sandbox_id to mint a test key bound to that sandbox, and omits it for a live key. A test key may send only its own sandbox's ID, and mints there either way; another sandbox's ID returns 404 RESOURCE_NOT_FOUND with param sandbox_id. Dashboard and onboarding sessions can name any of the merchant's active sandboxes, and an onboarding session must send sandbox_id; its first key goes to default_sandbox_id. sandbox_id is always the public sandbox ID.
  • A key grants only scopes it holds. Asking for more returns 403 INSUFFICIENT_SCOPE with reason scope_not_held and the extra scopes in details[0].missing_scopes. A PATCH checks any scopes it adds. Extending a key's expiry checks all its resulting permissions. A Dashboard session must verify again before editing a key with full or read_only access or with restricted scopes outside the read allowlist. See credentials that can mint keys.
  • A key updates or revokes only keys whose scopes it holds. A restricted key can't revoke a key with more scopes than itself; the request returns 403 INSUFFICIENT_SCOPE with reason scope_not_held, naming the scopes it lacks.

Keys for connected apps#

When you give a platform a key, set the optional partner_app_install_id on POST /v1/api-keys. The link can't be added, changed, or removed afterward. Omit it for an unlinked key; null isn't accepted on create.

Only a live credential or a Dashboard session may explicitly set the field. The install must belong to the merchant, be active, and have an active grant for the new key's environment. Each install can have up to 25 active linked keys per environment; exceeding that returns 409 LIMIT_REACHED with reason partner_app_install_links.

Keys and merchant webhook endpoints created by a linked key inherit its install. A linked test key must omit the field and let Flint inherit the link. Revoking the install ends these keys and endpoints too; unlinked resources keep working. Link a key to a connected app lists the grant checks, credential restrictions, and errors. What revoking an install ends covers grant revokes, sandbox changes, and cleanup.

Create a key#

expires_at is optional. Set it for a contractor, a migration script, or a load test, and the key stops authenticating at that time. It must be in the future.

cURL
curl -X POST https://api.withflintpay.com/v1/api-keys \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: ci-runner-key-2027-06" \
  -d '{
    "name": "CI runner",
    "access": "restricted",
    "scopes": ["commerce.orders.read"],
    "expires_at": "2027-06-30T00:00:00Z"
  }'
Response
{
  "data": {
    "api_key_id": "key_01KWK4Q8Z1MB7F0T2S9R3V6HAX",
    "name": "CI runner",
    "key_prefix": "flint_test_9f8e7d6c",
    "secret_key": "flint_test_9f8e7d6c...",
    "merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
    "sandbox_id": "test_01KNB061AGD0CYYF16M5QAQE3N",
    "access": "restricted",
    "scopes": ["commerce.orders.read"],
    "status": "active",
    "partner_app_install_id": null,
    "expires_at": "2027-06-30T00:00:00Z",
    "version": 1,
    "created_by": {
      "resource_type": "api_key",
      "resource_id": "key_01KWJ93G11C7MF8REX91MDS0CD"
    },
    "created_at": "2026-10-28T16:20:00Z",
    "updated_at": "2026-10-28T16:20:00Z"
  },
  "request_id": "req_01KWM6KKK9D0R8JXQJ49YHBJ73"
}

Store secret_key in your secrets manager straight away. Send an Idempotency-Key: if the response is lost, a retry with the same key and body returns the same API key instead of creating a second one, and returns its secret under the one-time secret rules.

A full-access key can create another full-access key with no scope list:

cURL
curl -X POST https://api.withflintpay.com/v1/api-keys \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_FULL_ACCESS_KEY" \
  -d '{
    "name": "Local agent",
    "access": "full"
  }'

Change a key's access or scopes#

PATCH /v1/api-keys/{api_key_id} replaces the key's whole scopes list when you send it with access restricted. Whenever the body includes access or scopes, send the version you read as expected_version, so your change can't undo a permission change someone made after you read the key:

cURL
curl -X PATCH https://api.withflintpay.com/v1/api-keys/key_1kmn0aExample \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "expected_version": 3,
    "access": "restricted",
    "scopes": ["commerce.orders.read"]
  }'

A stale expected_version returns 409 VERSION_CONFLICT with the current version in details[0].current_version, and the key is unchanged. Read the key again, check its scopes, and resend with the new version.

Moving a key from full or read_only to restricted follows only the rules for restricted keys. A rename or an expiry change needs no expected_version. "expires_at": null removes an expiry, and a future expires_at reactivates an expired key. A revoked key can't be updated. Creating and updating keys count against the sensitive_write rate limit, because both can grant access.

Rotate a key#

Rotation is a create and a revoke, with the switchover in between so traffic never stops:

  1. Create a replacement#

    Create a key with the same access and scopes as the one you're replacing.

  2. Deploy it#

    Put the new secret_key in your servers' configuration. last_used_at on the old key stops advancing once nothing sends it.

  3. Revoke the old key#

    Call POST /v1/api-keys/{api_key_id}/revoke with the old key's ID. From then on it returns 401 INVALID_CREDENTIAL with details[0].reason revoked. Revocation is permanent, and it doesn't revoke keys the old key created.

    To keep the old key working through a longer overlap, set its expires_at to a future time with PATCH /v1/api-keys/{api_key_id} instead. It stops authenticating at that time, and a change to expires_at alone needs no expected_version.

Rotate keys without downtime covers draining traffic and rotating keys on a schedule.

Key management errors#

  • HTTP 400
    The body breaks an access rule. Missing access on create: details[0].code REQUIRED, param access. A value other than full, read_only, or restricted: INVALID_VALUE, param access. restricted without scopes: REQUIRED, param scopes. scopes with full or read_only: NOT_ALLOWED, param scopes, with access and scopes in details[0].conflicting_fields. On PATCH, scopes without access: REQUIRED, param access; access or scopes without expected_version: REQUIRED, param expected_version.
  • HTTP 403
    With reason scope_not_granted, the calling credential lacks accounts.api_keys.write. With reason scope_not_held, it tried to grant a scope it doesn't hold, or the key it's changing holds one. details[0].missing_scopes names them, leaving out a read scope when its write is also listed.
  • HTTP 403
    With reason full_access_required, the credential can't grant full, read_only, or the step-up scope named by param. See credentials that can mint keys.
  • HTTP 403
    The session needs fresh verification to grant or edit this access. details[0].verified_at reports the last verification. Verify again, then retry.
  • HTTP 404
    No key with that api_key_id is in the calling key's mode or sandbox.
  • HTTP 409
    The key is revoked. Revoking it again returns reason already_applied. Updating it returns reason terminal_status with current_status revoked: create a new key instead.
  • HTTP 409
    VERSION_CONFLICTRefresh, then retry
    expected_version is stale, or the key changed while the request ran. Read the key and resend with its current version.

Authentication and authorization errors#

A 401 means Flint can't accept the credential. It has type authentication_error and a WWW-Authenticate: Bearer realm="Flint API" header. A 403 means the credential is valid but isn't allowed to make this request. It has type authorization_error. Both have remediation.retry none: fix the key or the request before you send it again.

Response
{
  "error": {
    "type": "authentication_error",
    "code": "INVALID_CREDENTIAL",
    "message": "The API key is not recognized.",
    "error_source": "caller",
    "doc_url": "https://developers.withflintpay.com/docs/errors#invalid_credential",
    "request_id": "req_01KWM6ZP8YBJ1T37P8QYHZNS2E",
    "remediation": {
      "retry": "none",
      "next_steps": "Check the credential for truncation or stray whitespace, or create a new one."
    },
    "details": [
      {
        "code": "INVALID_CREDENTIAL",
        "message": "The API key is not recognized.",
        "reason": "unknown",
        "remediation": {
          "retry": "none",
          "next_steps": "Check the credential for truncation or stray whitespace, or create a new one."
        }
      }
    ]
  }
}
  • HTTP 401
    No credential was sent. Add an Authorization: Bearer header.
  • HTTP 401
    A credential was sent but Flint can't use it. details[0].reason says why, and remediation.next_steps says what to do; see the reasons below.
  • HTTP 403
    The key lacks a required scope. details[0].missing_scopes names it. See Scopes.
  • HTTP 403
    The key is valid but can't make this request, and details[0].reason says why. live_mode_required: the request needs a live key, such as a test key managing sandboxes or partner apps, or setting a merchant field only live mode can change. test_mode_required: the request works only in a sandbox, so send it with a test key bound to that sandbox. Flint checks the mode before scopes, so adding scopes doesn't help.

The INVALID_CREDENTIAL reasons apply to all credential types. When Flint recognizes the type, details[0].auth_type identifies it. A wrong_credential_type detail also lists accepted_auth_types, excluding first-party dashboard sessions. These facts use the extensible credential types in the prefix registry.

details[0].reasonWhat happenedFix
malformedFlint cannot classify the credential: the scheme or token is malformed, the prefix is unknown (including flint_foo_), or an unprefixed token is not a compact JWS with an alg header. Basic auth, other schemes, and a request that also sends X-API-Key, X-Onboarding-Session-Token, or X-Developer-Session-Token land here, with param naming the header.Send the whole key as Authorization: Bearer <key> and remove any other credential header.
unknownThe format identifies a credential type, but no record matches it or its signature is invalid.Check for truncation or stray whitespace, or create a new key.
revokedThe key or grant was revoked, its sandbox was archived, the CLI authorization or context was removed, the partner app token was revoked or the credential, secret, or app that minted it was removed, or the onboarding user's merchant access ended. A partner app whose merchant revoked the install gets 403 FORBIDDEN with reason environment_grant_required instead.Create a new live key, a test key in an active sandbox, or mint a new partner app token.
expiredThe credential is past its expiry, including CLI tokens, partner app tokens, onboarding sessions, and dashboard sessions.Set a later expires_at or create a new key.
mode_mismatchA test key that isn't bound to a sandbox, a live key that is, or a key holding a scope its mode doesn't allow.Create the key from the dashboard or a sandbox with current scopes.
session_endedThe session has ended.Start a new session.
wrong_credential_typeThe endpoint doesn't accept this kind of credential, such as a partner token on an endpoint that takes only API keys.Send one of details[0].accepted_auth_types. A recognized non-bearer secret, such as a refresh token, also returns this reason.

The reason list can grow, so treat a reason you don't recognize like unknown.

An unbound test key is the most common first-run failure. Its remediation says what to do next:

JSON
{
  "error": {
    "type": "authentication_error",
    "code": "INVALID_CREDENTIAL",
    "message": "Test mode API keys must be sandbox-bound before they can authenticate public API requests.",
    "error_source": "caller",
    "doc_url": "https://developers.withflintpay.com/docs/errors#invalid_credential",
    "request_id": "req_01KWM60C6F6CDNQ3KSP5KRBD3V",
    "remediation": {
      "retry": "none",
      "next_steps": "Create a key in the right mode. A test key is bound to one active sandbox, a live key is never bound to a sandbox, and a key holds only scopes its mode allows.",
      "next_actions": [
        {
          "action_type": "issue_developer_sandbox_test_key",
          "reason_code": "SANDBOX_BOUND_TEST_KEY_REQUIRED",
          "reason_message": "Create or use a sandbox-bound test key for the sandbox this request should target.",
          "required_fields": ["sandbox_id"]
        }
      ]
    },
    "details": [
      {
        "code": "INVALID_CREDENTIAL",
        "message": "Test mode API keys must be sandbox-bound before they can authenticate public API requests.",
        "reason": "mode_mismatch"
      }
    ]
  }
}

A request rejected before Flint identifies the key, because the key is missing, malformed, unknown, revoked, or expired, leaves no entry in your request logs, so debug it from the error body. Once Flint identifies the key, the request is logged even when it fails, for example on a missing scope. See Debugging for tracing a request by its ID and Error handling for the full error object.

Keep keys on the server#

Important: Never put a key in client code

Flint has no publishable key. Every flint_ key acts as your merchant with every scope it holds. Treat a key that has shipped in browser JavaScript, a mobile app, or a public repository as leaked, and revoke it.

  • Load keys from environment variables or a secrets manager, not from source.
  • Give each key the fewest scopes it needs, and an expires_at when the job has an end date.
  • If a key leaks, revoke it in the dashboard or over the API first, then deploy a replacement.
  • For local work, flint auth import from the CLI validates a key and stores it in your OS keychain instead of a dotfile.

Key security covers source control, webhook secrets, and what to do when a key leaks.

Other credentials#

API keys are for your server. Other flows use their own credentials, sent the same way, as Authorization: Bearer. Each one acts only where its flow needs it, and every operation's security in the reference lists what it accepts.

CredentialStarts withUse it for
Checkout credentialckat_v1.A checkout your backend runs for one buyer, from checkout_auth_token. See Build your own checkout.
Customer session secretflint_cses_A signed-in buyer's own account calls under /v1/me. See Customer sessions.
CLI access tokenfcat_The Flint CLI after flint login, bound to one approved context. See CLI OAuth.
Workload identity tokenfwat_CI and cloud workloads that exchange an OIDC token instead of storing a key. See Workload identities.
Partner app tokenfpat_A partner app acting for merchants that installed it, in one mode. It names the merchant with Flint-Merchant-Id unless it is bound to one. See Partner app installs.
Onboarding session tokendevsess_v1.Setting up a new account from a script or agent, in its default sandbox. POST /v1/onboarding/verify-email returns it. See API & agent onboarding.

Authorization holds one credential, so a request sends either a checkout credential or your API key, never both. Which environment a credential reaches shows where each one acts.

Credential prefix registry#

The top-level OpenAPI extension x-flint-credential-types publishes a list of {prefix, auth_type, kind} objects. prefix is the literal beginning of the credential; auth_type identifies its class. kind is scoped_key for API keys, scoped_token for delegated CLI, workload and partner access, user_session for signed-in onboarding sessions, buyer for credentials bound to a buyer flow, or non_bearer for secrets that cannot authenticate a request in Authorization.

prefixauth_typekind
flint_live_api_keyscoped_key
flint_test_api_keyscoped_key
fcat_cli_loginscoped_token
fwat_workload_identityscoped_token
fpat_partner_appscoped_token
devsess_v1.onboarding_sessionuser_session
ckat_v1.checkout_sessionbuyer
cklt_v1.checkout_launchbuyer
flint_cses_customer_sessionbuyer
ivt_invoice_accessbuyer
fcrt_cli_refreshnon_bearer
flint_cref_customer_refreshnon_bearer
fcdc_cli_device_codenon_bearer
ckse_v1.checkout_stored_secretnon_bearer
plrc_v1.payment_link_resolutionnon_bearer

A CLI refresh token renews a CLI login. A customer refresh token renews a customer session, and a CLI device code completes device authorization. Stored checkout secrets and payment link resolution tokens belong to their checkout flow. None is an access token. Prefixes identify the type before validation; they do not prove that a credential is authentic or active. A known type on a route that never accepts it returns 401 INVALID_CREDENTIAL with wrong_credential_type. An accepted type in the wrong mode returns 403 FORBIDDEN with live_mode_required or test_mode_required.

Workload identities#

If your CI runner or cloud workload can get an OIDC token, exchange it for a short-lived Flint token instead of storing a Flint key. A workload identity (wid_...) names the issuer, audience, subject, and claim conditions Flint accepts, and the scopes the token gets. Each identity belongs to one environment: live, or one sandbox.

  1. Create the identity with a credential that holds accounts.workload_identities.write. API key management scopes don't cover workload identities.
  2. In the workload, send the issuer's token and the workload_identity_id to POST /v1/oauth/token with grant_type=urn:ietf:params:oauth:grant-type:token-exchange.
  3. Send the returned fwat_ token as Authorization: Bearer. It lasts at most one hour, and never longer than the OIDC token you exchanged. Deactivating, archiving, or narrowing the identity takes effect on the next request.

On GitHub Actions, the setup-flint action does steps 2 and 3 for you; see Run in CI. The CLI and SDKs also exchange the token themselves when FLINT_WORKLOAD_IDENTITY_ID is set. Workload identities has a recipe for each platform.

Workload identity token exchange has the request and response. OAuth clients can find the token endpoint, supported grants, and Flint's public signing keys without a credential; see OAuth discovery and signing keys.

Next steps#

Accept your first paymentTake a test payment with the key you just verified.Sandboxes & test modeCreate sandboxes for local work, CI, and QA, and reset their data.Going liveSwap your test key for a live key when you ship.Key securityRotation, secret hygiene, and what to do when a key leaks.

Was this helpful?