STACK
MENU
DOCS / API REFERENCE / PARTNER API

Partner API

A vetted platform partner opens STACK accounts for its customers through the API. There is no consent screen, no checkout and nothing for the customer to do. The partner pays from its wallet and is STACK's customer. Being a partner is free: it needs no plan of its own. The account holds the partner's own reference for the customer, not the customer's email, so STACK holds no personal data about the end customer until the account is released to them.

The /v1/partner/* endpoints require a partner operator API key. STACK staff mark your account as a partner. Non-partner keys get 403. The full contract, with schemas and a conformance suite, is the Partner API specification, listed under Standards and protocols.

The life of an account: you open it, you may invite the customer to see it, and you may release it. A release mails the customer a link. They claim the account by starting the platform trial with a card and passing the sanctions check. Only then does the account move to them and your access end. If the claim does not complete, nothing moves. A person who already has a STACK account of their own is never touched: you open a separate account for them.

You are responsible for checking your own users until an account is released. STACK checks the partner at its own checkout, and checks the customer when they claim.

Open an Account

POST /v1/partner/accounts

Open an account for a customer. The body is { "external_ref": "<your id for the customer>" }, 1 to 256 characters, unique per partner. It is the idempotency key: repeating the call returns the account that exists. The account is an isolated child operator with its own audit chain, signing key, agents, passports and webhooks. It has no human user. Its own platform plan is taken from your wallet: the first month when it opens (a wallet that cannot cover it returns 402 INSUFFICIENT_BALANCE and no account is opened). Hosted controls are off unless the body also has "controls": true, which switches them on as the account opens and takes their first month from your wallet with the plan's: a wallet that cannot cover both opens nothing.

bash
curl -X POST https://api.getstack.run/v1/partner/accounts \
  -H "Authorization: Bearer $STACK_PARTNER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "external_ref": "cus_your_id" }'
json
{
  "account_id": "op_...",
  "external_ref": "cus_your_id",
  "billing": "partner",
  "status": "active",
  "created": true,
  "created_at": "2026-10-25T09:00:00.000Z",
  "api_key": "sk_live_..."
}

api_key is returned exactly once, on the call that opened the account (201). A repeat returns 200 with created: false and no key. If the key is lost, replace it with rotate-key. Keep it on your server, never in a browser or an agent.

  • A body with tier returns 400 TENANT_TIER_NOT_ALLOWED: the partner does not choose an account's plan.
  • A reference that belongs to a closed account returns 409 CONFLICT: a closed account's reference is not reused.
  • Opening an account past your deal's account limit returns 409 TENANT_LIMIT_REACHED.

Each account is billed exactly as a customer's account is, with your prepaid wallet paying. It has its own platform plan (renewed on its own monthly anniversary from your wallet; a renewal the wallet cannot pay pauses that account until a top-up covers it, and you are warned three days before), its own free amounts and its own action bands, those of the standard plan and not your tier or your deal's figures. Every metered call (actions, including proxy calls and inbound-webhook receives; email; SMS; L3 classifications) counts against the account's own allowance, and usage past it is charged to your wallet at the normal prices. STACK staff set your deal's limits. wallet (default) bills the accounts as above; block is a hard cap shared by the whole pool, refused with 402 ALLOWANCE_EXHAUSTED, and the accounts are then not charged per account.

Read Accounts

GET /v1/partner/accounts, GET /v1/partner/accounts/:account_id

List your accounts, or read one. ?external_ref= returns only the account under that reference. Each view carries account_id, external_ref, billing: "partner", status, timestamps, invite: { status } (none, invited or active: never the address) and usage: { period, actions }, the account's own metered actions this UTC month, and plan (monthly_cents, status active or paused, renews_on and its controls). You never read an account's audit content, intent bodies or security events. An account that has been claimed is no longer yours: it returns 404.

POST /v1/partner/accounts/:account_id/rotate-key

Replace the account's key. The old key stops working at once and the new one is shown once. It needs your own API key as an owner or administrator, and refuses OAuth sessions.

DELETE /v1/partner/accounts/:account_id

Close an account. Its key stops working, and its inbound webhooks and passports are revoked. The cascade runs on every call, so a retried DELETE finishes a cascade that failed part-way. transitioned is false when the account was already closed.

json
{ "transitioned": true, "webhooks_revoked": 2, "passports_revoked": 5 }

Invite the Customer

POST /v1/partner/accounts/:account_id/invite

Invite the customer to see the account. The body takes the customer's email and an optional name. STACK mails the invitation and returns 201 with { "status": "invited", "expires_at": "..." }, never the address or the token. The invited customer signs in and sees the account, its agents and the record of what they did, read-only. They change nothing, connect nothing and spend nothing, and they may ask to leave. The address is stored as the invited person's own, and is the only personal data STACK holds before a release.

bash
curl -X POST https://api.getstack.run/v1/partner/accounts/op_.../invite \
  -H "Authorization: Bearer $STACK_PARTNER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "email": "customer@example.com" }'

An invitation to your own address or to a *.stack-tenant.local address returns 403. Invitations and releases together are limited to 60 per hour per partner; over that returns 429 RATE_LIMITED. If the mail cannot be delivered the call returns 503 and nothing is stored.

Release an Account

POST /v1/partner/accounts/:account_id/release

Mail the customer a claim link. The optional body { "email" } names where it goes; without it the link goes to the one customer you invited. With neither, or with more than one invited, the call returns 400 RELEASE_EMAIL_REQUIRED and nothing is sent. It returns 202 with the release record. The link works for 7 days. A repeat within ten minutes returns the pending release and sends nothing again.

json
{
  "release": {
    "account_id": "op_...",
    "external_ref": "cus_your_id",
    "status": "pending",
    "requested_by": "partner",
    "requested_at": "2026-10-25T09:00:00.000Z",
    "expires_at": "2026-11-01T09:00:00.000Z",
    "completed_at": null
  }
}

What the customer does

The customer opens the link and starts the platform trial with a card, through the same checkout every customer uses. The checkout is fixed to the address the link went to. The cardholder's name and billing country are checked against the sanctions lists. Only when the checkout is complete and the check clears does the account move.

What moves, and what ends

  • The account becomes the customer's own top-level account on their address and their own subscription. Its id, agents, record and audit chain stay.
  • At the same moment your access and billing end: the account key stops working, the people you invited are removed, its passports are revoked, its inbound webhooks close, and its spend is paid from the customer's own wallet.
  • The account no longer counts against your limit, and its external_ref is free again.
  • What you set up inside the account does not move with it: every service connection, key, secret and address you put there (the Stripe key, the bot token, supplier and OAuth app keys, control socket and webhook addresses and secrets, notification destinations, payout destination) is removed when the claim completes, and the customer starts with none. Payment links and bot webhooks are turned off at Stripe and Telegram first; if that cannot finish, the claim waits and the account stays yours.

If the claim does not complete (the link lapses, the check holds or refuses the customer, the checkout is not finished, or the address already belongs to another account), the account stays with you, nothing is charged and the release reads returned. The reason goes to STACK staff, never to you.

Release statuses

  • pending - the link is out and has not expired. The account is yours.
  • completed - the customer claimed the account and it is theirs.
  • returned - the claim did not complete. The account is still yours.
  • cancelled - you withdrew the release before it was claimed.

GET /v1/partner/accounts/:account_id/release, GET /v1/partner/releases

Read one release, or all of them, newest first. These read your own record of your releases, which stays readable for 90 days after the release ended. After a claim the account is no longer yours, so this record is how you learn that it completed.

DELETE /v1/partner/accounts/:account_id/release

Withdraw a pending release. The link stops working. It returns { "cancelled": true }, or false when none is pending. A release the customer asked for returns 409 RELEASE_NOT_AVAILABLE: the customer has decided to leave.

When the customer asks to leave

An invited customer signed in to the account can ask to leave from the STACK Console. STACK mails the claim link to their own address and the release reads requested_by: "customer". You are told through your record of releases and the audit entry on your own chain. You cannot refuse it.

Passports Under an Account

POST /v1/partner/accounts/:account_id/passports/issue

Issue a Passport under an account. The body is the POST /v1/passports/issue body, so mission_ids must hold exactly one live Mission of that account. Open it with the account key, then issue with your partner key.

bash
# 1. Open the Mission under the account (account key)
curl -X POST https://api.getstack.run/v1/missions \
  -H "Authorization: Bearer $STACK_ACCOUNT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agent_id": "agt_account_agent", "intent_summary": "Triage inbound email", "intent_services": ["agentmail"] }'

# 2. Issue its Passport (partner key)
curl -X POST https://api.getstack.run/v1/partner/accounts/op_account/passports/issue \
  -H "Authorization: Bearer $STACK_PARTNER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agent_id": "agt_account_agent", "mission_ids": ["ms_..."] }'

An account key can also call POST /v1/missions/start to open the Mission and issue its Passport in one call. See Missions API.

Account billing and usage

  • Account keys cannot subscribe, top up, or open the billing portal: 403 TENANT_BILLED_BY_PARTNER.
  • Account keys cannot read decrypted credentials. GET /v1/credentials/* returns 403; accounts call services through POST /v1/proxy, which injects the credential without exposing it.
  • If your partner account is suspended or loses its partner flag, every account call returns 403 BILLING_ACCOUNT_INACTIVE.
  • GET /v1/usage with an account key reports that account's own usage, as for any customer; with your partner key it reports your own. An account's response never names the partner or shows its figures. Only under a hard-capped deal is usage pooled: consumption.actions.used is the pool total, own_used the caller's share, pooled true.
  • PUT /v1/partner/accounts/:account_id/controls with { "enabled": true } switches hosted controls on for one account: its own monthly price from your wallet, the first month at once (402 INSUFFICIENT_BALANCE if the wallet cannot cover it). { "enabled": false } ends the charge. Controls are off for every account, including those that existed before accounts were billed one by one, until you switch them on.
  • Without a plan of your own you reach these partner routes, the top-up that funds your wallet and the reads of your billing and usage. Your first top-up asks for the cardholder's name and billing country, which are checked against the sanctions lists as any customer's are at checkout, before the money is credited. Your accounts open agent accounts once that check is clear.
  • A renewal your wallet cannot pay pauses that account: its inboxes and phone numbers are released at once, its agents, memory and history are kept, and it is erased after 12 months unpaid. You are told, naming the account by your reference.
  • A refund or dispute debt on your wallet freezes your spend and stops every paid action of your accounts (402 SPEND_FROZEN) until it is resolved. What an account's plan includes still runs. The accounts are told only that spending is paused.

Account approvals

Guarded changes made with an account key, such as activating a fleet policy, return 403 GOVERNANCE_APPROVAL_REQUIRED with an approval id. Accounts have no human user until they are claimed, so your account owner or an admin member approves them in the STACK Console queue, where each one is labelled with the account. Then retry the same call with the account key and the X-Governance-Approval header. API keys cannot approve. Each decision is recorded on the account's audit chain and on yours.

Account Inbound Webhooks

Provision, list and revoke an account's inbound webhooks with your partner key. The webhook secret is returned once on create and can be rotated.

PUT /v1/partner/accounts/:account_id/inbound-webhooks/:wh_id/provider-signing-secret

A partner administrator configures webhook signing through a direct authenticated request. Send signing_secret in the JSON body. AgentMail uses its provider signing key; generic webhooks use the shared HMAC key configured at the sender. AgentMail forwarding can also set downstream_signing_secret for the receiving application. The response contains only {"configured":true}. OAuth and agent sessions cannot configure these keys. Keep keys in the administrator's local configuration; do not paste them into an assistant conversation.

SDK methods: partner.accounts.setInboundWebhookSigningSecret in TypeScript and partner_accounts.set_inbound_webhook_signing_secret in both Python clients. Both take the account ID, webhook ID, signing key, and an optional downstream key.

Endpoint Summary

text
POST   /v1/partner/accounts                        - open an account
GET    /v1/partner/accounts                        - list accounts
GET    /v1/partner/accounts/:account_id            - get one account
DELETE /v1/partner/accounts/:account_id            - close an account (cascades)
POST   /v1/partner/accounts/:account_id/rotate-key - replace the account key
POST   /v1/partner/accounts/:account_id/invite     - invite the customer to see the account
POST   /v1/partner/accounts/:account_id/release    - mail the customer a claim link
GET    /v1/partner/accounts/:account_id/release    - read a release
DELETE /v1/partner/accounts/:account_id/release    - withdraw a pending release
GET    /v1/partner/releases                        - list your releases
POST   /v1/partner/accounts/:account_id/inbound-webhooks         - provision an inbound webhook
GET    /v1/partner/accounts/:account_id/inbound-webhooks         - list inbound webhooks
DELETE /v1/partner/accounts/:account_id/inbound-webhooks/:wh_id  - revoke an inbound webhook
POST   /v1/partner/accounts/:account_id/passports/issue          - issue a passport under an account
Partner API | Docs