> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pocketsflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Enterprise API

> Read and control your white-label Pocketsflow Enterprise workspace: sellers, sales, buyers, withdrawal approvals, earnings, settings, webhooks and the audit log, with an enterprise API key.

**Pocketsflow Enterprise** runs a white-label workspace of sellers
(sub-accounts) under your brand. The Enterprise API reads that workspace and
controls it: list sellers, pause selling, hold payouts, approve or reject
withdrawals, read sales, buyers and earnings, change every setting, receive
signed webhooks and let AI agents work through MCP. It is everything in the
Enterprise Admin, over HTTP. New to Enterprise? Start with the
[overview](https://docs.pocketsflow.com/enterprise/overview.md) and the [quickstart](https://docs.pocketsflow.com/enterprise/quickstart.md).

> [card] [Interactive reference](https://api.pocketsflow.com/enterprise/docs)
>
> The Enterprise API on its own page, with a try-it console.

> [card] [Webhooks](https://docs.pocketsflow.com/enterprise/webhooks.md)
>
> Signed events to your servers.

> [card] [AI agents (MCP)](https://docs.pocketsflow.com/enterprise/mcp.md)
>
> Every endpoint as an agent tool.

The OpenAPI document is at `https://api.pocketsflow.com/enterprise/docs.json`:
generate a client in any language from it.

Base URL `https://api.pocketsflow.com`, every path under `/v1/enterprise`.

## Authentication

The Enterprise API takes an **enterprise API key** (`ek_live_...`). It is a
different key from the creator keys (`pk_live_...`, `pk_test_...`): a
creator key gets `401` here.

An owner of your workspace creates keys in the Enterprise Admin, under
**Settings > API keys** (up to 20 active keys). The full key is shown once,
when it is created; store it as a secret. Revoke a key there to stop it.
Send it as a bearer token:

```bash theme={"system"}
curl https://api.pocketsflow.com/v1/enterprise/subaccounts \
  -H "Authorization: Bearer ek_live_..."
```

* Every call only sees your own workspace. A seller or withdrawal of another
  workspace answers `404`, never someone else's data.
* A suspended workspace answers `403` `tenant_suspended`.
* Actions taken with a key go to your workspace's audit log as that key
  (`decidedBy` on a withdrawal is `api_key:<id>`).
* Rate limit: 200 requests per minute per IP (`429` above it).

## Conventions

| | |
| - | - |
| Paging | `page` (1-based, default `1`) and `pageSize` (default `25`, maximum `100`). Lists answer `{ items, page, pageSize, total }`. |
| Dates | `from` and `to` are days, `YYYY-MM-DD` (UTC), both inclusive. Timestamps in answers are ISO 8601. |
| Money | Money that moves is a decimal string in its currency (`amount`, `available`, `feeUsd`). `usd`, `amountUsd` and `volumeUsd` are USD numbers for display. |
| Errors | `{ "code": "not_found", "message": "Sub-account not found." }` with the HTTP status. |

## Node.js SDK

The [`pocketsflow`](https://docs.pocketsflow.com/api-reference/sdk) package has an `enterprise`
namespace (3.13.0 covers every endpoint on this page). Pass the enterprise key as `apiKey`:

```ts theme={"system"}
import { Pocketsflow, PocketsflowError } from "pocketsflow";

const pf = new Pocketsflow({ apiKey: process.env.POCKETSFLOW_ENTERPRISE_KEY! }); // ek_live_...

const { items, total } = await pf.enterprise.subaccounts.list({ search: "maya", filter: "selling" });
const seller = await pf.enterprise.subaccounts.get(items[0].userId);

await pf.enterprise.subaccounts.pause(seller.profile.userId, { reason: "Chargeback review" });

const pending = await pf.enterprise.withdrawals.list({ status: "pending" });
try {
  const paid = await pf.enterprise.withdrawals.approve(pending.items[0].id);
  paid.status; // "paid", or "failed" with a reason
} catch (error) {
  if (error instanceof PocketsflowError && error.code === "partner_unavailable") {
    // Slow payouts provider: approve again in a moment. It never pays twice.
  }
}

const earnings = await pf.enterprise.earnings.list({ from: "2026-11-01", to: "2026-11-30" });
earnings.totals.unsettledUsd;
```

| SDK method | Endpoint |
| - | - |
| `enterprise.subaccounts.list(params?)` | `GET /v1/enterprise/subaccounts` |
| `enterprise.subaccounts.get(userId)` | `GET /v1/enterprise/subaccounts/{userId}` |
| `enterprise.subaccounts.listProducts(userId, params?)` | `GET /v1/enterprise/subaccounts/{userId}/products` |
| `enterprise.subaccounts.getBalance(userId)` | `GET /v1/enterprise/subaccounts/{userId}/balance` |
| `enterprise.subaccounts.pause(userId, { reason? })` | `POST /v1/enterprise/subaccounts/{userId}/pause` |
| `enterprise.subaccounts.unpause(userId, { reason? })` | `POST /v1/enterprise/subaccounts/{userId}/unpause` |
| `enterprise.subaccounts.holdPayouts(userId, { reason? })` | `POST /v1/enterprise/subaccounts/{userId}/hold-payouts` |
| `enterprise.subaccounts.releasePayouts(userId, { reason? })` | `POST /v1/enterprise/subaccounts/{userId}/release-payouts` |
| `enterprise.transactions.list(params?)` | `GET /v1/enterprise/transactions` |
| `enterprise.withdrawals.list(params?)` | `GET /v1/enterprise/withdrawals` |
| `enterprise.withdrawals.approve(id)` | `POST /v1/enterprise/withdrawals/{id}/approve` |
| `enterprise.withdrawals.reject(id, { reason? })` | `POST /v1/enterprise/withdrawals/{id}/reject` |
| `enterprise.earnings.list(params?)` | `GET /v1/enterprise/earnings` |
| `enterprise.earnings.exportCsv(params?)` | `GET /v1/enterprise/earnings/export.csv` |
| `enterprise.workspace.get()` | `GET /v1/enterprise/workspace` |
| `enterprise.workspace.overview({ range? })` | `GET /v1/enterprise/overview` |
| `enterprise.subaccounts.listPayouts(userId, { limit? })` | `GET /v1/enterprise/subaccounts/{userId}/payouts` |
| `enterprise.subaccounts.setWithdrawalApproval(userId, mode)` | `PUT /v1/enterprise/subaccounts/{userId}/withdrawal-approval` |
| `enterprise.transactions.get(id)` | `GET /v1/enterprise/transactions/{id}` |
| `enterprise.transactions.exportCsv(params?)` | `GET /v1/enterprise/transactions/export.csv` |
| `enterprise.customers.list(params?)` | `GET /v1/enterprise/customers` |
| `enterprise.customers.get(id)` | `GET /v1/enterprise/customers/{id}` |
| `enterprise.withdrawals.get(id)` | `GET /v1/enterprise/withdrawals/{id}` |
| `enterprise.settings.getPayouts()` / `setPayouts(body)` | `GET` / `PUT /v1/enterprise/settings/payouts` |
| `enterprise.settings.getDesign()` / `setDesign(body)` | `GET` / `PUT /v1/enterprise/settings/design` |
| `enterprise.settings.getBrand()` / `setBrand(body)` | `GET` / `PUT /v1/enterprise/settings/brand` |
| `enterprise.settings.getSeo()` / `setSeo(body)` | `GET` / `PUT /v1/enterprise/settings/seo` |
| `enterprise.settings.getFeatures()` / `setFeatures(features)` | `GET` / `PUT /v1/enterprise/settings/features` |
| `enterprise.settings.getFees()` / `setFees(body)` | `GET` / `PUT /v1/enterprise/settings/fees` |
| `enterprise.settings.getDomains()` | `GET /v1/enterprise/settings/domains` |
| `enterprise.settings.getSignIn()` | `GET /v1/enterprise/settings/sign-in` |
| `enterprise.webhooks.list()` / `create(body)` | `GET` / `POST /v1/enterprise/webhooks` |
| `enterprise.webhooks.get(id)` / `update(id, body)` / `delete(id)` | `GET` / `PATCH` / `DELETE /v1/enterprise/webhooks/{id}` |
| `enterprise.webhooks.test(id)` / `rotateSecret(id)` | `POST /v1/enterprise/webhooks/{id}/test` / `rotate-secret` |
| `enterprise.webhooks.listDeliveries(id, params?)` | `GET /v1/enterprise/webhooks/{id}/deliveries` |
| `enterprise.webhooks.redeliver(id, deliveryId)` | `POST /v1/enterprise/webhooks/{id}/deliveries/{deliveryId}/redeliver` |
| `enterprise.audit.list(params?)` | `GET /v1/enterprise/audit` |
| `enterprise.partner.request(method, path, options?)` | `/v1/enterprise/partner/{mode}/{path}` |
| `enterprise.mcp.send(message)` | `POST /v1/enterprise/mcp` |

## Workspace

### Get your workspace

`GET /v1/enterprise/workspace`: your name, account prefix, hosts, brand, SEO,
features, seller-app layout, fees and withdrawal default, in one answer. The
settings `PUT`s below answer this same shape.

```json theme={"system"}
{
  "id": "65a0...",
  "slug": "acme",
  "name": "Acme Pay",
  "prefix": "AP",
  "status": "active",
  "hosts": { "app": "app.acmepay.com", "admin": "admin.acmepay.com", "storeBase": "acmepay.com" },
  "brand": { "primaryColor": "#0B5FFF", "supportEmail": "help@acmepay.com", "logoLightUrl": null },
  "seo": { "title": "Acme Pay", "description": "Get paid online." },
  "features": { "products": true, "cards": false },
  "design": { "layout": "checkout_first" },
  "fees": { "cardCheckoutRate": 0.01, "tenantMarkupRate": 0.005, "withdrawalRate": 0.01, "withdrawalMinUsd": 5, "withdrawalFeeRule": "lower", "tenantWithdrawalRate": 0, "tenantWithdrawalFixedUsd": 0 },
  "payouts": { "approvalRequired": true }
}
```

### Get the overview

`GET /v1/enterprise/overview?range=30d` (`7d`, `30d`, `90d` or `12m`): the
Overview page's numbers.

| Field | Meaning |
| - | - |
| `kpis` | `subAccounts`, `newSubAccounts`, `activeSellers`, `volumeUsd`, `transactions`, `refundsUsd`, `pendingWithdrawals`, `pendingWithdrawalsUsd`, `tenantEarningsUsd`, `pocketsflowFeesUsd`. |
| `previous` | The same numbers for the period before. |
| `change` | Percent change per number (`null` when the previous value was 0). |
| `series` | One row per day: `date`, `volumeUsd`, `transactions`, `signups`. |
| `topSellers` | `userId`, `name`, `email`, `volumeUsd`. |

The answer is cached for a minute.

## Sub-accounts

### List sub-accounts

`GET /v1/enterprise/subaccounts`: your sellers, newest first, with lifetime
volume.

| Query | Notes |
| - | - |
| `search` | Email, name or subdomain (partial, case-insensitive), or an exact user id. |
| `filter` | `all` (default), `selling` (can sell and has a paid sale), `paused` (selling paused), `held` (payouts held by you), `unverified` (not verified yet). |
| `page`, `pageSize` | Paging. |

```json theme={"system"}
{
  "items": [
    {
      "userId": "auth0|6711a3d59e3f1a0012cd7788",
      "name": "Maya Chen",
      "email": "maya@example.com",
      "subdomain": "maya",
      "createdAt": "2026-11-02T09:14:00.000Z",
      "canSell": true,
      "payoutsHeld": false,
      "verification": "verified",
      "volumeUsd": 1840.5,
      "transactions": 42,
      "balanceUsd": null
    }
  ],
  "page": 1,
  "pageSize": 25,
  "total": 120
}
```

`verification` is `none` (payouts not set up), `pending`, `verified` or
`rejected`. `volumeUsd` and `transactions` count live paid sales, refunds
excluded. `balanceUsd` is not loaded in lists (always `null`): read the
balance endpoint below.

### Get a sub-account

`GET /v1/enterprise/subaccounts/{userId}`: the seller's profile, stats,
payout account, last 10 sales and last 10 withdrawal requests.

```json theme={"system"}
{
  "profile": {
    "userId": "auth0|6711a3d59e3f1a0012cd7788",
    "name": "Maya Chen",
    "email": "maya@example.com",
    "subdomain": "maya",
    "country": "US",
    "picture": null,
    "createdAt": "2026-11-02T09:14:00.000Z",
    "canSell": true,
    "payoutsHeld": false,
    "verification": "verified"
  },
  "stats": { "volumeUsd": 1840.5, "transactions": 42, "refunds": 1, "products": 3, "customers": 39 },
  "partner": {
    "accountId": "acct_...",
    "status": "active",
    "balances": [{ "currency": "USD", "available": "1250.00", "pending": "80.00", "usd": 1330 }],
    "payoutMethods": [{ "id": "pm_...", "label": "Chase •• 4242", "currency": "USD" }],
    "recentPayouts": [
      {
        "id": "po_...",
        "status": "arrived",
        "amount": "500.00",
        "currency": "USD",
        "destination": "Chase •• 4242",
        "createdAt": "2026-11-20T15:02:00.000Z",
        "arrival": "2026-11-21T15:02:00.000Z"
      }
    ]
  },
  "recentTransactions": [],
  "withdrawals": []
}
```

`partner` is `{ "error": "..." }` instead when the seller hasn't set up
payouts or the payouts provider can't be reached. `partner.status` is
`active`, `held` (you hold payouts), `paused` (selling paused) or
`under_review`. `recentTransactions` and `withdrawals` use the shapes of
[transactions](#list-transactions) and [withdrawals](#list-withdrawals).

### List a sub-account's products

`GET /v1/enterprise/subaccounts/{userId}/products`: the seller's live
products, newest first, with their paid sales. Takes `page` and `pageSize`.

```json theme={"system"}
{
  "items": [{ "id": "6720...", "name": "Lightroom presets", "priceUsd": 29, "status": "published", "sales": 12 }],
  "page": 1,
  "pageSize": 25,
  "total": 3
}
```

### Get a sub-account's balance

`GET /v1/enterprise/subaccounts/{userId}/balance`: available and pending
money per currency, read live from the payouts provider.

```json theme={"system"}
{
  "userId": "auth0|6711a3d59e3f1a0012cd7788",
  "accountId": "acct_...",
  "status": "active",
  "balances": [{ "currency": "USD", "available": "1250.00", "pending": "80.00", "usd": 1330 }]
}
```

When payouts aren't set up or the provider can't be reached, the answer is
`{ "userId": "...", "error": "..." }` (still `200`).

### Pause, resume, hold and release

| Endpoint | Effect |
| - | - |
| `POST /v1/enterprise/subaccounts/{userId}/pause` | Turns checkout off for the seller. Their dashboard keeps working. |
| `POST /v1/enterprise/subaccounts/{userId}/unpause` | Turns checkout back on, when you paused it. |
| `POST /v1/enterprise/subaccounts/{userId}/hold-payouts` | The seller can't withdraw (`403` `payouts_held`) until you release them. |
| `POST /v1/enterprise/subaccounts/{userId}/release-payouts` | Lets the seller withdraw again. |

The body is optional: `{ "reason": "Chargeback review" }` (at most 500
characters) is kept in your audit log. Each answers the updated sub-account
row (the shape of the list above). Repeating an action changes nothing.

```bash theme={"system"}
curl -X POST https://api.pocketsflow.com/v1/enterprise/subaccounts/auth0%7C6711a3d59e3f1a0012cd7788/pause \
  -H "Authorization: Bearer ek_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "reason": "Chargeback review" }'
```

`unpause` only lifts a pause you made. When the platform holds the account
(a risk review, a ban), it answers `409` `platform_hold` and the seller stays
paused.

### List a sub-account's payouts

`GET /v1/enterprise/subaccounts/{userId}/payouts?limit=10` (at most 25): the
seller's bank accounts and latest payouts, read live from the payouts
provider. It includes payouts that didn't need your approval.

```json theme={"system"}
{
  "userId": "auth0|6711a3d59e3f1a0012cd7788",
  "accountId": "acct_...",
  "payoutMethods": [{ "id": "pm_...", "label": "Chase •• 6789", "currency": "USD" }],
  "payouts": [
    {
      "id": "po_...",
      "status": "paid",
      "amount": "492.00",
      "currency": "USD",
      "destination": "Chase •• 6789",
      "createdAt": "2026-11-27T08:01:00.000Z",
      "arrival": "2026-11-28T00:00:00.000Z"
    }
  ]
}
```

As with the balance, `{ "userId", "error" }` (still `200`) when payouts
aren't set up or the provider can't be reached.

### Withdrawal approval per seller

`PUT /v1/enterprise/subaccounts/{userId}/withdrawal-approval` with
`{ "mode": "default" | "required" | "auto" }`:

| Mode | Effect |
| - | - |
| `default` | Follows your workspace setting (below). |
| `required` | Every withdrawal of this seller waits for your approval. |
| `auto` | This seller's withdrawals go out straight away. |

Answers the sub-account row, with `withdrawalApproval` (the mode) and
`approvalRequired` (what applies now).

## Settings

Every setting of the Enterprise Admin. A `PUT` changes only what you send and
lands in your audit log.

| Endpoint | Body | Effect |
| - | - | - |
| `GET` / `PUT /v1/enterprise/settings/payouts` | `{ "approvalRequired": true }` | The default for every seller: withdrawals wait for your approval (`true`) or go out straight away (`false`). |
| `GET` / `PUT /v1/enterprise/settings/design` | `{ "layout": "bank_first" }` | Which app sellers land in after sign-in: `checkout_first` (Payments) or `bank_first` (Banking). |
| `GET` / `PUT /v1/enterprise/settings/brand` | `{ "name": "Acme Pay", "brand": { "primaryColor": "#0B5FFF", "supportEmail": "help@acmepay.com" } }` | Your name and brand: `primaryColor`, `primaryTextColor` (`#RRGGBB`, 4.5:1 contrast), `supportEmail`, `supportUrl`, `termsUrl`, `privacyUrl`, and logo / favicon URLs (`https://`). Answers the workspace. |
| `GET` / `PUT /v1/enterprise/settings/seo` | `{ "title": "Acme Pay", "description": "Get paid online." }` | The seller app's title (70 characters) and description (160) in search and link previews. Answers the workspace. |
| `GET` / `PUT /v1/enterprise/settings/features` | `{ "features": { "affiliates": false } }` | Turn seller-app features on or off: `products`, `checkout`, `subscriptions`, `memberships`, `courses`, `email_marketing`, `automations`, `storefront`, `websites`, `affiliates`, `discounts`, `upsells`, `analytics`, `customers`, `banking`, `cards`, `developers`, `ai`, `team`. Answers the workspace. |
| `GET` / `PUT /v1/enterprise/settings/fees` | `{ "tenantMarkupRate": 0.02 }` | Read every fee; set **your own** fees per sale and per withdrawal (below). |
| `GET /v1/enterprise/settings/domains` | | Your app, admin and store domains and the email sending domain, with their DNS status. |
| `GET /v1/enterprise/settings/sign-in` | | Where sellers sign in (`host`), with how many seller accounts you have (`sellers`) and how many confirmed their email (`verified`). |

### Fees

`GET /v1/enterprise/settings/fees`:

```json theme={"system"}
{
  "cardCheckoutRate": 0.01,
  "tenantMarkupRate": 0.02,
  "withdrawalRate": 0.01,
  "withdrawalMinUsd": 5,
  "withdrawalFeeRule": "lower",
  "tenantWithdrawalRate": 0.005,
  "tenantWithdrawalFixedUsd": 1
}
```

Rates are fractions (`0.01` is 1%).

* **Pocketsflow's fee per sale** is `cardCheckoutRate`, fixed by your
  agreement. **Your fee per sale** is `tenantMarkupRate`, on top: `PUT` it
  from `0` to `0.2`. It applies from the next checkout. Sellers pay both,
  plus card processing.
* **Pocketsflow's withdrawal fee** is `withdrawalRate` × amount and
  `withdrawalMinUsd`, whichever is `lower` (the flat amount is a cap) or
  `higher` (a minimum), per `withdrawalFeeRule`. Set in your agreement; the
  API can't change it.
* **Your withdrawal fee** is `tenantWithdrawalRate` × amount +
  `tenantWithdrawalFixedUsd`, on top. `PUT` it with either or both fields:
  the rate from `0` to `0.1`, the fixed amount from `0` to `100`. Any other
  field answers `400`: our rates are fixed. It applies to the next
  withdrawal request.

Send only the fields you change. With the fees above, a $100 sale pays $3.00
($1.00 to Pocketsflow, $2.00 to you) and a $1,000 withdrawal pays $11.00
($5.00 to Pocketsflow, $6.00 to you). See [Fees and limits](https://docs.pocketsflow.com/enterprise/fees-and-limits.md).

## Payments partner API

Call the payments partner's own REST API for **your sub-accounts**, through
us: we add our credentials, you never need them, and every call is limited to
your own accounts.

```bash theme={"system"}
curl "https://api.pocketsflow.com/v1/enterprise/partner/live/payments?company_id=biz_xxxxxxxxxxxxxx&first=20" \
  -H "Authorization: Bearer ek_live_..."
```

* The path after `/partner/live/` (or `/partner/sandbox/` for the sandbox) is
  the partner's `/api/v1/` path. The answer is the partner's, as is.
* A sub-account's id is `partnerAccountId` (`partnerSandboxAccountId` for
  the sandbox) on the sub-account row.
* Lists need `company_id` set to one of your sub-accounts (payouts:
  `account_id`). A resource id (a payment, product, membership...) must
  belong to one of them, and a body may only name your accounts and
  products. Anything else answers `404`, like something that doesn't exist.
* Routes: the account (`accounts/{id}`) and its ledger, account links,
  payments (read, refund, void, retry, fees), refunds, disputes (read,
  evidence), products and promo codes (read, create, update, delete),
  checkout configurations, invoices (list), memberships (read, update,
  cancel, pause, resume, extend), members, payouts and payout methods (read
  only). Any other route answers `404`.
* Withdrawals are never sent through the proxy: they go through your
  approval flow (`/v1/enterprise/withdrawals`).
* 120 calls a minute per key. Every write is in your audit log
  (`partner.call`).

## Transactions

### List transactions

`GET /v1/enterprise/transactions`: every live sale across your sellers,
newest first, with the platform fee split between Pocketsflow and you.

| Query | Notes |
| - | - |
| `search` | Buyer email, payment id, sale id, or a seller's email, name or subdomain. |
| `status` | `all` (default), `paid`, `refunded`, `subscription`. |
| `userId` | One seller's sales only. |
| `from`, `to` | Day range (`YYYY-MM-DD`, UTC, inclusive). |
| `page`, `pageSize` | Paging. |

```json theme={"system"}
{
  "items": [
    {
      "id": "6741...",
      "createdAt": "2026-11-26T18:40:00.000Z",
      "userId": "auth0|6711a3d59e3f1a0012cd7788",
      "sellerName": "Maya Chen",
      "buyerEmail": "buyer@example.com",
      "product": "Lightroom presets",
      "amountUsd": 49,
      "currency": "USD",
      "amount": "49.00",
      "status": "paid",
      "pocketsflowFeeUsd": 0.49,
      "tenantFeeUsd": 0.49
    }
  ],
  "page": 1,
  "pageSize": 25,
  "total": 812
}
```

`amount` is what the buyer paid, in `currency`. `tenantFeeUsd` is your share
of the platform fee.

### Get a transaction

`GET /v1/enterprise/transactions/{id}`: the row above, plus:

| Field | Meaning |
| - | - |
| `status` | `paid`, `refunded` or `disputed`. |
| `productId` | The product, `null` when it was deleted. |
| `subscription`, `subscriptionId`, `billingReason` | For subscription payments (`initial`, `renewal`). |
| `partnerPaymentId` | The payment at the payments partner: use it with the [payments partner API](#payments-partner-api) (refund, dispute evidence). |
| `taxUsd`, `buyerCountry` | Tax collected and the buyer's country (ISO). |
| `refundedAt`, `disputed` | When it was refunded; whether it's disputed. |

### Export transactions

`GET /v1/enterprise/transactions/export.csv` with the list's filters
(`search`, `status`, `userId`, `from`, `to`): a CSV file of every match.

## Customers

Your sellers' buyers. A buyer of two of your sellers is two customers, one
per seller.

### List customers

`GET /v1/enterprise/customers`, newest first.

| Query | Notes |
| - | - |
| `search` | Email or name (partial, case-insensitive). |
| `userId` | One seller's buyers only. |
| `from`, `to` | When they first bought (`YYYY-MM-DD`, UTC, inclusive). |
| `page`, `pageSize` | Paging. |

```json theme={"system"}
{
  "items": [
    {
      "id": "6748...",
      "userId": "auth0|6711a3d59e3f1a0012cd7788",
      "sellerName": "Maya Chen",
      "email": "buyer@example.com",
      "name": "Sam Lee",
      "country": "US",
      "createdAt": "2026-11-26T18:40:00.000Z"
    }
  ],
  "page": 1,
  "pageSize": 25,
  "total": 230
}
```

### Get a customer

`GET /v1/enterprise/customers/{id}`: the row above, with `stats`
(`purchases`, `refunds`, `spentUsd`, `firstPurchaseAt`, `lastPurchaseAt`) and
`purchases`: their transactions with that seller, newest first (up to 100).

## Withdrawals

When your workspace approves withdrawals, a seller's request to withdraw
waits for you as a `pending` withdrawal. Approving it pays it out to the
seller's own saved bank; rejecting it keeps the money in their balance.

### List withdrawals

`GET /v1/enterprise/withdrawals`, newest first.

| Query | Notes |
| - | - |
| `status` | `all` (default), `pending`, `approved`, `rejected`, `paid`, `failed`. |
| `userId` | One seller's requests only. |
| `page`, `pageSize` | Paging. |

```json theme={"system"}
{
  "items": [
    {
      "id": "6745...",
      "createdAt": "2026-11-27T08:00:00.000Z",
      "userId": "auth0|6711a3d59e3f1a0012cd7788",
      "sellerName": "Maya Chen",
      "amount": "500.00",
      "currency": "USD",
      "usd": 500,
      "feeUsd": "8.50",
      "pocketsflowFeeUsd": "5.00",
      "tenantFeeUsd": "3.50",
      "feeCollected": false,
      "status": "pending",
      "reason": null,
      "decidedBy": null,
      "decidedAt": null
    }
  ],
  "page": 1,
  "pageSize": 25,
  "total": 4
}
```

`feeUsd` is the whole fee the seller pays: `pocketsflowFeeUsd` plus
`tenantFeeUsd` (your own fee). `feeCollected` turns `true` once the fee is
taken from the seller's balance.

### Get a withdrawal

`GET /v1/enterprise/withdrawals/{id}`: the row above, with `destination` (the
seller's bank, e.g. `Chase •• 6789`) and `payoutId` once paid.

### Approve a withdrawal

`POST /v1/enterprise/withdrawals/{id}/approve`, no body. Answers the
withdrawal: `paid`, or `failed` with a `reason` when the bank transfer
didn't go through.

Approving is safe to repeat: a request is paid out at most once. Approving
a paid or failed request again answers it as it stands.

| Status | Code | When |
| - | - | - |
| `404` | `not_found` | No such withdrawal in your workspace. |
| `409` | `not_pending` | It was rejected already. |
| `409` | `payouts_held` | You hold this seller's payouts: release them first. |
| `409` | `payouts_on_hold` | The seller's account is on hold by the platform. |
| `409` | `account_changed` | The seller's payout account changed: ask them to request again. |
| `503` | `partner_unavailable` | The payouts provider is slow. Approve again in a moment: it won't pay twice. |

### Reject a withdrawal

`POST /v1/enterprise/withdrawals/{id}/reject` with an optional
`{ "reason": "Duplicate request" }` (at most 500 characters, kept on the
request and in your audit log). Answers the withdrawal (`rejected`).
Rejecting twice changes nothing; a request already approved answers `409`
`not_pending`.

## Earnings

### List your earnings

`GET /v1/enterprise/earnings`: your markup on every paid sale of your
sellers, a negative line for each refund, and Pocketsflow's settlements with
you.

| Query | Notes |
| - | - |
| `from`, `to` | Day range (`YYYY-MM-DD`, UTC, inclusive). Without one, all time. |
| `page`, `pageSize` | Paging of `items`. |

```json theme={"system"}
{
  "totals": { "accruedUsd": 1290.4, "settledUsd": 1240.5, "unsettledUsd": 49.9 },
  "items": [
    {
      "id": "6746...",
      "createdAt": "2026-11-26T18:40:00.000Z",
      "saleId": "6741...",
      "sellerName": "Maya Chen",
      "kind": "sale",
      "amountUsd": 0.74,
      "rate": 0.015
    }
  ],
  "settlements": [
    {
      "id": "6730...",
      "periodStart": "2026-10-01T00:00:00.000Z",
      "periodEnd": "2026-10-31T23:59:59.000Z",
      "amountUsd": 1240.5,
      "status": "paid",
      "method": "wire",
      "reference": "WIRE-2026-10",
      "paidAt": "2026-11-05T12:00:00.000Z"
    }
  ],
  "page": 1,
  "pageSize": 25,
  "total": 1840
}
```

* `totals` cover the range: `accruedUsd` is every line, `settledUsd` the
  lines in a paid settlement, `unsettledUsd` the rest.
* `kind` is `sale` (your cut of the sale's USD net before tax), `refund`
  (the same amount, negative) or `withdrawal_fee` (your part of a paid
  withdrawal's fee; `saleId` is `wd_<withdrawal id>`). A refund after its sale
  was settled lands in the next settlement.
* `settlements` lists your settlements newest first, whatever the range.
  `method` is `netted` (against the monthly invoice), `transfer` or `wire`.

### Export earnings

`GET /v1/enterprise/earnings/export.csv?from=&to=`: your earning lines as a
CSV file.

## Webhooks

Signed `POST`s to your servers when something happens. How to receive and
verify them: [Webhooks](https://docs.pocketsflow.com/enterprise/webhooks.md).

| Endpoint | Effect |
| - | - |
| `GET /v1/enterprise/webhooks` | Your endpoints (secrets masked) and the event names (`events`). |
| `POST /v1/enterprise/webhooks` | `{ "url", "events"?, "description"? }`. Answers `201` with the full `secret`, once. At most 10 (`409` `limit_reached`). |
| `GET /v1/enterprise/webhooks/{id}` | One endpoint. |
| `PATCH /v1/enterprise/webhooks/{id}` | Change `url`, `events`, `active` or `description`. |
| `DELETE /v1/enterprise/webhooks/{id}` | Removes it (`204`). |
| `POST /v1/enterprise/webhooks/{id}/test` | Sends a `ping` now; answers the delivery. |
| `POST /v1/enterprise/webhooks/{id}/rotate-secret` | A new secret, effective at once, shown once. |
| `GET /v1/enterprise/webhooks/{id}/deliveries` | The last 30 days, newest first, with payloads. `status`: `pending`, `succeeded`, `failed`. |
| `POST /v1/enterprise/webhooks/{id}/deliveries/{deliveryId}/redeliver` | Sends one again: same event id, new signature. |

Events: `subaccount.created`, `sale.paid`, `sale.refunded`,
`withdrawal.requested`, `withdrawal.paid`, `withdrawal.failed`,
`withdrawal.rejected` (`*` for all). URLs must be public `https://` hosts.

## Audit log

`GET /v1/enterprise/audit` (`page`, `pageSize`), newest first: every change
in your workspace, by an admin, an API key or Pocketsflow.

```json theme={"system"}
{
  "items": [
    {
      "id": "6749...",
      "createdAt": "2026-11-27T08:05:00.000Z",
      "actor": { "type": "api_key", "id": "6731...", "label": "Risk bot" },
      "action": "withdrawal.approve",
      "target": "6745...",
      "details": { "userId": "auth0|6711a3d59e3f1a0012cd7788", "amount": "500.00", "currency": "USD" }
    }
  ],
  "page": 1,
  "pageSize": 25,
  "total": 310
}
```

## MCP

`POST /v1/enterprise/mcp` is a Model Context Protocol server (Streamable
HTTP, JSON-RPC 2.0) with every endpoint above as a tool, for AI agents. Use
your enterprise key as the bearer token. See
[AI agents (MCP)](https://docs.pocketsflow.com/enterprise/mcp.md).

## Errors

| Status | Code | Meaning |
| - | - | - |
| `400` | `validation_error` | A field or id isn't valid; `message` says which. |
| `401` | `unauthorized` | Missing, invalid or revoked key, or not an `ek_live_` key. |
| `403` | `tenant_suspended` | The workspace is suspended. |
| `404` | `not_found` | Not in your workspace. |
| `409` | `platform_hold`, `not_pending`, `payouts_held`, `payouts_on_hold`, `account_changed`, `limit_reached` | See the endpoint. |
| `429` | | Over 200 requests per minute per IP. |
| `500` | `internal` | Something went wrong on our side. Try again. |
| `503` | `partner_unavailable` | The payouts provider is slow. Try again in a moment. |

In the SDK, every error is a `PocketsflowError` with `status`, `code` and
`message` from the answer.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.