API & agent onboarding
Use these APIs when your product or agent creates a Flint account itself, before anyone opens the Flint dashboard, or when you embed merchant onboarding in your own product. The work has two parts:
- Signup. Three calls take an email address to a merchant, a user, and a sandbox-bound
flint_test_...key. - Onboarding. Your backend reads the merchant's onboarding state, submits what it knows, and hands identity and business verification to the account owner in an embedded component you host. You repeat the same loop when the payment processor asks for more information later.
Identity, business verification, documents, payout details, processor authentication, and agreement acceptance always happen in the embedded component, in front of the account owner. Your backend never sends them to Flint.
A merchant you onboard pays Flint's processing fees directly. To take part of a merchant's payments, install a partner app and charge a platform fee.
If your product is a platform that creates a merchant for each of its customers, use a merchant signup instead of the three signup calls below. The owner types one emailed code into your form, Flint creates the merchant and installs your app, and your partner app token runs the onboarding loop in this guide. No sandbox key or live credential changes hands. Build payments into your platform follows the whole flow.
If you can use the dashboard, you don't need signup: create a test key on the API keys page and start with Accept your first payment. From a terminal, flint login signs in to an existing account and flint signup runs signup for you; see Sign in in the CLI guide.
- Your backend sends POST /v1/onboarding/start with the owner's email to Flint
- Flint sends verification code by email to Account owner
- Account owner sends the code to Your backend
- Your backend sends POST /v1/onboarding/verify-email to Flint
- Flint returns onboarding_session_token to Your backend
- Your backend sends POST /v1/api-keys with default_sandbox_id to Flint
- Flint returns flint_test_... secret key to Your backend
- Your backend sends read state, then POST /v1/onboarding/advance to Flint
- Your backend sends POST /v1/merchant-account-sessions to Flint
- Your backend sends mount Account Onboarding to Account owner
- Account owner sends completes verification in the component to Flint
- Your backend sends read state until there's nothing left to do to Flint
All requests go to https://api.withflintpay.com, in test and live. The credential you send selects the environment.
Sign up#
Signup verifies the owner's email, so an agent can finish it only if it can read that mailbox or a person passes it the code. From a terminal, flint signup runs the same calls; an agent runs it in two steps, flint signup --email EMAIL --first-name FIRST --last-name LAST --credential-store file --no-input, then flint signup --verification-code CODE --credential-store file --no-input. The file store works on headless machines and saves the key with owner-only permissions. Omit --credential-store file to use your OS keychain. The CLI never prints the key.
The key works for ordinary sandbox development right away. Flint verifies the test account behind each sandbox itself, with test data, so the default sandbox can take test card payments shortly after the merchant is created. While automatic preparation is queued or running, readiness reports pending with status_reason: provisioning and empty next_actions on the affected axes and capabilities. Flint owns this work; read readiness again shortly. The verify-email response describes this same default sandbox. Until preparation finishes, readiness.payments.status on GET /v1/merchant is pending; Testing shows the check. Creating the key doesn't depend on onboarding either: you can create it while the merchant still has verification to complete.
The test key can read the shared merchant profile. It cannot change any field through PATCH /v1/merchant, including email, metadata, logo, or icon: those writes require a live-mode credential or a Dashboard session. For sandbox onboarding prefill, send profile to POST /v1/onboarding/advance; those values stay in the selected sandbox.
Before sharing a checkout URL, review the merchant’s business_name and set the name buyers should see. Use PATCH /v1/merchant with a live credential, or edit the business name in the Dashboard. Signup can suggest a name from a work email domain or use the person’s name for a shared mailbox.
Take a test payment#
Once you hold the key, check it with a payment. A full-access key holds commerce.orders.read and commerce.orders.write, so it can create an order, pay it with the pm_card_visa test token, and read it back, using curl alone. Pay from your server has the three requests. They run again in the same sandbox with new idempotency keys.
Verification codes and limits#
- Each verification token allows five incorrect codes. A wrong code returns
400 INVALID_REQUESTwith detail codeINVALID_VALUEandparam: "verification_code"; send the right code with the same token. - After the fifth incorrect code, every attempt with that token returns
409 LIMIT_REACHEDwithdetails[0].reason: "verification_attempts", even with the right code. Flint checks the token's state and attempt limit before it compares the code. - Correct codes never count against the limit, including a retry with
merchant_idor a retry after a server error. - Success from
POST /v1/onboarding/startmeans the verification email was accepted for asynchronous delivery; it does not confirm delivery. If the email has not arrived, wait briefly and check spam. To get a new token and code, start again with a newIdempotency-Key, respecting anyRetry-Afterdelay. Use only the newest token and code. A replay with the same key returns the original response and does not resend the email. - After 20 incorrect codes for one email within an hour, start and verify both return
429 RATE_LIMIT_EXCEEDEDfor that email. Wait for theRetry-Afterdelay.
Start, verify, and key issuance also have tight per-IP and per-email throttles; see setup and onboarding throttles. Run signup once per merchant and store the key. A pipeline that signs up on every run hits these throttles.
Signup errors#
Onboard the merchant#
Onboarding is a state machine. Your backend reads the state, does what next_step says, and reads the state again, until status is complete. The same loop runs for every environment, and the credential decides which account it reaches. No onboarding or account-session request takes a sandbox_id.
| Credential | Reaches |
|---|---|
| Onboarding session token | The merchant's default sandbox. Never the live account. |
Sandbox key (flint_test_...) | Its own sandbox. Never the live account. |
Live key (flint_live_...) | The live account. |
Live CLI login (flint login --live) | The live account. |
API keys and CLI logins need merchants.onboarding.read or merchants.onboarding.write to read state, merchants.onboarding.write to advance, and merchants.account_sessions.write to create and refresh account sessions. To work in a sandbox other than the default, send a key for that sandbox. Which environment a credential reaches covers every credential type.
The live account is where the owner completes real verification; see Onboard the live account. Flint verifies the default sandbox's test account itself, so it has little or nothing for the owner to complete. To build and test your embedded UI against requirements that are due, create a sandbox with initial_onboarding: "not_started" and run this loop with a key for it. When Account Onboarding asks for details there, enter the sandbox verification values.
Read the state#
curl https://api.withflintpay.com/v1/onboarding/state \
-H "Authorization: Bearer $ONBOARDING_SESSION_TOKEN"
{
"data": {
"merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
"default_sandbox_id": "test_01KEZF7C00EWKVN1WYFT3YJSS5",
"status": "needs_input",
"country": "US",
"next_step": {
"action_type": "advance_onboarding",
"owner": "integrator"
},
"profile": {
"email": "jane@your-business.example"
}
},
"request_id": "req_01KWM6FP8GGHAF5CSF8XWYHEDH"
}
status summarizes the workflow. Flint checks the values in this order, so a pending review is never hidden behind another step:
status on onboarding statenext_step is the single next action, as a readiness action with action_type, owner, and, when they apply, required_fields and merchant_account_session. It's absent when there's nothing to do. Act on action_type:
action_type | What to do |
|---|---|
advance_onboarding | Submit account intent to POST /v1/onboarding/advance, including any fields named in required_fields. |
create_merchant_account_session | Send merchant_account_session as the body of POST /v1/merchant-account-sessions and hand the step to the owner. |
wait_for_review | Read the state again later. |
other, or a value you don't recognize | New action types can appear. Read the state again later, and show the merchant a generic "setup in progress" message meanwhile. |
owner says who acts: integrator for a call your backend makes, or flint while Flint or the payment processor reviews. A step the account holder completes in the embedded component, create_merchant_account_session, is integrator, because your backend creates the session.
Onboarding state describes setup. Whether the merchant can take payments and receive payouts right now is in readiness on GET /v1/merchant, which the onboarding session token can read too.
Submit account intent#
When next_step.action_type is advance_onboarding, send the fields listed in required_fields. You can also send the capabilities and contact details you want Flint to use.
curl -X POST https://api.withflintpay.com/v1/onboarding/advance \
-H "Authorization: Bearer $ONBOARDING_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: onboarding-advance-jane-1" \
-d '{
"country": "US",
"requested_capabilities": [
"accept_card_payments",
"receive_payouts"
],
"profile": {
"website_url": "https://your-business.example",
"support_email": "help@your-business.example",
"support_phone": "+12125550123"
}
}'
{
"data": {
"merchant_id": "mer_01KEZF7C00MPP0T9S0KH5BB4CC",
"default_sandbox_id": "test_01KEZF7C00EWKVN1WYFT3YJSS5",
"status": "needs_external_action",
"next_step": {
"action_type": "create_merchant_account_session",
"owner": "integrator",
"merchant_account_session": {
"components": ["account_onboarding"],
"collection_strategy": "incremental",
"future_requirements": "omit"
}
},
"country": "US",
"requested_capabilities": [
"accept_card_payments",
"receive_payouts"
],
"profile": {
"email": "jane@your-business.example",
"website_url": "https://your-business.example",
"support_email": "help@your-business.example",
"support_phone": "+12125550123"
}
},
"request_id": "req_01KWM6JDM9XGSQZEBG71A0DVYX"
}
The response is the new onboarding state, so you can act on its next_step without another read.
countryis the business's country as an uppercase ISO 3166-1 alpha-2 code. Onboarding supportsUS. Sendcountrywhenrequired_fieldslists it. If the state already includescountry, Flint can use that value when you omit it.requested_capabilitiesis the exact capability set. It must includeaccept_card_paymentsandreceive_payouts, and can addaccept_ach_debit_paymentsfor ACH debit. Omit the field for cards and payouts.profiletakeswebsite_url,support_email,support_phone,support_url, andemail.required_fieldslists paths in the action’s target request body:profile.website_url,profile.support_email,profile.support_phone, andprofile.support_url. Send these fields insideprofile; top-level inputs such ascountry,requested_capabilities, and the API key’snamestay bare. Sendnullto clear a field. Use the business's real, publicly reachable website: the payment processor reviews it, so reserved example domains such asyour-business.exampledon't pass.
Country and capabilities are fixed once account setup starts. Sending the same values again is safe. Different values return 409 ACTION_NOT_ALLOWED with reason field_locked, and Flint never creates a replacement account.
If advance fails with a network error, a timeout, or a 5xx, send the same request with the same Idempotency-Key. Flint resumes the account setup that request started, so a retry finishes it or creates the account once, never twice. Keep the same merchant and onboarding session.
Don't send legal entity details, identity fields, documents, bank details, processor tokens, or agreement acceptance to advance. Those belong in the embedded component, and advance rejects unknown fields.
Hand verification to the account owner#
When next_step.action_type is create_merchant_account_session, send its merchant_account_session exactly as the request body. Create the session only from your backend, after you have authenticated the person in your product and confirmed they're allowed to manage this merchant:
curl -X POST https://api.withflintpay.com/v1/merchant-account-sessions \
-H "Authorization: Bearer $ONBOARDING_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: account-session-jane-1" \
-d '{
"components": ["account_onboarding"],
"collection_strategy": "incremental",
"future_requirements": "omit"
}'
{
"data": {
"components": ["account_onboarding"],
"effective_policy": {
"collection_strategy": "incremental",
"future_requirements": "omit",
"targeting": "all"
},
"launch_token": "aslaunch_v1.example",
"launch_token_expires_at": "2026-10-28T14:35:00Z",
"client_session": {
"expires_at": "2026-10-28T14:05:00Z",
"stripe": {
"publishable_key": "pk_test_example",
"account_session": {
"stripe_js_call": "load_connect_and_initialize",
"client_secret": "acct_session_secret_example"
},
"components": [
{
"component": "account_onboarding",
"collection_options": {
"fields": "currently_due",
"future_requirements": "omit"
}
}
]
}
}
},
"request_id": "req_01KWM6K7MY5GPZG3NAT0FV4QZF"
}
The session opens in the environment of the credential you send. Return the client secret only to the authenticated person's browser. Never expose a Flint key, accept a merchant ID from the browser as authorization, or put the client secret or launch_token in a link.
In the browser, call Connect.js loadConnectAndInitialize with publishableKey from client_session.stripe.publishable_key and a fetchClientSecret callback that returns client_session.stripe.account_session.client_secret. Mount each entry in client_session.stripe.components, and pass its collection_options to setCollectionOptions unchanged, mapping future_requirements to futureRequirements.
When the client secret expires while the component is open, Connect.js calls fetchClientSecret again. Your browser asks your backend, and your backend sends the newest launch_token to POST /v1/merchant-account-session-refreshes with a new Idempotency-Key. Refresh with the credential that created the launch token; for an onboarding session, that's a session for the same user. After the launch token expires, authorize the person again and create a new session.
If your product doesn't embed Connect.js, send the owner to onboarding that Flint hosts. POST /v1/onboarding/access-links takes the same credentials as a session, plus a required return_url, and returns a url to redirect the owner to. The link opens once, within 5 minutes, into a browser session of up to an hour. Flint's page shows the business name, opens Account Onboarding and Notification Banner in the credential's mode, and offers one action when the owner exits or finishes: back to return_url. The url is a bearer credential, so create it only for a person you just authenticated, redirect them at once, and never email or log it. Onboarding access links has the request, the return_url rules, and the errors. After the owner returns, read the state again, as after an embedded session.
Merchant Account Sessions has the full Connect.js recipes for vanilla JavaScript and React, refresh and retry rules, Content Security Policy and popup requirements, and other components. A partner app install with merchants.account_sessions.write can create and refresh sessions too: in test mode, and in live mode once Flint approves the app as a platform. See Onboard an installed merchant.
After the owner exits#
The component's onExit callback means only that the owner left Account Onboarding. It doesn't mean they submitted everything or that the merchant is ready. Read the state right away, then again after 2, 4, 8, and 15 seconds, and then every 30 seconds for up to 15 minutes.
- While
statusiswaiting_for_review, keep waiting. Review is asynchronous, so don't create another session. - When
next_stepasks for an action, do it: anotheradvance_onboarding, or a newcreate_merchant_account_sessionif the owner left before finishing. - Stop when
statusiscomplete, or when a request returns an error thatremediation.retrysays not to retry.
Subscribe to merchant.readiness_updated to hear about changes after you stop polling. Deliveries can repeat, and the payload is the merchant at the time of the event, so treat the event as a prompt to read GET /v1/merchant and the onboarding state again.
Onboarding errors#
Onboard the live account#
Live onboarding needs a live credential approved by a person who manages the merchant's API keys or partner apps. The business doesn't need to be verified first: this loop is how the credential drives verification. Use one of:
- A live CLI login. Run
flint login --live, orflint login --live --no-waitfrom an agent, and have that person approve live access in the browser. Add any onboarding or account-session scope the login lacks with--scope, for example--scope merchants.onboarding.write --scope merchants.account_sessions.write. Thenflint onboarding state getandflint onboarding advance --input request.jsonreach the live account. A login lasts at most 90 days and can be revoked, and there's no key to store. See Sign in in the CLI guide. - A live key for a backend, with the onboarding and account-session scopes above. Create it on the dashboard's API keys page, or with
flint api-keys createfrom a live CLI login that holdsaccounts.api_keys.write. - A live partner app install, only while the app's
merchant_onboardingplatform capability is active. Until then, a partner app token runs onboarding in test mode and reads it in live mode, and a merchant that installed the app itself uses one of the credentials above. A merchant the app created with a merchant signup uses this one: the signup gives the platform no live key or login. See Onboard an installed merchant.
Send the same state, advance, and account-session requests with the live credential. The onboarding session token and sandbox keys can't reach the live account.
A live key can take live card payments as soon as the processor turns them on, when accept_card_payments is ready in readiness.capabilities. Payouts can turn on later, once the processor confirms the bank account. Going live covers the rest of launch.
Handle later requirements#
The payment processor can ask for more information after onboarding, for example when volume grows or a detail needs updating. The same loop handles it. After merchant.readiness_updated, read GET /v1/merchant:
readiness.requirementslists what's due, as Flint requirement codes such asbusiness_website. New codes can appear; treat a code you don't recognize asadditional_account_information.- A
create_merchant_account_sessionaction inreadiness.payments.next_actionsorreadiness.payouts.next_actionscarries the session body to send. readiness.requirements.upcoming_duelists what the payment processor starts requiring onupcoming_due_at. Nothing is affected before that date, so warn the account owner and let them submit early: send the recommended session body, which setsfuture_requirementstoincludewhileupcoming_dueisn't empty.
Use a live credential for the live account; a sandbox key rehearses the same flow in its sandbox. When the action's merchant_account_session includes targeted_requirements, copy them exactly, so the component asks only for those:
curl -X POST https://api.withflintpay.com/v1/merchant-account-sessions \
-H "Authorization: Bearer $FLINT_LIVE_SECRET_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: remediation-business-website-1" \
-d '{
"components": ["account_onboarding"],
"collection_strategy": "incremental",
"future_requirements": "omit",
"targeted_requirements": ["business_website"]
}'
An unknown code in targeted_requirements returns 400 INVALID_REQUEST with an INVALID_VALUE detail at the array item, such as targeted_requirements[0]. A published code Flint can't map safely returns 400 INVALID_REQUEST with an INVALID_VALUE detail on targeted_requirements and one detail per unmappable item. Neither returns a client secret. Don't catch the error and retry with untargeted collection; read readiness again and present the action it returns.
Account session responses don't include a requirements snapshot. After the owner exits, read GET /v1/merchant for the current readiness.requirements and next actions.
Emails the payment processor sends about compliance, risk, payouts, payments, the account, or documents link to Flint's own sign-in, not to your product, so the account owner keeps a Flint login even when the rest of your integration is headless. Don't intercept or rewrite those links. See Headless applications and provider emails.
For a merchant your app created with a merchant signup, some of these lead to your app instead: Flint's emails about finishing verification and the processor's notification link go to your merchant_action_url. The rest still need the owner's Flint login. Emails that lead to your app lists both.
Checklist for agents#
- Start signup with the owner's email, and get the code from the owner or the mailbox.
- Verify the code and keep the onboarding session token on your backend.
- Before
fresh_verification_expires_at, create a full-access sandbox key withPOST /v1/api-keys, sendingdefault_sandbox_idassandbox_id, and store it. Don't wait for verification. - Use the sandbox key for ordinary
/v1/...work in its sandbox, starting with a test payment. - Read the onboarding state. For
advance_onboarding, submit the inputs inrequired_fields. - For
create_merchant_account_session, hand the embedded step to the authenticated account owner, then poll the state after they exit. Wait while review is pending. - For the live account, get a live CLI login or live key and run the same loop with it.
- After launch, act on
merchant.readiness_updatedby readingGET /v1/merchantand following its next actions.
Next steps#
Merchant Account SessionsGoing liveSandboxes & test mode- Onboarding API reference
- CLI:
flint signupruns signup from a terminal or an agent - Authentication
- Testing