Skip to content

API keys

Each Flint endpoint that an API key calls checks for the scopes it needs, and a key that lacks them gets 403 INSUFFICIENT_SCOPE. Give each key only the scopes its job calls, so a leaked key can do less. Every operation in the API reference lists the scopes it accepts, and the scope catalog describes every scope you can grant.

To send a key, choose between test and live keys, or create keys over the API, see Authentication. For expiry, rotation, and leak response, see Key security.

Listing, reading, updating, and revoking keys use the caller's environment. Dashboard sessions in live mode manage only live keys; in test mode, they manage only keys in the selected sandbox. Reading, updating, or revoking a key outside that environment returns 404 RESOURCE_NOT_FOUND. Creating a key can still name another sandbox with sandbox_id when the caller is a Dashboard session or live credential.

An onboarding session with a role that manages API keys can create and revoke external keys without a connected app link in any of its merchant's active sandboxes. Send the session to POST /v1/api-keys/{api_key_id}/revoke to revoke a sandbox key.

Find the user accountable for a key#

created_by_user_id is the user accountable for this key: the user who created it, or who created the API key or workload identity that did. created_by names the credential that made the request. created_by_user_id is absent when the root creator isn't a user.

For example, if a user creates a key and that key creates another key, both keys have the same created_by_user_id. The second key's created_by points to the first key.

On each request, Flint checks whether the accountable user's current role can grant the key's access. If the user loses that permission or loses access to the merchant, requests with the key return 401 INVALID_CREDENTIAL. This applies to live and test keys, including keys created by the user's other credentials.

GET /v1/api-keys?created_by_user_id=usr_... lists keys accountable to that exact user, including keys their credentials created. This single-value filter combines with other filters and the caller's environment. A malformed or repeated ID returns 400 INVALID_REQUEST; a valid unknown ID returns an empty list. Keep the filter unchanged when following next_page_token.

Use created_by_type and created_by_id to filter by the credential that made the request. For example, created_by_type=user&created_by_id=usr_... returns only keys that user created directly.

When signed in to the Dashboard as a Developer, you can update or revoke a restricted key if you are its accountable user and your current role can grant its scopes. A merchant Owner or Admin can update or revoke any key in the selected environment.

When you give a platform an API key, set partner_app_install_id on POST /v1/api-keys to bind the key's lifetime to that app's install. The field is optional on create and immutable afterward. Every key resource, including create responses and list items, includes partner_app_install_id: the install's pinst_... ID when linked, or null when unlinked. Omit the create field for an unlinked key; sending null returns 400 INVALID_REQUEST with detail INVALID_VALUE.

Only a live credential or a Dashboard session can explicitly set the field. The install must belong to your merchant, be active, and have an active grant for the key's target environment: the live grant for a live key, or the test grant bound to the same sandbox for a test key. An explicit field from a test credential returns 403 FORBIDDEN with reason live_mode_required before Flint reads the install.

Each install can have up to 25 active linked API keys per environment, separately from its limit of 25 linked webhook endpoints. Another key returns 409 LIMIT_REACHED with reason partner_app_install_links, param partner_app_install_id, and limit 25. Revoke an unused linked key before creating another.

Keys and merchant webhook endpoints created by a linked key inherit its install link, including when the caller is a linked test key. A live linked key can omit the field or repeat its own install ID; naming another install returns 400 INVALID_REQUEST with detail NOT_ALLOWED. A linked test key must omit the field and let Flint inherit it. The target environment still needs the install's active grant.

A linked key can't create access that would outlive its install. These operations return 403 FORBIDDEN with reason linked_key_not_allowed, before making changes:

  • Create a workload identity, change its subject, claim conditions or scopes, or reactivate it.
  • Create a delivery rate callback.
  • Create a sandbox with issue_test_key: true.
  • Register partner app client credentials or rotate a partner app's client secret.
  • Create a customer access link.
  • Regenerate an invoice public link.
  • Copy webhook endpoints, including catalog or sandbox copies with clone_webhooks: true.

Workload identity name changes, deactivation, and archive remain available. Short-lived customer sessions, checkout credentials, and merchant account sessions remain available within the key's scopes. Linking doesn't grant additional scopes or change which keys the caller can manage.

Invoice creation, issuance, scheduling, and reads remain available. After revoke, a platform can still open public pages for invoices it issued until they are paid, voided, or their public links are regenerated.

Find and end linked access#

GET /v1/api-keys?partner_app_install_id=pinst_... is a single-value, exact-match filter. It combines with the other filters and the caller's mode: live credentials list live keys, and test credentials list keys in their own sandbox. A malformed ID returns 400 INVALID_REQUEST; a well-formed unknown ID returns an empty list. Keep the filter unchanged when following next_page_token.

Revoking the install revokes its linked keys in every environment. Revoking one environment grant revokes the keys linked in that environment. A revoked key returns 401 INVALID_CREDENTIAL with reason revoked. Moving the test grant to another sandbox during code exchange or archiving its sandbox also ends the old sandbox's links. Resetting the sandbox keeps the links. Reinstalling the app never restores revoked keys or deleted endpoints; create new ones after the install is active again.

Unlinked keys keep working until separately revoked or expired. Sending partner_app_install_id on PATCH /v1/api-keys/{api_key_id} returns 400 INVALID_REQUEST with detail UNKNOWN_FIELD; an existing key can't be linked or unlinked. What revoking an install ends covers endpoints and the revoke response too.

ResponseMeaning
404 RESOURCE_NOT_FOUNDThe create field names an unknown install or one belonging to another merchant. param is partner_app_install_id.
409 ACTION_NOT_ALLOWED, reason terminal_statusThe install is revoked.
409 ACTION_NOT_ALLOWED, reason status_not_reachedThe install is still pending_exchange. Exchange its authorization code first.
409 ACTION_NOT_ALLOWED, reason environment_not_grantedThe install has no active grant for the target environment. Authorize the app there before creating the key.

Pick a key's scopes#

A key's access decides where its scopes come from:

accessThe key holds
restrictedExactly the scopes you list. Flint never adds more.
fullEvery scope the catalog allows for the key's mode, including scopes Flint adds later.
read_onlyEvery .read scope that full access includes, including read scopes Flint adds later.

Give production services restricted keys. For each operation the service calls, grant a scope the reference lists for it. A write scope already covers its read scope, so a service that reads and writes orders needs only commerce.orders.write.

JobScopes
A checkout backend that creates checkout sessions, reads orders, and issues refundscheckouts.checkout_sessions.write, commerce.orders.read, commerce.refunds.write
A reconciliation worker that reads payouts and balance transactionsmoney_movement.payouts.read, money_movement.balance_transactions.read
A warehouse app that records stock changes and receives returnscommerce.inventory.write, commerce.returns.operations.write
A register that looks up and redeems gift cardscommerce.gift_cards.redemptions.write
A service that lists event tickets and looks them up by admission codecommerce.tickets.read
A point-of-sale server that registers readers and opens Tap to Pay connection sessionspayments.readers.write

Key access covers who can grant full and read_only.

Scope catalog#

Scope names follow <area>[.<qualifier>].<read|write>, such as commerce.orders.read or commerce.returns.policies.write. A qualifier splits off a permission inside its area that deserves separate trust, such as changing return policies or overriding refund tax.

  • Key modes says whether live keys, test keys, or both can hold the scope. A few scopes, such as developer.partner_apps.write, are live only. developer.sandboxes.write is in both modes, but a test key uses it only on its own sandbox. Asking for one on a test key returns 400 INVALID_REQUEST, and the error detail names the scope and its allowed_key_modes.
  • Full access and Read only list the modes in which a full or read_only key holds the scope. Full access holds every scope its mode allows. Read-only access holds the .read scopes among them.
  • Partner installs says whether a partner app can request the scope for its installs. A scope is available to installs only when a route that accepts partner app tokens requires it.

The table is generated from the catalog that validates API keys and fills the dashboard's scope pickers. OpenAPI publishes the same catalog as the root x-flint-scopes list, where each scope's implied_by names the other scopes that satisfy it.

Credentials and API keys

ScopePermissionKey modesFull accessRead onlyPartner installs
accounts.api_keys.readRead API keys.live, testlive, testlive, testNot allowed
accounts.api_keys.writeManage API keys.live, testlive, testNot includedNot allowed
accounts.workload_identities.readRead workload identities and their API keys.live, testlive, testlive, testNot allowed
accounts.workload_identities.writeManage workload identities and their API keys.live, testlive, testNot includedNot allowed

Developer tools

ScopePermissionKey modesFull accessRead onlyPartner installs
developer.partner_apps.readRead partner apps.liveliveliveNot allowed
developer.partner_apps.writeManage partner apps.liveliveNot includedNot allowed
developer.sandboxes.readRead sandboxes.live, testlive, testlive, testNot allowed
developer.sandboxes.writeManage sandboxes.live, testlive, testNot includedNot allowed
developer.test_clocks.readRead sandbox test clocks. Grantable on live keys so a live key can grant it to the sandbox keys it mints. Test clock routes refuse live credentials.live, testlive, testlive, testNot allowed
developer.test_clocks.writeManage sandbox test clocks. Grantable on live keys so a live key can grant it to the sandbox keys it mints. Test clock routes refuse live credentials.live, testlive, testNot includedNot allowed
developer.merchant_signups.readRead merchant signups your partner apps started, including their owners' names and emails. Live keys only.liveliveliveNot allowed
developer.merchant_signups.writeStart, verify, resend, cancel, and rotate the codes of merchant signups for your partner apps. Live keys only.liveliveNot includedNot allowed

Merchant account

ScopePermissionKey modesFull accessRead onlyPartner installs
merchants.profile.readRead the merchant profile.live, testlive, testlive, testAllowed
merchants.profile.writeManage the merchant profile.live, testlive, testNot includedAllowed
merchants.onboarding.readRead merchant onboarding information.live, testlive, testlive, testAllowed
merchants.account_sessions.writeCreate merchant account sessions.live, testlive, testNot includedAllowed
merchants.onboarding.writeManage merchant onboarding information.live, testlive, testNot includedAllowed
merchants.locations.readRead merchant locations.live, testlive, testlive, testAllowed
merchants.locations.writeManage merchant locations.live, testlive, testNot includedAllowed
merchant_billing.readRead merchant billing information.live, testlive, testlive, testNot allowed

Developer and account

ScopePermissionKey modesFull accessRead onlyPartner installs
settings.readRead settings.live, testlive, testlive, testAllowed
settings.writeManage settings.live, testlive, testNot includedAllowed
accounts.devices.readRead devices.live, testlive, testlive, testNot allowed
accounts.devices.writeManage devices.live, testlive, testNot includedNot allowed
analytics.readRead analytics.live, testlive, testlive, testAllowed
webhooks.readRead webhook endpoints and deliveries.live, testlive, testlive, testAllowed
webhooks.writeManage webhook endpoints and deliveries.live, testlive, testNot includedNot allowed
developer.request_logs.self.readRead request summaries and detail for the calling credential.live, testlive, testlive, testNot allowed
developer.resource_timelines.readRead resource timelines with the read scope for each requested resource.live, testlive, testlive, testNot allowed
developer.request_logs.readRead request summaries and detail for every caller in the current environment.live, testlive, testlive, testNot allowed

Customers

ScopePermissionKey modesFull accessRead onlyPartner installs
customers.readRead customers.live, testlive, testlive, testAllowed
customers.writeManage customers.live, testlive, testNot includedAllowed
customers.sessions.writeCreate and revoke customer sessions.live, testlive, testNot includedNot allowed

Commerce

ScopePermissionKey modesFull accessRead onlyPartner installs
commerce.products.readRead products.live, testlive, testlive, testAllowed
commerce.products.writeManage products.live, testlive, testNot includedAllowed
commerce.orders.readRead orders.live, testlive, testlive, testAllowed
commerce.orders.writeManage orders.live, testlive, testNot includedAllowed
commerce.refunds.readRead refunds.live, testlive, testlive, testAllowed
commerce.refunds.writeManage refunds.live, testlive, testNot includedAllowed
commerce.subscription_plans.readRead subscription plans.live, testlive, testlive, testAllowed
commerce.subscription_plans.writeManage subscription plans.live, testlive, testNot includedAllowed
commerce.subscriptions.readRead subscriptions.live, testlive, testlive, testAllowed
commerce.subscriptions.writeManage subscriptions.live, testlive, testNot includedAllowed
commerce.invoices.readRead invoices.live, testlive, testlive, testAllowed
commerce.invoices.writeManage invoices.live, testlive, testNot includedAllowed
commerce.bundles.readRead bundles.live, testlive, testlive, testAllowed
commerce.bundles.writeManage bundles.live, testlive, testNot includedAllowed
commerce.catalog.readRead catalog objects.live, testlive, testlive, testAllowed
commerce.catalog.writeManage catalog objects.live, testlive, testNot includedAllowed
commerce.refunds.tax_overrides.writeOverride tax amounts and tax treatment when creating refunds.live, testlive, testNot includedNot allowed
commerce.promotions.readRead promotions.live, testlive, testlive, testAllowed
commerce.promotions.writeManage promotions.live, testlive, testNot includedAllowed
commerce.inventory.readRead inventory stock, movements, and reservations.live, testlive, testlive, testAllowed
commerce.inventory.writeManage inventory stock, movements, and reservations.live, testlive, testNot includedAllowed
commerce.inventory.policies.writeManage inventory allocation policies.live, testlive, testNot includedAllowed
commerce.inventory.allocation.writeChange whether a merchant location accepts inventory allocation.live, testlive, testNot includedAllowed
commerce.returns.readRead returns.live, testlive, testlive, testAllowed
commerce.returns.writeManage returns.live, testlive, testNot includedAllowed
commerce.returns.operations.writeRecord return receipts, inspections, and dispositions.live, testlive, testNot includedAllowed
commerce.returns.resolutions.writeManage return resolutions.live, testlive, testNot includedAllowed
commerce.returns.policies.writeManage return policies.live, testlive, testNot includedAllowed
commerce.returns.reasons.writeManage return reasons.live, testlive, testNot includedAllowed
commerce.delivery.readRead delivery configuration and fulfillment options.live, testlive, testlive, testAllowed
commerce.delivery.writeManage delivery configuration and fulfillment options.live, testlive, testNot includedAllowed
commerce.credit_notes.readRead credit notes.live, testlive, testlive, testAllowed
commerce.credit_notes.writeManage credit notes.live, testlive, testNot includedAllowed
commerce.gift_cards.readRead gift cards and their ledger.live, testlive, testlive, testAllowed
commerce.gift_cards.writeIssue, update, freeze, unfreeze, and close gift cards, and add funded value.live, testlive, testNot includedAllowed
commerce.gift_cards.redemptions.writeRedeem gift cards and refund gift card redemptions.live, testlive, testNot includedAllowed
commerce.gift_cards.adjustments.writeAdjust gift card balances and cash out gift cards.live, testlive, testNot includedAllowed
commerce.gift_cards.secrets.writeAccess gift card codes and deliver gift cards to recipients.live, testlive, testNot includedAllowed
commerce.tickets.readRead event tickets and look up admissions.live, testlive, testlive, testAllowed
commerce.tickets.writeManage event ticket admissions without refund authority.live, testlive, testNot includedNot allowed
commerce.license_keys.readRead masked license keys and pools, and look up licenses by key.live, testlive, testlive, testAllowed
commerce.license_keys.writeManage issued license keys and license key pools.live, testlive, testNot includedAllowed
commerce.license_keys.secrets.writeReveal and replace full license keys.live, testlive, testNot includedNot allowed

Payments

ScopePermissionKey modesFull accessRead onlyPartner installs
checkouts.checkout_sessions.readRead checkout sessions.live, testlive, testlive, testAllowed
checkouts.checkout_sessions.writeManage checkout sessions.live, testlive, testNot includedAllowed
payments.payment_intents.readRead payment intents.live, testlive, testlive, testAllowed
payments.payment_intents.writeManage payment intents.live, testlive, testNot includedAllowed
payments.payment_methods.readRead payment methods.live, testlive, testlive, testAllowed
payments.payment_methods.writeManage payment methods.live, testlive, testNot includedAllowed
checkouts.payment_links.readRead payment links.live, testlive, testlive, testAllowed
checkouts.payment_links.writeManage payment links.live, testlive, testNot includedAllowed
payments.disputes.readRead disputes.live, testlive, testlive, testAllowed
payments.disputes.writeManage disputes.live, testlive, testNot includedAllowed
payments.payment_method_domains.readRead payment method domains.live, testlive, testlive, testNot allowed
payments.payment_method_domains.writeManage payment method domains.live, testlive, testNot includedNot allowed
payments.readers.readView card readers and Tap to Pay phones.live, testlive, testlive, testAllowed
payments.readers.writeRegister card readers and Tap to Pay phones and take payments on them.live, testlive, testNot includedAllowed
checkouts.shops.readRead shops.live, testlive, testlive, testAllowed
checkouts.shops.writeManage shops.live, testlive, testNot includedAllowed

Risk

ScopePermissionKey modesFull accessRead onlyPartner installs
risk.readRead risk data.live, testlive, testlive, testAllowed
risk.reviews.writeManage risk reviews.live, testlive, testNot includedAllowed
risk.controls.writeManage risk controls.live, testlive, testNot includedAllowed

Money movement

ScopePermissionKey modesFull accessRead onlyPartner installs
money_movement.balances.readRead balances.live, testlive, testlive, testAllowed
money_movement.balance_transactions.readRead balance transactions.live, testlive, testlive, testAllowed
money_movement.payouts.readRead payouts.live, testlive, testlive, testAllowed
money_movement.payouts.writeManage payouts.live, testlive, testNot includedNot allowed
money_movement.payout_settings.readRead payout settings.live, testlive, testlive, testAllowed
money_movement.payout_settings.writeManage payout settings.live, testlive, testNot includedNot allowed
reports.readRead reports.live, testlive, testlive, testNot allowed
reports.writeManage reports.live, testlive, testNot includedNot allowed
money_movement.platform_fees.readRead platform fees, platform fee balances, and their ledger for partner apps you own.live, testlive, testlive, testNot allowed
money_movement.payment_splits.readRead payment splits you collected or received, including reversals.live, testlive, testlive, testNot allowed

How Flint checks scopes#

Each operation requires either all of its listed scopes or any one of them. Read operations list the read scope together with every scope that satisfies it, so GET /v1/orders accepts commerce.orders.read or commerce.orders.write.

Write scopes cover their reads#

<area>.write satisfies <area>.read. A key with commerce.orders.write can call every route that requires commerce.orders.read. A write scope never covers another area: commerce.orders.write doesn't read refunds or payment intents.

A qualified scope is a separate grant, and the unqualified write scope doesn't include it. commerce.refunds.write can't override refund tax, and commerce.returns.write can't record receipts or confirm resolutions. Some qualified write scopes also satisfy their area's read scope, and the rest satisfy nothing beyond themselves:

Qualified scopeAlso satisfies
commerce.gift_cards.redemptions.write, commerce.gift_cards.adjustments.write, commerce.gift_cards.secrets.writecommerce.gift_cards.read
commerce.returns.operations.write, commerce.returns.resolutions.write, commerce.returns.policies.write, commerce.returns.reasons.writecommerce.returns.read
risk.reviews.write, risk.controls.writerisk.read
commerce.inventory.policies.write, commerce.inventory.allocation.writeNothing. Add commerce.inventory.read to read stock.
commerce.refunds.tax_overrides.writeNothing. Add commerce.refunds.write to create the refund.
customers.sessions.writeNothing. Add customers.read to read customers.

Requests that need several scopes#

A few operations combine several permissions and need every scope they list:

  • POST/v1/returns/{return_id}/processRequired API key scopes: commerce.returns.operations.write, commerce.returns.resolutions.write and commerce.returns.writeReference for POST /v1/returns/{return_id}/process

    Records decisions, receipts, inspections, and resolutions for a return in one request.

Fields that need an extra scope#

Creating a refund with refund_type: credit_note needs commerce.credit_notes.write as well as commerce.refunds.write.

Some requests need another scope only when you send a particular field or value. Without it, the request returns 403 INSUFFICIENT_SCOPE naming the extra scope. A refund that overrides refund tax, for example, needs commerce.refunds.tax_overrides.write as well as commerce.refunds.write.

RequestExtra scopeWhen
GET /v1/api-request-logsdeveloper.request_logs.readWhen filtering by caller_type, caller_id, partner_app_id, or customer_id.
GET /v1/files/{file_id}commerce.products.readFor product and product_variant files. Fields: file_id.
GET /v1/files/{file_id}commerce.bundles.readFor bundle files. Fields: file_id.
GET /v1/files/{file_id}checkouts.payment_links.readFor payment_link files. Fields: file_id.
GET /v1/files/{file_id}commerce.subscription_plans.readFor subscription_plan files. Fields: file_id.
GET /v1/files/{file_id}merchants.profile.readFor merchant_logo and merchant_icon files. Fields: file_id.
POST /v1/locationscommerce.inventory.allocation.writeWhen setting inventory_allocation_enabled.
PATCH /v1/locations/{location_id}commerce.inventory.allocation.writeWhen setting inventory_allocation_enabled.
POST /v1/merchant-account-session-refreshespayments.payment_intents.read and payments.disputes.writeWhen the launch token's components include payments. Fields: launch_token.
POST /v1/merchant-account-sessionspayments.payment_intents.read and payments.disputes.writeWhen components includes payments.
POST /v1/orderscommerce.delivery.writeWhen delivery is present.
PATCH /v1/orders/{order_id}commerce.delivery.writeWhen delivery is present, including null.
POST /v1/orders/{order_id}/paypayments.payment_methods.writeWhen an API key or partner token sends save_payment_method: true.
POST /v1/orders/{order_id}/paypayments.readers.writeWhen a payment source or selection has credential_type reader. Fields: payment_source.credential_type, payment_intents[].payment_source.credential_type.
POST /v1/payment-intents/{payment_intent_id}/confirmpayments.payment_methods.writeWhen save_payment_method is true.
POST /v1/payment-intents/{payment_intent_id}/confirmpayments.readers.writeWhen payment_source.credential_type is reader.
POST /v1/refundscommerce.credit_notes.writeFor refund_type credit_note. Fields: credit_note_id.
POST /v1/refundscommerce.refunds.tax_overrides.writeWhen providing tax overrides. Fields: tax_breakdown_refunds, line_items[].tax_refund_mode, line_items[].tax_money, line_items[].tax_breakdown_refunds, line_items[].tax_adjustment_reason, line_items[].tax_adjustment_audit.
POST /v1/sandboxesaccounts.api_keys.writeWhen issue_test_key is true.
POST /v1/subscriptions/{subscription_id}/access-linkscommerce.subscriptions.writeWhen purpose is subscription_manage.

The table is generated from x-flint-conditional-scopes in OpenAPI, and each operation's entry below shows its own extra scopes.

When a restricted key creates a webhook endpoint, changes its subscriptions or delivery URL, or activates it, webhooks.write must be paired with read access for each subscribed event resource. For example, subscribing to order.paid requires commerce.orders.read or commerce.orders.write. A wildcard requires read access for every event resource. See Webhooks.

Payment routes check the route, not the payment#

The route you call decides the scope, not whether the payment intent belongs to an order. Routes under /v1/payment-intents check the payments scopes for every payment intent, and routes under /v1/orders check the order scopes. A key with only commerce.orders.write can pay an order but can't create, capture, or cancel its payment intents. A key with only payments.payment_intents.write can create, capture, or cancel any payment intent. Send order_id when creating an order-owned payment intent; paying the order still requires commerce.orders.write.

Check which scopes a key holds#

GET /v1/auth-context returns non-secret metadata for the credential that sent the request, including its granted scopes. It needs no scope, so any valid key can call it, which makes it a quick deploy check that a service runs with the key you expect:

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_01KWK4Q8Z1MB7F0T2S9R3V6HAX",
    "name": "Checkout backend",
    "merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
    "organization_id": "org_01KEZF7C00MTFBRRKJA6QQX04J",
    "mode": "test",
    "access": "restricted",
    "sandbox_id": "test_01KNB061AGD0CYYF16M5QAQE3N",
    "scopes": [
      "checkouts.checkout_sessions.write",
      "commerce.orders.read",
      "commerce.refunds.write"
    ]
  },
  "request_id": "req_01KWM6SZJQGQWNFPTAF5HE7MHH"
}

For full and read_only keys, Flint resolves scopes on each request, so scopes shows what the key holds today. An API key also returns access, nullable partner_app_install_id, and expires_at when it has one. CLI logins, workload identities, partner apps, and onboarding sessions have their own auth_type shapes; onboarding sessions report role capabilities instead of scopes. Scoped tokens identify themselves differently; see CLI OAuth and workload identity tokens.

Change a key's scopes#

PATCH /v1/api-keys/{api_key_id} with access restricted replaces the key's whole scopes list. Every key returns a version that increases each time the key is updated or revoked. Send it as expected_version whenever the body includes access or scopes, so your change can't undo one someone made after you read the key. POST /v1/api-keys/{api_key_id}/revoke accepts an optional expected_version too.

A stale expected_version returns 409 VERSION_CONFLICT with the current version in details[0].current_version, and the key keeps its scopes. Read the key again, compare its scopes with the ones you meant to set, and resend with the new version. Change a key's access or scopes has a full example, and Key management errors lists the rules for access and scopes in the body.

A key can grant only scopes it holds, and can change or revoke only keys whose scopes it holds, so no key can raise its own permissions.

Scope errors#

  • HTTP 403
    The key lacks a scope the operation, or a field you sent, requires. In details[0], scope_requirement.mode is all or any, scope_requirement.scopes lists the requirement, and missing_scopes lists what the key doesn't satisfy. Add those scopes to the key, or use a key that has them. Creating or changing a key returns it too when the calling key lacks a scope it tried to grant.
  • HTTP 403
    The key's mode can't make the request. Reason live_mode_required needs a live key, and test_mode_required needs a test key bound to the sandbox. Scopes can't change a key's mode, so send the request with a key in the mode it needs.
  • HTTP 400
    A scope in a create or update request is unknown, listed twice, or not allowed for the key's mode. The error detail's param points at the scope, and an unknown name comes with close matches in suggestions.

Authentication and authorization errors shows a full INSUFFICIENT_SCOPE response and every 401.

A recognized credential on an endpoint that does not accept its type returns 401 INVALID_CREDENTIAL with reason wrong_credential_type, auth_type, and accepted_auth_types in details[0]. A token Flint cannot classify returns malformed. Expired tokens report expired; revoked grants and sessions whose access was withdrawn report revoked. See the credential reasons.

The API key object#

A credential used to authenticate API requests.

Returned by GET /v1/api-keys/{api_key_id} and carried by the endpoints below.

Attributes

accessenumRequired

Key access. Full and read_only resolve from the current scope catalog for the key's mode; restricted holds only its listed scopes. Granting full or read_only requires a freshly verified authorized user session, or a full-access API key in the key's mode or a live full-access key granting a test key.

  • full
  • read_only
  • restricted
api_key_idstringRequired

Unique identifier for this api key, prefixed `key_`.

created_atstringRequired

RFC3339 timestamp.

created_byobject

Who created this key: the API key or workload identity whose credential made the request, or else the user, including through the Dashboard, a CLI login, or an onboarding session. An API key creator can belong to another mode, such as a live key that creates a sandbox key. Keys a workload token created before Flint recorded workload identity creators name the user who set up that workload identity. Filter the list with `created_by_type` and `created_by_id`. Absent when the creator is unavailable.

created_by_user_idstring

The user accountable for this key: the user who created it, or who created the API key or workload identity that did. `created_by` names the credential that made the request.

expires_atstring

RFC3339 timestamp.

key_prefixstringRequired

The start of the secret key: its `flint_` mode prefix and the first 8 characters of the random part. It identifies the key in a list without revealing the secret, which only the create response returns.

last_used_atstring

RFC3339 timestamp.

merchant_idstringRequired

ID of the merchant this resource belongs to.

namestringRequired

The label the key was given, 1 to 100 characters.

partner_app_install_idstring or nullRequired

The connected app install this key is linked to. The key is revoked when that install is revoked or loses its grant for this key's environment. Null when the key is unlinked. Never changes.

revoked_atstring

When this key was revoked, in RFC 3339 format. Present only for revoked keys. For keys revoked before revocation timestamps were recorded, this is the last update time.

sandbox_idstring

ID of the sandbox this resource belongs to.

scopesarray of enumRequired

The scopes the key holds now. For full and read_only keys this list grows when Flint adds scopes.

  • accounts.api_keys.read
  • accounts.api_keys.write
  • accounts.devices.read
  • accounts.devices.write
  • accounts.workload_identities.read
  • accounts.workload_identities.write
  • analytics.read
  • checkouts.checkout_sessions.read
  • checkouts.checkout_sessions.write
  • checkouts.payment_links.read
  • checkouts.payment_links.write
  • checkouts.shops.read
  • checkouts.shops.write
  • commerce.bundles.read
  • commerce.bundles.write
  • commerce.catalog.read
  • commerce.catalog.write
  • commerce.credit_notes.read
  • commerce.credit_notes.write
  • commerce.delivery.read
  • commerce.delivery.write
  • commerce.gift_cards.adjustments.write
  • commerce.gift_cards.read
  • commerce.gift_cards.redemptions.write
  • commerce.gift_cards.secrets.write
  • commerce.gift_cards.write
  • commerce.inventory.allocation.write
  • commerce.inventory.policies.write
  • commerce.inventory.read
  • commerce.inventory.write
  • commerce.invoices.read
  • commerce.invoices.write
  • commerce.license_keys.read
  • commerce.license_keys.secrets.write
  • commerce.license_keys.write
  • commerce.orders.read
  • commerce.orders.write
  • commerce.products.read
  • commerce.products.write
  • commerce.promotions.read
  • commerce.promotions.write
  • commerce.refunds.read
  • commerce.refunds.tax_overrides.write
  • commerce.refunds.write
  • commerce.returns.operations.write
  • commerce.returns.policies.write
  • commerce.returns.read
  • commerce.returns.reasons.write
  • commerce.returns.resolutions.write
  • commerce.returns.write
  • commerce.subscription_plans.read
  • commerce.subscription_plans.write
  • commerce.subscriptions.read
  • commerce.subscriptions.write
  • commerce.tickets.read
  • commerce.tickets.write
  • customers.read
  • customers.sessions.write
  • customers.write
  • developer.merchant_signups.read
  • developer.merchant_signups.write
  • developer.partner_apps.read
  • developer.partner_apps.write
  • developer.request_logs.read
  • developer.request_logs.self.read
  • developer.resource_timelines.read
  • developer.sandboxes.read
  • developer.sandboxes.write
  • developer.test_clocks.read
  • developer.test_clocks.write
  • merchant_billing.read
  • merchants.account_sessions.write
  • merchants.locations.read
  • merchants.locations.write
  • merchants.onboarding.read
  • merchants.onboarding.write
  • merchants.profile.read
  • merchants.profile.write
  • money_movement.balance_transactions.read
  • money_movement.balances.read
  • money_movement.payment_splits.read
  • money_movement.payout_settings.read
  • money_movement.payout_settings.write
  • money_movement.payouts.read
  • money_movement.payouts.write
  • money_movement.platform_fees.read
  • payments.disputes.read
  • payments.disputes.write
  • payments.payment_intents.read
  • payments.payment_intents.write
  • payments.payment_method_domains.read
  • payments.payment_method_domains.write
  • payments.payment_methods.read
  • payments.payment_methods.write
  • payments.readers.read
  • payments.readers.write
  • reports.read
  • reports.write
  • risk.controls.write
  • risk.read
  • risk.reviews.write
  • settings.read
  • settings.write
  • webhooks.read
  • webhooks.write
statusenumRequired

Current key status. A non-revoked key is expired when expires_at is at or before the current time; otherwise it is active. Revoked keys remain revoked regardless of expires_at.

  • active
  • expired
  • revoked
supported_actionsarray of enumRequired

Lifecycle actions Flint accepts now. Active and expired keys can be revoked; revoked keys accept none.

  • revoke
updated_atstringRequired

RFC3339 timestamp.

versionintegerRequired

Current version of this resource's owned state. Send it as `expected_version` when changing the resource to reject a stale write.

JSON
{
  "access": "restricted",
  "api_key_id": "key_01KEZF7C007F5ZGD2ZXDWJGD76",
  "created_at": "2026-03-17T14:30:00Z",
  "created_by": {
    "resource_id": "usr_01K0P7W6A4N9F3J2T8Q5R1C6XM",
    "resource_type": "user"
  },
  "expires_at": "2027-03-17T14:30:00Z",
  "key_prefix": "example",
  "last_used_at": "2026-03-17T15:00:00Z",
  "merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
  "name": "Sandbox orders integration",
  "partner_app_install_id": null,
  "sandbox_id": "test_01KEZF7C00EWKVN1WYFT3YJSS5",
  "scopes": [
    "accounts.api_keys.read",
    "accounts.api_keys.write",
    "commerce.orders.read",
    "commerce.orders.write"
  ],
  "status": "active",
  "supported_actions": [
    "revoke"
  ],
  "updated_at": "2026-03-17T14:30:00Z",
  "version": 1
}

List API keys#

GET/v1/api-keys

Requires scope accounts.api_keys.read or accounts.api_keys.write

Rate limit: read

Returns merchant-bound external API key metadata. Live callers list only live keys; test callers list only keys in their selected sandbox. Dashboard sessions use the mode and sandbox selected by the request. Internal keys, demo-session keys, and secrets are never returned. Default order: created_at descending, then api_key_id descending.

Query parameters

partner_app_install_idstring

Exact-match filter on partner_app_install_id.

statusarray of enum

Optional API key status filter. Active keys have no expiration or a future expires_at. Expired keys are not revoked and have expires_at at or before the current time. Values are trimmed and deduplicated in first-seen order; empty or unknown entries are rejected. Values within this filter are ORed; separate filters are ANDed.

  • active
  • expired
  • revoked
created_by_typearray of enum

Filter by created_by.resource_type. A user filter matches keys a user created directly, not keys their other keys created. Values are trimmed and deduplicated in first-seen order; empty or unknown entries are rejected. Values within this filter are ORed; separate filters are ANDed.

  • api_key
  • user
  • workload_identity
created_by_idstring

Filter by created_by.resource_id. The ID prefix (key_, usr_, or wid_) sets the creator type, so created_by_type is optional; when sent, it must be that one type.

created_by_user_idstring

Filter by the exact ID of the user accountable for the key, including keys their API keys or workload identities created. Combines with created_by_type and created_by_id.

page_sizeinteger

Maximum number of results to return, from 1 to 100. Defaults to 20.

page_tokenstring

Opaque, signed next_page_token from the previous response, bound to the list and caller. Omit on the first request. You may change `page_size` between pages. Reuse it with the same endpoint, filters, sort, and request context. Do not parse or construct tokens. An altered, invalid, expired, or mismatched token returns a validation error.

sort_byenum

Field to sort by. Defaults to created_at; ties are broken by api_key_id.

  • created_at
  • last_used_at
  • name
sort_directionenum

Sort direction. Defaults to desc.

  • asc
  • desc
created_afterstring

Inclusive lower bound on created_at.

created_beforestring

Exclusive upper bound on created_at.

updated_afterstring

Inclusive lower bound on updated_at.

updated_beforestring

Exclusive upper bound on updated_at.

Response · 200

A page of API key metadata.

dataarray of objectRequired

Resource, collection, or operation result returned by this request.

metaobject

Additional information about this response.

next_page_tokenstring

Opaque token to send as `page_token` to retrieve the next page. Omitted when there is no next page.

request_idstringRequired

Identifier of this API request, used to correlate logs and support requests.

curl https://api.withflintpay.com/v1/api-keys \
  -H "Flint-Version: 2026-09-07" \
  -H "Authorization: Bearer YOUR_API_KEY"

A page of API key metadata.

JSON
{
  "data": [
    {
      "access": "restricted",
      "api_key_id": "key_01KEZF7C007F5ZGD2ZXDWJGD76",
      "created_at": "2026-03-17T14:30:00Z",
      "created_by": {
        "resource_id": "usr_01K0P7W6A4N9F3J2T8Q5R1C6XM",
        "resource_type": "user"
      },
      "expires_at": "2027-03-17T14:30:00Z",
      "key_prefix": "example",
      "last_used_at": "2026-03-17T15:00:00Z",
      "merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
      "name": "Sandbox orders integration",
      "partner_app_install_id": null,
      "sandbox_id": "test_01KEZF7C00EWKVN1WYFT3YJSS5",
      "scopes": [
        "accounts.api_keys.read",
        "accounts.api_keys.write",
        "commerce.orders.read",
        "commerce.orders.write"
      ],
      "status": "active",
      "supported_actions": [
        "revoke"
      ],
      "updated_at": "2026-03-17T14:30:00Z",
      "version": 1
    }
  ],
  "meta": {
    "api_version": "2026-09-07"
  },
  "next_page_token": "example",
  "request_id": "req_01KWM6PD3JGCHCDXQ93W96GT2V"
}

Create an API key#

POST/v1/api-keysIdempotent

Requires scope accounts.api_keys.write

Rate limit: sensitive_write

Creates a merchant-bound external API key. A live credential creates a live key, or a test key bound to the sandbox named by sandbox_id. A sandbox-bound credential, such as a test key, creates test keys in its own sandbox only. An onboarding session creates its merchant's first keys here, in its default sandbox. secret_key is returned only in the initial successful response and accepted idempotent replays of the same create request.

Request body

Send exactly one of these

The `full` variant of `CreateAPIKeyRequest`.

accessenumRequired

Key access. Full and read_only resolve from the current scope catalog for the key's mode; restricted holds only its listed scopes. Granting full or read_only requires a freshly verified authorized user session, or a full-access API key in the key's mode or a live full-access key granting a test key.

  • full
expires_atstring

RFC3339 timestamp.

namestringRequired

A label that helps you tell keys apart, 1 to 100 characters. Surrounding whitespace is trimmed before length validation. A supplied value cannot be blank; use null where clearing is supported.

partner_app_install_idstring

Links this key to a connected app's install. Revoking the install or its grant for this key's environment revokes the key. The install must be active and authorized for that environment. Set only at creation; it never changes. Omit for an unlinked key. Keys created by a linked key inherit its link. Each install can have up to 25 linked keys that have not been revoked per environment.

sandbox_idstring

Public ID of the sandbox the new test key is bound to. A live credential or a user session sends it to create a test key in that sandbox, and omits it for a live key. A sandbox-bound credential, such as a test key, may name only its own sandbox and gets a test key there either way; any other sandbox returns 404. A Dashboard or onboarding session may name any of the merchant's active sandboxes, and an onboarding session must send it: its first key goes to default_sandbox_id. Storage generation IDs are never accepted.

Response · 201

The created external API key and one-time secret.

dataobjectRequired

Resource, collection, or operation result returned by this request.

metaobject

Additional information about this response.

request_idstringRequired

Identifier of this API request, used to correlate logs and support requests.

curl -X POST https://api.withflintpay.com/v1/api-keys \
  -H "Flint-Version: 2026-09-07" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: a-unique-key" \
  -d '{
    "access": "restricted",
    "expires_at": "2027-03-17T14:30:00Z",
    "name": "Sandbox orders integration",
    "scopes": [
      "accounts.api_keys.read",
      "commerce.orders.read",
      "commerce.orders.write"
    ]
  }'

Get an API key#

GET/v1/api-keys/{api_key_id}

Requires scope accounts.api_keys.read or accounts.api_keys.write

Rate limit: read

Returns external API key metadata. Secrets, internal keys, and demo-session keys are not returned. Dashboard sessions can manage only live keys in live mode or keys in the selected sandbox in test mode. A key outside that environment returns 404 RESOURCE_NOT_FOUND.

Path parameters

api_key_idstringRequired

Flint API key ID. Must be a valid ID with prefix key_. Malformed IDs return 400 INVALID_REQUEST with detail INVALID_VALUE; well-formed IDs that do not exist return 404 RESOURCE_NOT_FOUND.

Response · 200

The requested API key metadata.

dataobjectRequired

Resource, collection, or operation result returned by this request.

metaobject

Additional information about this response.

request_idstringRequired

Identifier of this API request, used to correlate logs and support requests.

curl https://api.withflintpay.com/v1/api-keys/key_01KEZF7C008CTC2G5V6J08M6S7 \
  -H "Flint-Version: 2026-09-07" \
  -H "Authorization: Bearer YOUR_API_KEY"

The requested API key metadata.

JSON
{
  "data": {
    "access": "restricted",
    "api_key_id": "key_01KEZF7C007F5ZGD2ZXDWJGD76",
    "created_at": "2026-03-17T14:30:00Z",
    "created_by": {
      "resource_id": "usr_01K0P7W6A4N9F3J2T8Q5R1C6XM",
      "resource_type": "user"
    },
    "expires_at": "2027-03-17T14:30:00Z",
    "key_prefix": "example",
    "last_used_at": "2026-03-17T15:00:00Z",
    "merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
    "name": "Sandbox orders integration",
    "partner_app_install_id": null,
    "sandbox_id": "test_01KEZF7C00EWKVN1WYFT3YJSS5",
    "scopes": [
      "accounts.api_keys.read",
      "accounts.api_keys.write",
      "commerce.orders.read",
      "commerce.orders.write"
    ],
    "status": "active",
    "supported_actions": [
      "revoke"
    ],
    "updated_at": "2026-03-17T14:30:00Z",
    "version": 1
  },
  "meta": {
    "api_version": "2026-09-07"
  },
  "request_id": "req_01KWM6PPKZFMV6QYJMRKT8A6D7"
}

Update an API key#

PATCH/v1/api-keys/{api_key_id}Idempotent

Requires scope accounts.api_keys.write

Rate limit: sensitive_write

Updates an API key's name, access, scopes, or expires_at. Expired keys can be updated, and a future expires_at reactivates one. A revoked key can't be updated. An API key caller may grant only scopes it holds and can manage only keys whose scopes it holds. Dashboard sessions can manage only live keys in live mode or keys in the selected sandbox in test mode. A key outside that environment returns 404 RESOURCE_NOT_FOUND.

Path parameters

api_key_idstringRequired

Flint API key ID. Must be a valid ID with prefix key_. Malformed IDs return 400 INVALID_REQUEST with detail INVALID_VALUE; well-formed IDs that do not exist return 404 RESOURCE_NOT_FOUND.

Request body

Send exactly one of these

accessenumRequired

Key access. Full and read_only resolve from the current scope catalog for the key's mode; restricted holds only its listed scopes. Granting full or read_only requires a freshly verified authorized user session, or a full-access API key in the key's mode or a live full-access key granting a test key.

  • full
expected_versioninteger

Resource version last read by the caller. Required when access or scopes is present. Optional for scalar updates.

expires_atstring or null

Future RFC3339 timestamp. Send null to clear an existing API-key expiration.

namestring

A label that helps you tell keys apart, 1 to 100 characters. Omit to keep the current name; `null` is rejected. Surrounding whitespace is trimmed before length validation. A supplied value cannot be blank; use null where clearing is supported.

Response · 200

The updated API key metadata.

Same response as Get an API key.

curl -X PATCH https://api.withflintpay.com/v1/api-keys/key_01KEZF7C008CTC2G5V6J08M6S7 \
  -H "Flint-Version: 2026-09-07" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: a-unique-key" \
  -d '{
    "access": "restricted",
    "expected_version": 1,
    "expires_at": "2027-06-17T14:30:00Z",
    "name": "Sandbox orders readonly",
    "scopes": [
      "accounts.api_keys.read",
      "commerce.orders.read"
    ]
  }'

Revoke an API key#

POST/v1/api-keys/{api_key_id}/revokeIdempotent

Requires scope accounts.api_keys.write

Rate limit: sensitive_write

Permanently revokes an external API key and returns metadata with status revoked. A CLI login with accounts.api_keys.write can revoke a key in its own merchant and environment context even when the key holds broader scopes. API keys and workload credentials must also hold the target key's scopes. Dashboard sessions can manage only live keys in live mode or keys in the selected sandbox in test mode. A key outside that environment returns 404 RESOURCE_NOT_FOUND. An onboarding session with permission to manage API keys can revoke unlinked external keys in any active sandbox of its merchant.

Path parameters

api_key_idstringRequired

Flint API key ID. Must be a valid ID with prefix key_. Malformed IDs return 400 INVALID_REQUEST with detail INVALID_VALUE; well-formed IDs that do not exist return 404 RESOURCE_NOT_FOUND.

Request body

expected_versioninteger

Version last read from the resource returned in `data` (the primary resource for a result object). The write fails with `VERSION_CONFLICT` if it has changed. Requiredness depends on the operation and fields being changed.

Response · 200

The revoked API key metadata.

Same response as Get an API key.

curl -X POST https://api.withflintpay.com/v1/api-keys/key_01KEZF7C008CTC2G5V6J08M6S7/revoke \
  -H "Flint-Version: 2026-09-07" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: a-unique-key" \
  -d '{
    "expected_version": 1
  }'

Get the current authentication context#

GET/v1/auth-context

Requires an API key. No scope needed.

Rate limit: read

Returns non-secret metadata for the credential that sent the request, as one object per credential type selected by auth_type. API keys, CLI logins, workload identities, partner apps, and onboarding sessions are accepted. No scope is required.

Response · 200

The calling credential and its current access

dataone ofRequired

Resource, collection, or operation result returned by this request.

metaobject

Additional information about this response.

request_idstringRequired

Identifier of this API request, used to correlate logs and support requests.

curl https://api.withflintpay.com/v1/auth-context \
  -H "Flint-Version: 2026-09-07" \
  -H "Authorization: Bearer YOUR_API_KEY"

The calling credential and its current access

JSON
{
  "data": {
    "access": "restricted",
    "api_key_id": "key_01KEZF7C00Q6S9W2D8HF4YBN3T",
    "auth_type": "api_key",
    "merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
    "mode": "test",
    "name": "Backend integration",
    "partner_app_install_id": null,
    "sandbox_id": "test_01KEZF7C00JVWYYN2SBWFFSA36",
    "scopes": [
      "commerce.orders.read"
    ]
  },
  "meta": {
    "api_version": "2026-09-07"
  },
  "request_id": "req_01KWM6WAHG3N9Q8T2V5XRZ7C4D"
}

Was this helpful?