{"openapi":"3.0.3","info":{"title":"PartnersWatch API","version":"1.0.0","description":"# Overview\n\nThis reference covers the whole PartnersWatch HTTP API. The guides in this sidebar cover connecting an existing SaaS product to it, and the endpoint groups below them describe every route. Each endpoint's schema is generated from the same validation code the server runs, so the request and response shapes always match the server.\n\n## How a product connects\n\nA connected product exchanges six kinds of traffic with PartnersWatch:\n\n| Direction | What | Guide |\n|---|---|---|\n| PartnersWatch to you | **Provisions**: create an account, change a plan, grant credits or units, suspend, cancel | Provisioning rail |\n| PartnersWatch to you | **Partner events**: a reseller partner was connected, updated or disconnected | Partner sync |\n| PartnersWatch to you | **Webhooks**: signed notifications about deals, customers, leads, conversions and more | Outbound webhooks |\n| You to PartnersWatch | **Lifecycle events**: invitation delivered, opened, accepted, first sign-in, activated | Lifecycle events |\n| You to PartnersWatch | **Usage** and **subscription state** for the accounts partners brought you | Usage reporting, Subscription state |\n| You to PartnersWatch | **Conversions** for visitors partners referred | Attribution & tracking |\n\nStart with the Quickstart. It ends with a signed provision reaching an endpoint you control.\n\nMoving a product that already has its own signup, billing and partner program? *Moving an established SaaS onto PartnersWatch* (the last guide) walks through the whole move, phase by phase, and links to the guide for each step.\n\nTo call the API from code, use the official SDKs: `@partnerswatch/sdk` for Node.js and `partnerswatch` for Python. They handle auth, retries, cursor pagination and signature verification. See *SDKs*.\n\n## Conventions\n\n- Send JSON and receive JSON. Request bodies are `application/json`, except where an endpoint says otherwise.\n- Money is an integer in minor units, for example cents. Timestamps are ISO-8601 strings.\n- Errors look like `{ \"error\": { \"code\", \"message\", \"details\"? } }` and use a conventional HTTP status. See *Errors, pagination, idempotency & rate limits*.\n- Every request is scoped to one tenant. A partner caller only ever sees its own data. An operator (vendor) sees its whole program.\n- Header names still carry the original `x-partneros-` prefix, for example `x-partneros-signature`. These are the real header names. Match them exactly.\n\n# Quickstart\n\nThis guide takes about 15 minutes. At the end, PartnersWatch has sent a signed `provision` request to an endpoint you run, your code has verified it, and PartnersWatch has recorded the account id you returned. Everything runs in the **test** environment, so no live partner, wallet or customer is touched.\n\nYou need:\n\n- an operator (vendor) user on PartnersWatch with permission to manage integrations and API keys\n- a product in your PartnersWatch catalogue (its `id`)\n- an HTTPS endpoint you can deploy to. A tunnel to your laptop works for this rehearsal.\n\nThe examples use two placeholders. `PW_API` is your PartnersWatch API base URL, the server shown at the top of this reference. `https://staging.example.com` is your own staging host.\n\n## 1. Stand up the endpoint\n\nYour endpoint receives `POST` requests with a JSON body. Verify the signature over the **raw** body before you parse it. Then do the work and return `2xx` with the account id.\n\n```js\n// Node 18+ / Express\nimport crypto from \"node:crypto\";\nimport express from \"express\";\n\nconst SIGNING_SECRET = process.env.PW_SIGNING_SECRET; // whsec_… from step 2\nconst app = express();\n\napp.post(\"/partnerswatch/provision\", express.raw({ type: \"application/json\" }), (req, res) => {\n  const raw = req.body.toString(\"utf8\");\n  const ts = req.get(\"x-partneros-timestamp\");\n  const header = req.get(\"x-partneros-signature\") ?? \"\";\n  const expected = crypto.createHmac(\"sha256\", SIGNING_SECRET).update(`${ts}.${raw}`).digest(\"hex\");\n  const ok = header\n    .split(\",\")\n    .map((p) => p.trim().replace(/^v1=/, \"\"))\n    .some((sig) => sig.length === expected.length &&\n      crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected)));\n  if (!ok || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return res.status(401).end();\n\n  const p = JSON.parse(raw);\n  // Dedupe on p.ref, then create or update the account named by p.account\n  const accountId = `acct_${p.ref.slice(0, 8)}`;\n  res.status(200).json({ id: accountId, status: \"active\" });\n});\n\napp.listen(3000);\n```\n\n## 2. Create a test connection\n\nA **connection** tells PartnersWatch where to deliver for a product, and with which credential. This call takes a user session or an operator API key with `integration:manage`. For the very first key you need a session: get one from `POST /api/auth/login` (`{ email, password }` returns `{ token }`). After that, your CI can do every step below with a key.\n\n```bash\ncurl -X POST \"$PW_API/api/integrations/connections\" \\\n  -H \"Authorization: Bearer $PW_SESSION\" -H \"Content-Type: application/json\" \\\n  -d '{\n    \"label\": \"Staging provisioning\",\n    \"provider\": \"rest\",\n    \"kind\": \"api_key\",\n    \"environment\": \"test\",\n    \"productId\": \"<your product id>\",\n    \"secret\": \"<a bearer token YOUR endpoint will accept from us>\",\n    \"metadata\": { \"url\": \"https://staging.example.com/partnerswatch/provision\" }\n  }'\n```\n\nThe response includes `signingSecret` (`whsec_…`) **once**. Store it as `PW_SIGNING_SECRET`. Every delivery also carries `Authorization: Bearer <secret>`, the value you passed as `secret`, so you can reject callers that are not PartnersWatch even before you check the signature.\n\nA connection's `environment` cannot be changed after creation. Live and test always use separate connections.\n\n## 3. Mint a test API key\n\n```bash\ncurl -X POST \"$PW_API/api/apikeys\" \\\n  -H \"Authorization: Bearer $PW_SESSION\" -H \"Content-Type: application/json\" \\\n  -d '{ \"label\": \"Integration rehearsal\", \"environment\": \"test\",\n        \"scopes\": [\"mcp:use\", \"integration:read\", \"integration:manage\", \"product:read\",\n                   \"commerce:read\", \"credit:allocate\"] }'\n```\n\nThe plaintext `token` (`pos_test_…`) is returned once. Check it:\n\n```bash\ncurl \"$PW_API/api/v1/ping\" -H \"Authorization: Bearer $PW_KEY\"\n# {\"ok\":true,\"auth\":\"api_key\",\"org\":{...},\"scopes\":[...],\"time\":\"...\"}\n```\n\n## 4. Send the first signed provision\n\nA test-environment provision is triggered through the integration self-test. It is a JSON-RPC tool on `POST /api/mcp/integration`, which needs a machine key from an operator org with `mcp:use` and `integration:manage`. It creates (and later reuses) one sandbox customer, sends a real `plan` provision to your test connection, and reports the outcome.\n\n```bash\ncurl -X POST \"$PW_API/api/mcp/integration\" \\\n  -H \"Authorization: Bearer $PW_KEY\" -H \"Content-Type: application/json\" \\\n  -d '{ \"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"tools/call\",\n        \"params\": { \"name\": \"run_integration_selftest\",\n                    \"arguments\": { \"productId\": \"<your product id>\", \"planCode\": \"starter\" } } }'\n```\n\nThe result text is JSON with `ok`, `verdict`, the `provision` (`status`, `attempts`, `externalId`, `lastError`) and a `nextStep`. When `ok` is `true`, your endpoint answered `2xx`, and the `id` you returned is now the `externalId` for that customer.\n\n`planCode` is optional when one of the product's plans already carries `config.externalPlanCode`. Otherwise you must pass it.\n\nOver REST, send a provision with a **test** key holding `credit:allocate`. The key's environment decides, so it goes through your test connection and is stored as `environment: \"test\"`. A user session always writes to **live**.\n\n```bash\ncurl -X POST \"$PW_API/api/provisions\" \\\n  -H \"Authorization: Bearer $PW_KEY\" -H \"Content-Type: application/json\" \\\n  -d '{ \"customerId\": \"<a customer id>\", \"productId\": \"<your product id>\",\n        \"kind\": \"units\", \"quantity\": 1, \"unit\": \"seats\" }'\n```\n\n## 5. Where to go next\n\n- *Provisioning rail* covers the full payload, the events you will receive, and how retries end.\n- *Go-live checklist* covers what to do before you create the live connection.\n- `GET /api/integrations/readiness?productId=…&environment=test` returns a scored list of what is still missing.\n- *Moving an established SaaS onto PartnersWatch* puts every step of a full migration in order.\n\n# Authentication & environments\n\nPartnersWatch accepts three kinds of credential. All three are sent as `Authorization: Bearer <token>`. Each endpoint in this reference shows which one it takes: `bearerAuth` is a user session, and `machineAuth` is an API key or an OAuth access token.\n\n## User sessions (JWT)\n\n`POST /api/auth/login` with `{ \"email\", \"password\" }` returns `{ token, user, memberships, activeOrgId, role, permissions, … }`. Send `token` as the bearer.\n\n- Sessions act as a person. They carry that person's role and permissions. Membership is re-checked on every request, so a removed user stops working at once.\n- **A session always writes to the live environment.** It has no test mode.\n- A few endpoints still accept **only** a session: OAuth clients, white-label review, custom roles and the rest of the console. The integration endpoints below take a session or a machine credential.\n\n## Session or machine credential (the integration surface)\n\nThese endpoints take either a user session or an **operator org's** API key / OAuth access token, so your CI can configure and exercise the integration without a person logged in. The reference lists both `bearerAuth` and `machineAuth` on them.\n\n| Endpoints | Read scope | Write scope |\n|---|---|---|\n| Connections `/api/integrations/connections*` (incl. `/test`, `/rotate-signing-secret`, `/events`), links `/api/integrations/links*`, connector catalogue `/api/integrations/manifest` | `integration:read` | `integration:manage` |\n| Provisions `GET /api/provisions`, `POST /api/provisions`, `POST /api/provisions/{id}/retry` | `commerce:read` | `credit:allocate` |\n| Usage and subscription reads `GET /api/usage`, `GET /api/subscriptions` | `usage:read`, `subscription:read` | — |\n| Provision policy `/api/products/{id}/provision-policy` | `product:read` | `product:write` (live only) |\n| Product manifest `/api/products/{id}/manifest` | `product:read` | `product:write` (live only) |\n| Webhook endpoints `/api/webhooks/endpoints*`, `/api/webhooks/deliveries/{id}/replay` | `integration:read` | `webhook:manage` (live only) |\n| Readiness `GET /api/integrations/readiness`, `GET /api/partners/{id}/readiness` | `integration:read`, `partner:read` | — |\n| Imports `/api/imports*` | `import:manage` | `import:manage` (live only) |\n| API keys `/api/apikeys*` | `apikey:manage` | `apikey:manage` |\n| pw.js publishable keys `/api/tracking/publishable-keys*` | `integration:read` | `integration:manage` |\n\nThese are the same scope names the integration MCP server uses for the same operations, and the same names a user's role needs. The rules for a machine caller:\n\n- **Operator credentials only.** A partner org's key gets `403` here.\n- **Scopes are the ceiling.** A missing scope answers `403 Missing scope: <scope>`. Your role at the time you minted the key does not matter afterwards.\n- **The credential's environment decides.** A `pos_test_` key creates test connections (the default when you omit `environment`; asking for `live` is `403`), sends test provisions through the product's test connection, and sees only test connections, provisions, API keys and publishable keys. Live rows answer `404`. Readiness is always judged on `test`.\n- **Live only.** Webhook endpoints, provision policy, manifests and imports have no environment, so changing them needs a live credential. A test credential can read them.\n- **No escalation.** A key with `apikey:manage` can mint (or rotate) keys only with scopes it holds itself, and a test key mints and rotates test keys only. OAuth clients are still managed with a session.\n- Everything stays in the credential's own org. Another org's ids answer `404`.\n\nCreate a test provision from CI with a test key:\n\n```bash\ncurl -X POST \"$PW_API/api/provisions\" \\\n  -H \"Authorization: Bearer $PW_TEST_KEY\" -H \"Content-Type: application/json\" \\\n  -d '{ \"customerId\": \"<customer id>\", \"productId\": \"<your product id>\",\n        \"kind\": \"units\", \"quantity\": 2, \"unit\": \"seats\" }'\n# {\"id\":\"…\",\"environment\":\"test\",\"status\":\"delivered\",…}\n```\n\n## API keys\n\nMint a key with `POST /api/apikeys` (session or an operator key, `apikey:manage`):\n\n```json\n{ \"label\": \"Billing sync\", \"scopes\": [\"usage:ingest\", \"subscription:ingest\"], \"environment\": \"live\",\n  \"expiresAt\": \"2027-01-01T00:00:00Z\" }\n```\n\n- The response carries the plaintext `token` exactly once. It has the form `pos_live_<48 hex>` or `pos_test_<48 hex>`. Only a SHA-256 hash is stored. `prefix` (the first 12 characters) identifies the key in lists.\n- You can grant only scopes your own role holds (or, minting with a key, the scopes that key holds).\n- `environment` defaults to `live` for a session and to the minting key's own environment for a key.\n- `expiresAt` is optional and must be in the future. Without it a key works until it is revoked. An expired key answers `401 API key has expired`; a revoked one `401 API key has been revoked`. `GET /api/apikeys` shows each key's `expiresAt` and, for a key minted by a rotation, `rotatedFromId`.\n- `DELETE /api/apikeys/{id}` revokes a key. Revocation takes effect on the next request.\n- `GET /api/v1/ping` and `GET /api/v1/me` return the org, auth kind and scopes of the presented credential. Use them as a connection test.\n\n### Rotating a key\n\n`POST /api/apikeys/{id}/rotate` (same guard as minting: a session, or an operator key with `apikey:manage`) replaces a key without downtime:\n\n```bash\ncurl -X POST \"$PW_API/api/apikeys/<key id>/rotate\" \\\n  -H \"Authorization: Bearer $PW_ADMIN_KEY\" -H \"Content-Type: application/json\" \\\n  -d '{ \"graceSeconds\": 3600 }'\n# {\"id\":\"<new id>\",\"token\":\"pos_live_…\",\"rotatedFromId\":\"<key id>\",\"previousKeyExpiresAt\":\"…\",…}\n```\n\n- It mints a **new key** with the same label, scopes and environment, and returns its plaintext `token` once. `rotatedFromId` points at the key it replaces.\n- The old key keeps working for `graceSeconds`: default `86400` (24 hours), maximum `604800` (7 days), `0` to stop it at once. Its `expiresAt` is set to the end of the window and returned as `previousKeyExpiresAt`. A key that already expires sooner keeps its earlier date.\n- Deploy the new token, confirm it works (`GET /api/v1/ping`), and let the old one lapse, or revoke it early.\n- The minting rules apply: you must hold every scope the key carries, and a test credential can rotate only test keys. Revoked and expired keys cannot be rotated (`422`); mint a new key instead. A key may rotate itself.\n- The new key does not inherit an expiry. Set one by minting instead if you need it.\n- The integration MCP server offers the same operation as `rotate_api_key`. It refuses `graceSeconds: 0` on the key making the call.\n\n## OAuth client credentials\n\nFor integrations that prefer short-lived tokens:\n\n1. Create a client with `POST /api/oauth/clients` (session, `apikey:manage`), with body `{ label, scopes[], environment }`. The response has `clientId` (`cid_<env>_<32 hex>`) and `clientSecret` (`csec_<48 hex>`, shown once).\n2. Exchange it at `POST /api/oauth/token`:\n\n```bash\ncurl -X POST \"$PW_API/api/oauth/token\" -H \"Content-Type: application/json\" \\\n  -d '{\"grant_type\":\"client_credentials\",\"client_id\":\"cid_live_…\",\"client_secret\":\"csec_…\"}'\n# {\"access_token\":\"…\",\"token_type\":\"Bearer\",\"expires_in\":900,\"scope\":\"usage:ingest subscription:ingest\"}\n```\n\n3. Send `access_token` as the bearer until it expires (15 minutes), then exchange again.\n\nLimits of this implementation:\n\n- The token endpoint accepts a JSON or `application/x-www-form-urlencoded` body. The client id and secret must be in the **body**. HTTP Basic client authentication (`Authorization: Basic …`) is not supported, so configure your OAuth library to send credentials in the body.\n- A token always carries all of the client's scopes. A `scope` request parameter is not supported.\n- `POST /api/oauth/clients/{id}/rotate-secret` returns a new `clientSecret` once. The **old secret keeps working** at the token endpoint for `graceSeconds` (body `{ \"graceSeconds\": 3600 }`; default 24 hours, maximum 7 days, `0` to retire it at once), so you can deploy the new secret with no outage. The client's `previousSecretExpiresAt` shows when the overlap ends. Only one previous secret is kept: rotating again inside a window retires the oldest secret immediately. Tokens already issued stay valid until they expire either way.\n- Deleting a client invalidates its outstanding tokens on their next use.\n\n## Scopes\n\nScopes use the same names as permissions, for example `usage:ingest`. A machine route rejects a missing scope with `403 Missing scope: <scope>`. The scopes the integration endpoints need:\n\n| Scope | Unlocks |\n|---|---|\n| `usage:ingest` | `POST /api/usage/ingest` |\n| `subscription:ingest` | `POST /api/subscriptions/ingest` |\n| `attribution:write` | `POST /api/track/conversion` |\n| `event:ingest` | `POST /api/events/ingest` |\n| `partner:read` | `GET /api/v1/partners/{id}/brand`, `GET /api/v1/partners` |\n| `customer:read` / `customer:write` | `/api/v1/customers` |\n| `deal:read` / `deal:write` | `/api/v1/deals` |\n| `webhook:manage` (+ the event's read scope) | `/api/v1/hooks` REST-hook subscriptions |\n| `mcp:use` | `POST /api/mcp`, `POST /api/mcp/integration` |\n| `integration:read` / `integration:manage`, `commerce:read`, `credit:allocate`, `product:read` / `product:write`, `webhook:manage`, `import:manage`, `apikey:manage` | The session-or-machine integration endpoints (table above) |\n\n## Live and test\n\nEvery API key and OAuth client belongs to one environment, which is fixed when you create it.\n\n- A **test** credential writes test rows. A test provision goes through the product's *test* connection and never debits a wallet. Usage and subscription records are stored as `environment: \"test\"`. A test conversion is recorded but creates no customer and fires no event.\n- A **live** credential and every user session write live rows. They can also see test rows on the integration endpoints.\n- Read endpoints that mix environments take an `environment` query parameter where one is offered (for example `GET /api/usage?environment=test`). The default is live.\n\nThere is no separate sandbox host. Test and live share one API and one database, and the environment of the credential is what separates them.\n\n# Provisioning rail\n\nA **provision** is PartnersWatch asking your product to do something for a customer that a partner brought you. The request might be: create the account, put it on a plan, grant credits or seats, toggle a feature, suspend it or cancel it. A partner (or the operator) creates the provision in PartnersWatch. PartnersWatch then `POST`s it to your endpoint until you accept it or the attempts are used up.\n\nThe request is documented as a webhook in this reference, under **Provision request (to your endpoint)**.\n\n## Where it is sent\n\nEach product has at most one active connection per environment (`live`, `test`). The `rest` connector chooses its target in this order:\n\n1. `metadata.urls.provision`, if set\n2. `metadata.url`\n3. `metadata.baseUrl`\n\nThe method is `POST`, unless `metadata.method` overrides it. The body is the JSON payload below. An optional `metadata.fieldMap` (`{ \"ourField\": \"yourField\" }`) changes the body: only the mapped top-level fields are sent, under your names. The signature always covers the body exactly as sent.\n\nHeaders on every delivery:\n\n| Header | Value |\n|---|---|\n| `content-type` | `application/json` |\n| `authorization` | `Bearer <secret>`, the `secret` you gave the connection. With `metadata.auth: \"header:X-Api-Key\"` it is sent as `X-Api-Key: <secret>` instead. |\n| `x-partneros-timestamp` | Unix seconds when this delivery was signed |\n| `x-partneros-signature` | `v1=<hex>`, or `v1=<hex>,v1=<hex>` while a rotated secret overlaps |\n\nConnections created before signing existed may carry no signing secret. Those send no signature headers. Call `POST /api/integrations/connections/{id}/rotate-signing-secret` to give one a secret.\n\n## The payload\n\n```json\n{\n  \"type\": \"provision\",\n  \"event\": \"plan.changed\",\n  \"version\": 1,\n  \"kind\": \"plan\",\n  \"ref\": \"6f1c2a7e-0b7c-4f61-9a55-3d2f4b8e9c10\",\n  \"account\": \"owner@customer.example.com\",\n  \"quantity\": null,\n  \"unit\": null,\n  \"attributes\": { \"planId\": \"…\", \"plan\": \"growth\", \"planLabel\": \"Growth\" },\n  \"planCode\": \"growth\",\n  \"product\": { \"id\": \"…\", \"name\": \"Example Analytics\" },\n  \"partner\": {\n    \"id\": \"…\", \"name\": \"Acme Consulting\",\n    \"brand\": null,\n    \"relationship\": \"referral\", \"billingMode\": \"commission\",\n    \"adminEmail\": null,\n    \"revision\": 1767312000000\n  },\n  \"customer\": { \"id\": \"…\", \"name\": \"Jane Doe\", \"email\": \"jane@customer.example.com\", \"company\": \"Customer Ltd\" },\n  \"note\": null,\n  \"createdAt\": \"2026-10-02T09:30:00.000Z\"\n}\n```\n\n| Field | Meaning |\n|---|---|\n| `ref` | The provision id. **Dedupe on it.** The same `ref` can arrive more than once (see retries). |\n| `event` | What happened. `account.created` when `attributes.action` is `onboard` or `create`. `account.suspended` for `suspend`/`pause`. `account.cancelled` for `cancel`/`cancelled`/`terminate`. Otherwise it follows `kind`: `credits.granted`, `units.granted`, `plan.changed`, `feature.changed`, `custom.applied`. |\n| `kind` | `credits`, `units`, `plan`, `feature` or `custom`. |\n| `account` | Your account to act on. PartnersWatch resolves it in this order: the `externalAccountId` the caller passed, then the account id you returned for this customer earlier, then `attributes.domain` for an onboard, then the customer's email. |\n| `quantity`, `unit` | Set for `credits` and `units` (1 to 1,000,000). |\n| `attributes` | Free-form instructions from the caller. For an onboard provision they include `action: \"onboard\"`, `domain`, `ownerEmail`, `companyName`, `platform` (`web`, `shopify`, `woocommerce` or `shopware`), `location`, `domainVerified`. They may also include `domainVerification` (see *White-label & domains*). |\n| `attributes.trial` | `true` on a `plan` provision for a customer in the partner's trial stage. Apply the plan as a trial on your own trial terms, and lock the account when the trial ends. Absent means a paid plan. A trial grant never extends a trial already running or reopens one that has ended: count the trial from the account's **first** trial grant, with that grant's length. Every plan grant while the customer is in trial carries `trial` (a plan change, a resume after a pause), so a vendor that restarts the clock on each one hands out unlimited free trials. |\n| `attributes.action` (plan lifecycle) | `resume`: a paused or churned customer is back, so grant the plan again. `convert`: the partner moved a Trial customer to Active, so the plan continues as paid; drop the trial deadline, or unlock an account whose trial already ended. Both arrive as `plan.changed`. |\n| `planCode` | Present on `plan` provisions whose `attributes.planId` names a catalogue plan that has `config.externalPlanCode`. This is your own plan code. |\n| `partner.relationship`, `partner.billingMode` | The partner's commercial edge. `adminEmail` is set only when the partner resells (a white-label or resale edge). |\n| `partner.brand` | The partner's approved white-label brand, or `null`. |\n| `partner.revision` | A millisecond counter that increases with every delivery. Ignore any delivery whose revision is lower than one you already applied. |\n\n`version` is `1`. It changes only on a breaking change to this payload.\n\n## Verifying the signature\n\nCompute HMAC-SHA256 with the connection's signing secret (the whole `whsec_…` string as the key) over `` `${timestamp}.${rawBody}` ``. Compare it in constant time against each `v1=` value. Accept the request if any value matches, and reject it if the timestamp is too old for your taste. PartnersWatch does not prescribe a tolerance. Five minutes is typical.\n\n```js\nimport crypto from \"node:crypto\";\n\nexport function verifyPartnersWatch(rawBody, headers, secret, toleranceSec = 300) {\n  const ts = headers[\"x-partneros-timestamp\"];\n  const sigs = (headers[\"x-partneros-signature\"] ?? \"\")\n    .split(\",\").map((s) => s.trim()).filter((s) => s.startsWith(\"v1=\"))\n    .map((s) => Buffer.from(s.slice(3), \"hex\"));\n  if (!ts || !sigs.length) return false;\n  if (Math.abs(Date.now() / 1000 - Number(ts)) > toleranceSec) return false;\n  const expected = crypto.createHmac(\"sha256\", secret).update(`${ts}.${rawBody}`).digest();\n  return sigs.some((s) => s.length === expected.length && crypto.timingSafeEqual(s, expected));\n}\n```\n\n```python\nimport hashlib, hmac, time\n\ndef verify_partnerswatch(raw_body: bytes, headers, secret: str, tolerance: int = 300) -> bool:\n    ts = headers.get(\"x-partneros-timestamp\")\n    sigs = [p.strip()[3:] for p in headers.get(\"x-partneros-signature\", \"\").split(\",\")\n            if p.strip().startswith(\"v1=\")]\n    if not ts or not sigs or abs(time.time() - int(ts)) > tolerance:\n        return False\n    expected = hmac.new(secret.encode(), f\"{ts}.\".encode() + raw_body, hashlib.sha256).hexdigest()\n    return any(hmac.compare_digest(s, expected) for s in sigs)\n```\n\nSign the bytes you received. Do not sign a re-serialised object.\n\n## Responding\n\n- Return **2xx** when you have applied the provision, or when you have already applied this `ref`.\n- Return a JSON object, ideally with `id` (or `externalId`) set to your account id. PartnersWatch stores the whole JSON response on the provision as `response`. It also links `id` to the customer, so the next provision for that customer arrives with `account` set to it. A newer `id` replaces an older link.\n- For an onboard provision (`attributes.action = \"onboard\"`), also return `invitation`: `sent`, `existing_member`, `pending` or `none`, for example `{ \"id\": \"acct_8f2c1d\", \"invitation\": \"sent\" }`. It is what the partner sees as the invitation's first step. Report what happens after that with lifecycle events (see *Lifecycle events*).\n- A non-JSON 2xx body is accepted, but no account id is recorded.\n\n## Retries and finality\n\n- The first attempt happens inline when the provision is created. After that, a worker checks for due provisions about every 10 seconds.\n- A provision gets **5 attempts**. The delays between attempts are 1 minute, 5 minutes, 15 minutes and 1 hour. After the fifth failure, `status` becomes `failed`.\n- **A 4xx response is final**, and the provision fails at once, **except** for `401`, `403`, `404`, `408` and `429`, which are retried as transient. Reject bad input with `400` or `422` so it stops. Return `5xx` or `429` when you want it tried again.\n- Within a single attempt, a network error, timeout (10 seconds), `5xx` or `429` is retried up to 3 more times (after 0.5 s, 2 s and 8 s), with the **same** timestamp and signature. One attempt can therefore reach you up to 4 times. This is another reason to dedupe on `ref`.\n- An operator can re-run a failed provision with `POST /api/provisions/{id}/retry`. This resets the attempt count, so the same `ref` can arrive again days later.\n\nStatuses: `pending` → `delivering` → `delivered` or `failed`.\n\n## Provision policy\n\nA product can limit what partners may send it. Set the policy with `PUT /api/products/{id}/provision-policy` (session or a live operator key, `product:write`), using the body `{ \"policy\": { … } | null }`:\n\n| Field | Effect |\n|---|---|\n| `allowedKinds` | Array of kinds the product accepts. `null` means any kind. |\n| `maxQuantityPerProvision` | Integer cap on `quantity`, up to 10,000,000. `null` means no cap. |\n| `requirePlanId` | When `true`, a `plan` provision must carry `attributes.planId` from the catalogue. |\n\nA provision that breaks the policy is refused with `409` when it is created, and nothing is sent to you.\n\n## Creating provisions\n\n`POST /api/provisions` (session or operator key, `credit:allocate`) takes `customerId`, `productId`, `kind` (default `credits`), `quantity` (required for `credits` and `units`), `unit`, `attributes`, `externalAccountId`, `onboard` and `note`.\n\n- The environment is the caller's, never the body's: a `pos_test_` key (or test OAuth client) creates a **test** provision through the product's test connection; a session or live key creates a live one. `POST /api/provisions/{id}/retry` (`credit:allocate`) and `GET /api/provisions` (`commerce:read`) take the same credentials, and a test key only ever sees test provisions.\n- A live `credits` provision debits the partner's credit wallet when it is created. `409 Insufficient credits` means nothing was sent.\n- If a `credits` provision ends `failed` (your product rejected it with a final `4xx`, or every attempt was used up), the debited credits go back to the wallet as a `refund` ledger line with the same ref (`refType: \"provision\"`, `refId` = the provision id). The refund happens once per failure, however many workers or retries race on the row, and it is complete before `provision.failed` is emitted.\n- Retrying a refunded provision with `POST /api/provisions/{id}/retry` charges the credits again before it is re-sent, and responds `409 Insufficient credits` (without sending anything) if the wallet can no longer cover them. A provision that is still `pending` keeps its original charge. Over its life, a provision's ledger lines always add up to what it currently holds.\n- An `onboard` provision for a customer that already has a linked account is refused with `409`.\n- If the product has no active connection in that environment, the provision is stored as `pending`, with `lastError` \"Product has no active … connection yet\". It is retried like any other failure.\n\n## Known limits\n\n- `provision.failed` is emitted once a provision is final-failed, and it reaches both the partner's and the operator's webhook endpoints. Before the final failure, the retries in between emit nothing. To watch those, use `GET /api/provisions?status=pending` and its `lastError`, or the readiness report.\n\n# Lifecycle events\n\nWhen a partner adds a customer, your product opens the account and invites the owner. After that, only your product knows what happened: whether the invitation arrived, whether it was opened, whether the customer accepted it, signed in and started using the product. Report those facts with `POST /api/events/ingest`. Partners see them as an onboarding tracker on the customer's page and as a column on their customer list. They are emailed when a customer accepts, activates, or when the invitation bounces or expires.\n\nNothing here is required. A product that sends no lifecycle events still works. Partners then see the account and the invitation from the provision reply (see **Report the invitation** below), and the tracker says that the vendor hasn't reported sign-in activity yet.\n\n## Endpoint\n\n```\nPOST /api/events/ingest\nAuthorization: Bearer <operator API key with the event:ingest scope>\nContent-Type: application/json\n```\n\n```json\n{\n  \"externalCustomerId\": \"acct_8f2c1d\",\n  \"type\": \"invitation.accepted\",\n  \"occurredAt\": \"2026-10-07T09:12:00Z\",\n  \"payload\": { \"userId\": \"usr_19\", \"email\": \"owner@customer.example\" }\n}\n```\n\nThe customer is resolved by `customerId` (the PartnersWatch customer id, sent as `customer.id` in every provision), then `externalCustomerId` (the account id you returned from the onboard provision, or that arrived as `account`), then `customerEmail`. Prefer `externalCustomerId`, because an email can change or be shared between accounts. A customer that does not resolve answers `422 customer not resolved`. That will never succeed on a retry, so log the event and drop it.\n\n`occurredAt` defaults to the time PartnersWatch receives the event. Send the real time when you batch or replay events, because the tracker shows the first occurrence of each step. Events from a `pos_test_` key are stored in the test environment and never email a partner.\n\n## Canonical event types\n\n| `type` | Send it when | Tracker step |\n|---|---|---|\n| `invitation.sent` | You sent (or resent) the owner's invitation | Invitation sent |\n| `invitation.delivered` | Your mail provider accepted delivery | Delivered |\n| `invitation.opened` | The invitation email was opened | Opened |\n| `invitation.clicked` | The invitation link was clicked | Clicked |\n| `invitation.bounced` | The invitation hard-bounced | Problem: bounced |\n| `invitation.expired` | The invitation expired unused | Problem: expired |\n| `invitation.accepted` | The owner accepted and set up their login | Accepted |\n| `user.signed_in` | A user of the account signed in (send every sign-in, or only the first) | First sign-in |\n| `customer.activated` | The account reached your activation milestone (for example, first project created or first order synced) | Activated |\n\n`invitation.delivered`, `invitation.opened`, `invitation.clicked` and `invitation.bounced` come from your mail provider's delivery webhooks. Keep the provider's message id when you send the invitation so you can match its webhook back to the customer. Opens and clicks are only reported once open and click tracking is turned on for the sending domain at your provider; that applies to each partner's own sending domain too, if you send from it.\n\nSteps are ordered: account created, then invitation sent, delivered, opened, clicked, accepted, first sign-in, activated. The customer's stage is the furthest step reached. A step you never report stays empty without blocking later ones. For example, a customer who accepts without an `invitation.opened` is still at Accepted.\n\nA bounce or expiry shows as a problem until the customer gets past it. That happens when you later send `invitation.sent`, `invitation.delivered`, `invitation.opened` or `invitation.clicked`, or when the customer accepts. To resend an invitation, send `invitation.sent` again.\n\nThese spellings are also accepted and treated as the canonical type: `invite.sent`, `invite.delivered`, `invite.opened`, `invite.clicked`, `invite.bounced`, `invite.expired`, `invite.accepted`, `user.login`, `user.logged_in` and `account.activated`.\n\nThe rail stays free-form. Any other `type` (for example `feature.used`) is stored on the customer's event stream, where playbooks, metrics and dashboards can use it. It just doesn't move the onboarding tracker.\n\n## Examples\n\nInvitation bounced, resolved by email:\n\n```json\n{ \"customerEmail\": \"owner@customer.example\", \"type\": \"invitation.bounced\",\n  \"payload\": { \"reason\": \"mailbox does not exist\" } }\n```\n\nFirst sign-in:\n\n```json\n{ \"externalCustomerId\": \"acct_8f2c1d\", \"type\": \"user.signed_in\",\n  \"occurredAt\": \"2026-10-07T09:20:41Z\" }\n```\n\n```bash\ncurl -X POST \"$PARTNERSWATCH_URL/api/events/ingest\" \\\n  -H \"Authorization: Bearer $PARTNERSWATCH_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: evt_$(uuidgen)\" \\\n  -d '{\"externalCustomerId\":\"acct_8f2c1d\",\"type\":\"customer.activated\"}'\n```\n\n## Report the invitation\n\nThe tracker's first two steps come from your reply to the onboard provision (`attributes.action = \"onboard\"`, `event: \"account.created\"`), so they work even before you send any events. Include `invitation` in the JSON you return:\n\n```json\n{ \"id\": \"acct_8f2c1d\", \"invitation\": \"sent\" }\n```\n\n| `invitation` | Meaning |\n|---|---|\n| `sent` | You emailed the owner an invitation. The tracker shows Invitation sent. |\n| `existing_member` | The owner already had a login and was notified of the new account. Also counts as invited. |\n| `pending` | The invitation is queued and not sent yet. Send `invitation.sent` when it goes out. |\n| `none` | No invitation was sent. |\n\nA provision that ends `failed` without any account being created shows on the tracker as the problem *Account not created*, with your error response as the detail. The partner is emailed once.\n\n## What partners see\n\n- On the customer's page: each step with its time, a problem banner (bounced, expired, or account not created) with what to do next, and \"No activity for N days\" once the customer has been stuck for 3 days or more before activation.\n- On the customer list: an Onboarding column with the current stage.\n- In their inbox: one email the first time a customer accepts, activates, bounces or expires. Opens, clicks and sign-ins are never emailed.\n- Over the API: `GET /api/customers/{id}/journey` and `GET /api/customers/{id}/timeline` (activities, events and provisions in one feed).\n\n# Usage reporting\n\nPartnersWatch can show each partner the usage of the accounts it brought you. You push usage records. PartnersWatch stores them and displays them. It does not bill, rate or invoice from them.\n\n## Endpoint\n\n`POST /api/usage/ingest`, with a machine credential that has the `usage:ingest` scope. Send 1 to 500 records per request.\n\n```json\n{\n  \"records\": [\n    {\n      \"orgId\": \"PARTNER_ORG_ID\",\n      \"productId\": \"PRODUCT_ID\",\n      \"metric\": \"api_calls\",\n      \"quantity\": 18250,\n      \"unit\": \"calls\",\n      \"periodStart\": \"2026-10-01T00:00:00Z\",\n      \"periodEnd\": \"2026-10-02T00:00:00Z\",\n      \"externalRef\": \"usage:acct_123:api_calls:2026-10-01\",\n      \"externalCustomerId\": \"acct_123\"\n    }\n  ]\n}\n```\n\n| Field | Rules |\n|---|---|\n| `orgId` | Optional when `externalCustomerId` resolves (see below), otherwise required. The **partner** org the usage belongs to. This is `partner.id` from the provision payload. An `orgId` outside your program rejects that record. |\n| `productId` | Optional. The product the usage is for. |\n| `metric` | Required, 1 to 100 characters. Your own metric name. |\n| `quantity` | Required integer. |\n| `unit` | Optional, up to 50 characters. |\n| `periodStart`, `periodEnd` | Required ISO-8601 date-times. An offset is allowed. |\n| `externalRef` | Optional, up to 200 characters. **The idempotency key.** |\n| `externalCustomerId` | Optional, up to 200 characters. Your account id. When it resolves (see below), the record is linked to that customer and, if you left `orgId` out, filed under that customer's partner. |\n\n## Resolving `externalCustomerId`\n\nUsage uses the same resolver as subscription states. The first match wins:\n\n1. a provision whose returned `id` (the one your app sent back) equals the account id;\n2. a provision whose `externalAccountId` equals the account id;\n3. an external link `customer` ↔ `account`, written by a tracked conversion, an import or `POST /api/integrations/links/bulk`.\n\nPass `productId` and only provisions or links for that product match (a link on a connection with no product still matches). When you send both `orgId` and an account that resolves to a **different** partner, the record is filed under your `orgId` and is not linked to the other partner's customer.\n\n## Response\n\nEach record is judged on its own. One bad record never fails the batch.\n\n```json\n{\n  \"inserted\": 1,\n  \"duplicates\": 0,\n  \"linked\": 1,\n  \"rejected\": 1,\n  \"results\": [\n    { \"index\": 0, \"status\": \"inserted\", \"orgId\": \"PARTNER_ORG_ID\", \"customerId\": \"CUSTOMER_ID\", \"reason\": null },\n    { \"index\": 1, \"status\": \"rejected\", \"orgId\": null, \"customerId\": null, \"reason\": \"No partner resolved for account acct_999 — send orgId, provision it first, or link it\" }\n  ]\n}\n```\n\n`status` is `inserted`, `duplicate` or `rejected`. A record is rejected when its `orgId` is outside your program, or when it has no `orgId` and its account does not resolve. A record **with** an in-scope `orgId` whose account does not resolve is stored unlinked, not rejected.\n\n## Idempotency\n\nA record whose `externalRef` was already stored is skipped and counted under `duplicates`, so a whole batch can be retried safely. Build the ref from your own natural key, for example account, metric and period.\n\n- `externalRef` is unique **across the whole platform**, not just within your org. Prefix it with something that belongs to you.\n- A record **without** `externalRef` is never deduplicated. Each retry inserts it again.\n- Records in one request are inserted one by one. They are not inserted as a single transaction. A request that fails part-way may have stored some records. Retrying with refs is safe.\n\n## Reading it back\n\n`GET /api/usage` and `GET /api/usage/summary` (session, `usage:read`) take the filters `orgId`, `customerId`, `metric`, `from`, `to` and `environment` (default `live`). The list returns up to 500 rows. There is no machine-credential read endpoint.\n\n# Subscription state\n\nReport each account's subscription lifecycle (trial, active, past due, paused, cancelled, churned) back to PartnersWatch. Partners and operators then see renewals and churn without asking you. The readiness report flags a product that never reports state.\n\n## Endpoint\n\n`POST /api/subscriptions/ingest`, with a machine credential that has the `subscription:ingest` scope. Send 1 to 500 records per request.\n\n```json\n{\n  \"records\": [\n    {\n      \"externalAccountId\": \"acct_123\",\n      \"state\": \"active\",\n      \"productId\": \"PRODUCT_ID\",\n      \"planCode\": \"growth\",\n      \"quantity\": 5,\n      \"mrr\": 24900,\n      \"currency\": \"USD\",\n      \"effectiveAt\": \"2026-10-02T09:30:00Z\",\n      \"externalRef\": \"sub:acct_123:evt_9f8e7d\",\n      \"raw\": { \"source\": \"billing\" }\n    }\n  ]\n}\n```\n\n| Field | Rules |\n|---|---|\n| `externalAccountId` | Required, 1 to 200 characters. The account this state is for. |\n| `state` | Required. One of `active`, `trialing`, `past_due`, `paused`, `cancelled`, `churned`. |\n| `orgId` | Optional. The partner org. Send it when PartnersWatch cannot work out the partner itself (see below). |\n| `productId`, `planCode` (up to 120), `quantity` | Optional. |\n| `mrr` | Optional integer in **minor units**, 0 or more. `currency` is a 3-letter code. |\n| `reason` | Optional, up to 500 characters. |\n| `effectiveAt` | Optional. A UTC timestamp ending in `Z`. An offset such as `+02:00` is **rejected** with `422`. Defaults to the time of receipt. |\n| `externalRef` | Optional, up to 200 characters. The idempotency key. It is unique across the whole platform, and a repeat is counted under `duplicates`. |\n| `raw` | Optional object. It is stored with the record. |\n\nResponse: `{ \"accepted\": 1, \"duplicates\": 0, \"unresolved\": 0, \"notes\": [] }`. When a state moved commission, the response also carries `commission` (see below).\n\n## How states move commission\n\nEach accepted state that resolves to a customer goes through the same commission path as a billing-provider event. Nothing is duplicated, and the program's own rules decide the outcome:\n\n| State | Effect |\n|---|---|\n| `cancelled` / `churned` with `reason` `refund`, `refunded`, `full_refund`, `chargeback` or `charged_back` | Treated as a full refund: each of the customer's accrued, won deals is clawed back if it is inside the program's `clawback` rule window. |\n| `cancelled` / `churned`, any other reason | Churn: the same clawback inside the window, exactly like moving the customer to a lost stage. |\n| A state whose `mrr` is lower than the account's previous state (same partner, product and environment) | Reported as a downgrade. No money moves, because commission schedules pay a fixed amount per period and there is no recurring-amount adjustment. |\n| `paused` with `reason` `trial_ended` | The customer's trial ran out and you locked the account. The partner's admins are emailed once per lapse, and the customer shows \"Trial ended\" while the partner still has them in Trial. No money moves, and the partner's status is not changed. A lapse reported before the account was linked counts (and emails) once it is linked. A lapse with no `productId` applies to each of the customer's products until you report a newer state for that product. |\n| Anything else | Recorded only. |\n\n- **Safe by default.** A clawback only happens inside a `clawback` commission rule's window (`{ \"days\": 90 }`), measured from the deal's close to when the subscription ended (a future `effectiveAt` counts as now). A program without a clawback rule never loses commission here. The entry then reads `outside_clawback_window`.\n- **Environment.** Only deals in the credential's environment are considered. A test-key state never reaches a live deal.\n- **Product.** With `productId`, only that product's deals are considered. Otherwise all of the customer's deals are.\n- **Idempotent.** The effect runs once, in the same transaction that stores the state. A repeated `externalRef` is a duplicate and moves nothing. A deal already clawed back has nothing left to reverse.\n- Every clawback emits `commission.clawed_back` (webhook and playbook event).\n\n`commission` lists one entry per effect:\n\n```json\n{ \"accepted\": 1, \"duplicates\": 0, \"unresolved\": 0, \"notes\": [],\n  \"commission\": [\n    { \"externalAccountId\": \"acct_123\", \"externalRef\": \"sub:acct_123:evt_9f8e7d\",\n      \"action\": \"churn_clawed_back\", \"dealId\": \"DEAL_ID\", \"amount\": 10000 }\n  ] }\n```\n\n`action` is `churn_clawed_back`, `refund_clawed_back`, `outside_clawback_window`, `downgrade_noted`, or one of the trial notes below. `amount` is the commission taken back, in minor units (0 when nothing moved). Billing-provider subscription events (Stripe, Paddle, Recurly, Chargebee) are stored through this same endpoint logic, so they have the same effects.\n\n## Free trials\n\nA trial never pays commission, and a trial that ends unpaid never claws any back.\n\n| Transition | `action` | Money | Event |\n| --- | --- | --- | --- |\n| first `trialing` state for the account | `trial_started` (`trial_continues` on a repeat) | none | `customer.trial_started` |\n| `trialing` → `active` | `trial_converted` | none on this rail (see below) | `customer.trial_converted` |\n| `trialing` → `cancelled` / `churned` | `trial_expired` | none, and no clawback | `customer.trial_expired` |\n| `paused` with `reason` `trial_ended` (the trial ran out and you locked the account) | none | none | `customer.trial_ended`, once per lapse, plus the partner email while the customer is still in trial |\n\nThe state before a record is the account's previous stored state (same partner, product and environment), so send the `trialing` state when the trial starts. Events need the account resolved to a customer.\n\nCommission on a converted trial comes from the money:\n\n- **Billing connectors.** A trial's $0 invoice (Stripe `subscription_create` at $0, a Paddle $0 checkout transaction, a Chargebee $0 first invoice in trial, a Recurly $0 `purchase` invoice) wins no deal. The referral stays pending and the billing customer and subscription are linked. The first **paid** invoice on that subscription is the sale: a won deal with `isRenewal: false`, even when the provider bills it as a cycle. The delivery log records `trialConverted: true`, and `customer.trial_converted` is emitted. Later invoices are renewals. A subscription event that ends a trial unpaid is noted as `trial: \"expired_unpaid\"` on the delivery log. Providers that say what came before are read directly: Stripe `previous_attributes.status`, Paddle `subscription.activated` and a never-billed cancellation, Chargebee `subscription_activated` and a cancellation with a `trial_end` and no `activated_at`, and Recurly `trial_ends_at`.\n- **Vendor rail.** Report the paid conversion with `POST /api/track/conversion` (the server conversion is what pays). The `active` state alone does not pay.\n\n## How the partner is found\n\nThe partner is resolved in this order. The first match wins:\n\n1. **`orgId`** on the record, when it is inside your program.\n2. A provision in your program whose **returned `id`** (the id your app sent back from the provision call) equals `externalAccountId`.\n3. A provision whose **`account`** equalled `externalAccountId`.\n4. An **external link** `customer` ↔ `account` with that external id, written by a tracked conversion that carried your customer id, by an import with an `accountId` column, or by `POST /api/integrations/links/bulk`.\n\nSteps 2 to 4 take the most recent match. With `productId`, they also match on the product (a link on a connection with no product still matches). The same resolver files usage records.\n\n- You can send your own account id from the start. The id you return from the first provision is matched directly, even though that first provision carried what the caller sent (a domain or the owner's email) as `account`.\n- When `orgId` and the account resolve to different partners, the state is stored under `orgId` and is not linked to the other partner's customer.\n- **A record that resolves to no partner is dropped. It is not stored.** It is counted under `unresolved`, with a note such as `No partner resolved for account acct_123 — send orgId, provision it first, or link it (POST /api/integrations/links/bulk)`. An `orgId` outside your program is also dropped and counted under `unresolved`, with `orgId is not in your program`. Check `notes` on every response.\n\n## Reading it back\n\n`GET /api/subscriptions` (session, `subscription:read`) takes the filters `orgId`, `productId`, `customerId`, `externalAccountId`, `state`, `latestOnly` and `limit` (1 to 200, default 50).\n\n`latestOnly` takes `true`/`false` (or `1`/`0`) and defaults to `false`, the full history.\n\n# Partner sync\n\nA provision tells you about a *customer*. A **partner event** tells you about the *partner itself*. It is sent when a partner starts reselling your product under a white-label or resale arrangement, so you can create its reseller account, apply its brand and invite its admin before its first customer arrives.\n\nThe request is documented as a webhook in this reference, under **Partner event (to your endpoint)**.\n\n## Events\n\n| `event` | Sent when |\n|---|---|\n| `partner.connected` | The partner's relationship with you becomes a reselling one: an active white-label edge, or an active edge with billing mode `resale`. An operator can also send it on demand with `POST /api/partners/{id}/vendor-connect`. |\n| `partner.updated` | The partner still resells, but the edge's kind or billing mode changed, its white-label brand was approved or withdrawn, or a white-label domain was verified or repointed. |\n| `partner.disconnected` | The partner no longer resells. |\n\nOne event is queued for each product your org sells. If an event is still waiting to be delivered, a newer one for the same partner and product replaces it, so a burst of changes is delivered once with the latest state.\n\nA partner event is queued in the **environment of the credential that triggered it**, in the same way as a provision, and it is delivered through the product's connection for that environment. A change made with a test credential, for example `review_whitelabel_profile` called through the integration MCP with a `pos_test_…` key, sends its partner event to your **test** connection (staging) only. That lets you rehearse partner sync without touching live. Changes made in a user session, and changes with no credential behind them, are always **live**, exactly as before.\n\nLive and test events are queued and replaced independently. A pending test event never replaces a live one, and a pending live event never replaces a test one.\n\nPartners on a plain referral or commission edge do not generate partner events.\n\n## Where it is sent\n\nPartner events use the same connection, auth header and signature as provisions. They go to a different URL, chosen in this order:\n\n1. `metadata.urls.partner`\n2. `metadata.partnerUrl` (set by a submitted manifest's `environments.<env>.partner`)\n3. the sibling of a provision URL ending in `/provision`. For example, `https://api.example.com/partnerswatch/provision` gives `…/partnerswatch/partner`.\n\nIf none applies, delivery fails with `REST connection has no partner url (set metadata.urls.partner)`. A partner event is never sent to your provision endpoint.\n\n## The payload\n\n```json\n{\n  \"type\": \"partner\",\n  \"event\": \"partner.connected\",\n  \"version\": 1,\n  \"ref\": \"3b0e…\",\n  \"product\": { \"id\": \"…\", \"name\": \"Example Analytics\" },\n  \"partner\": {\n    \"id\": \"…\",\n    \"name\": \"Acme Consulting\",\n    \"brand\": {\n      \"orgId\": \"…\", \"brandName\": \"Acme Insights\",\n      \"logoUrl\": \"https://cdn.example.com/acme/logo.svg\", \"iconUrl\": \"…\", \"faviconUrl\": \"…\",\n      \"primaryColor\": \"#1e40af\", \"accentColor\": \"#f59e0b\",\n      \"fontFamily\": \"Inter\", \"fontUrl\": \"https://fonts.googleapis.com/css2?family=Inter&display=swap\",\n      \"supportEmail\": \"help@acme.example.com\", \"supportUrl\": \"https://acme.example.com/help\",\n      \"termsUrl\": null, \"privacyUrl\": null, \"billingUrl\": null,\n      \"senderName\": \"Acme Insights\", \"senderEmail\": \"no-reply@acme.example.com\", \"senderDomain\": \"acme.example.com\"\n    },\n    \"relationship\": \"whitelabel\",\n    \"billingMode\": \"resale\",\n    \"adminEmail\": \"owner@acme.example.com\",\n    \"domain\": \"app.acme.example.com\",\n    \"revision\": 1767312000000\n  },\n  \"createdAt\": \"2026-10-02T09:30:00.000Z\"\n}\n```\n\n- **Key the partner's account on `partner.id`**, not on `ref`. `ref` is the delivery's id, which is useful for logs and deduplication.\n- The brand, admin and domain are read **when the event is delivered**, not when it was queued. A retry an hour later carries the current state. `partner.revision` grows with every delivery. Ignore a delivery whose revision is lower than the last one you applied.\n- `brand` is `null` until the partner's white-label profile is approved.\n- `adminEmail` is the partner's first `partner_admin` user, or `null`.\n- `domain` is a hostname the partner has proven it controls (DNS TXT) and wants **you** to serve (purpose `vendor_app`). A hostname pinned to your org wins over an unpinned one. `null` means no proven host, not \"no domain\".\n\n## Responding\n\nReturn 2xx with a JSON object:\n\n- `id` or `externalId`: your reseller account id. It is stored as the partner's link on this connection.\n- `domainVerification`, optional: what the partner must publish before your edge will serve `partner.domain`. It is shown to the partner next to the PartnersWatch check. The fields are `cnameTarget` (or `cname`), `txtHost`, `txtValue` (or `token`), `status`, `reason` and `checkedAt`, all strings.\n\nThe whole JSON response is stored on the event.\n\n## Retries\n\nPartner events retry differently from provisions:\n\n- There are 5 attempts, with delays of 1 minute, 5 minutes, 15 minutes and 1 hour. **No 4xx is treated as final.** Every failure is retried until the attempts run out.\n- A `404`, `502`, `503` or `504` within 24 hours of the event being created counts as \"your endpoint is not deployed yet\". The event is then retried every 5 minutes until that 24-hour window closes, and only after that can it fail.\n- Within each attempt, the same transport retries apply as for provisions: up to 4 sends with the same signature.\n\nOperators see each partner's delivery state at `GET /api/partners/{id}/vendor-status`. They can re-send with `POST /api/partners/{id}/vendor-connect`. Both endpoints need a session.\n\n# Attribution & tracking\n\nThis guide is for a product that already has its own signup and checkout. PartnersWatch does not take over your signup. It records which partner sent a visitor, and you report back when that visitor converts.\n\n## How a referral flows\n\n1. A partner shares a tracking link: `<PartnersWatch API host>/r/<code>`. Partners create these links in PartnersWatch (`/api/tracking/links`). The code is generated unless you pass your own `code` (4 to 40 characters of `A–Z a–z 0–9 - _`, starting with a letter or digit), for example to keep a referral URL you used before. Codes are unique across PartnersWatch; a code already in use answers `409`, a malformed one `422`.\n2. The redirect records a click. It sets the `pos_ref` cookie on the PartnersWatch host (HttpOnly, `SameSite=Lax`, 90 days by default). It then sends a `302` to the link's destination with `?pos_ref=<visitorId>` appended, plus any UTM defaults from the partner's groups. Your destination's own query parameters are never overwritten.\n3. On your site, `pw.js` reads `pos_ref` from the URL and stores it in a **first-party** cookie on your domain.\n4. When the visitor converts, you report it. The best way is from your server (S2S, below). The other options are your billing provider or the browser.\n\nThe cookie and query parameter are named `pos_ref`. If an operator has changed the name, `GET /api/tracking/setup` returns the configured one.\n\n## Install pw.js\n\n`GET /api/tracking/setup` (session, `integration:read`, operators only) returns a publishable key per environment (`pk_live_…`, `pk_test_…`), the script URL and a ready-made snippet:\n\n```html\n<script src=\"https://<PartnersWatch API host>/pw.js\" data-key=\"pk_live_…\" async></script>\n```\n\nOptional attributes: `data-cookie-days` (how long the first-party cookie lasts) and `data-api` (to override the API base). Calls made before the script has loaded can be queued on `window.pw.q` as `[method, ...args]`.\n\nPublishable keys are safe to expose: they can only record sign-ups and unconfirmed conversions. Each one is signed by PartnersWatch, so a made-up or altered key is rejected before anything is looked up.\n\n### Managing publishable keys\n\nEvery program starts with a **default** key per environment. Every snippet installed before issued keys existed embeds it, and it keeps working until you revoke it. You can also issue more keys, for example one per site, so that you can retire one without touching the others. `GET /api/tracking/setup` returns the default key while it is active. Once the default is revoked, it returns your newest active key instead.\n\n| Method | Path | Guard | Does |\n| --- | --- | --- | --- |\n| `GET` | `/api/tracking/publishable-keys?environment=` | `integration:read` | Lists keys. The default key appears as a row with id `default_live` or `default_test` and `isDefault: true`. |\n| `POST` | `/api/tracking/publishable-keys` | `integration:manage` | Issues a key: `{ label, environment? }`. |\n| `DELETE` | `/api/tracking/publishable-keys/{id}` | `integration:manage` | Revokes a key by id, or the default with `default_live` or `default_test`. Revoking twice does nothing. A revoked key cannot be restored. |\n\nThese endpoints take a session or an operator machine credential (see Authentication). Partner orgs are refused. A test credential lists, creates and revokes test keys only; any other key answers `404` to it.\n\nA revoked key's beacons answer `401`. Revocation reaches every API process within about a minute. Issued keys show a `lastUsedAt`, updated at most once a minute; the default key does not track it.\n\n```js\n// After your own signup succeeds. customerKey is YOUR id for the new account.\npw.signup({ customerKey: \"acct_123\", email: \"jane@customer.example.com\" });\n\n// Optional: a browser-side purchase signal. Recorded as UNCONFIRMED and never paid on.\npw.conversion({ externalId: \"order_789\", customerKey: \"acct_123\", amount: 4900, currency: \"USD\" });\n\npw.visitorId(); // the stored visitor id, or null\n\n// The referred visitor's offer (double-sided rewards), or null.\npw.incentive().then(function (i) { if (i) showBanner(i.description); });\n```\n\nEach call resolves to `{ accepted, attributed, reason }`; `pw.signup` also returns `incentive` when the partner's program offers the referred customer one. `reason` is one of `null`, `no_click`, `already_recorded`, `already_attributed`, `unconfirmed`, `test_mode`, `no_visitor` or `no_key`. With a `pk_test_` key, calls are accepted and report whether a click exists, but write nothing.\n\n## Confirm conversions server-side\n\n`POST /api/track/conversion`, with a machine credential that has the `attribution:write` scope:\n\n```json\n{\n  \"conversionKey\": \"order_789\",\n  \"visitorId\": \"the pos_ref value you stored at signup\",\n  \"couponCode\": \"ACME20\",\n  \"customerEmail\": \"jane@customer.example.com\",\n  \"customerName\": \"Jane Doe\",\n  \"amount\": 4900,\n  \"currency\": \"EUR\",\n  \"customerKey\": \"acct_123\",\n  \"externalCustomerId\": \"acct_123\"\n}\n```\n\n- `conversionKey` is required, and it is the idempotency key. Repeating it, within the same environment, returns the existing attribution without changing anything.\n- PartnersWatch looks for the partner in this order: the click `pw.signup` bound to `customerKey`, then the visitor's pending click inside the attribution window (`visitorId`; the latest one, or the first under first-click attribution), then an active `couponCode`. A link beats a coupon. If nothing matches, the response is `404 Attribution not found`, and that conversion was not partner-sourced.\n- `customerKey` is the same id you passed to `pw.signup`. With it you do not need to keep the visitor id yourself. Like the billing connectors, the signup binding outlives the click window, because the signup happened inside it. A test credential only matches test bindings, and `pw.signup` with a `pk_test_` key writes none.\n- Read `visitorId` from the first-party `pos_ref` cookie (or `pw.visitorId()`) at signup and keep it with the account. Your server needs it later.\n- A conversion where `customerEmail` matches the partner's own email is stored as `rejected` (self-referral).\n- `amount` is in minor units. `currency` is an optional ISO 4217 code (upper-cased). It travels with the amount on the `conversion.recorded` event. PartnersWatch never converts between currencies: reports total each currency separately.\n- A live conversion creates or links a customer for the partner and fires `conversion.recorded`. A test-credential conversion is stored with `environment: \"test\"` and has no other effect.\n- `externalCustomerId` is your own customer or account id. If it is already linked to one of the attributed partner's customers, that customer is used. Otherwise, on a live conversion, PartnersWatch links the bound customer to it (external link `customer` ↔ `account`). From then on, subscription-state and usage records that carry only that id find the partner. The link is idempotent and never repointed: an id already linked to another customer is left alone. It needs an active live connection in your program (the product's own when the link names a product, otherwise the newest one), because every link belongs to a connection. Without one, nothing is linked.\n\n## Reverse a conversion\n\n`POST /api/track/conversion/reverse`, with the same `attribution:write` machine credential:\n\n```json\n{ \"conversionKey\": \"order_789\", \"reason\": \"refund\" }\n```\n\n- Name the conversion by `conversionKey` or by `attributionId` (the `id` the conversion returned). Send exactly one.\n- `reason` is `refund`, `chargeback`, `fraud` or `cancelled`.\n- The attribution becomes `reversed`. Commission on the attributed customer's won deals (with that partner, closed since the conversion) is taken back through the same engine path as a billing-provider refund. For `refund`, `chargeback` and `cancelled`, that only happens inside the program's `clawback` rule window, so a program without one keeps paying. `fraud` always reverses.\n- The response is `{ attribution, reversed, reason, clawedBack, deals }`. `deals` lists each deal with `action` `clawed_back`, `outside_clawback_window` or `nothing_accrued` and the `amount` taken back.\n- **Idempotent.** Reversing again answers `200` with `reversed: false` and moves nothing. A conversion that was never confirmed (for example a `rejected` self-referral) answers `422`.\n- **Environment-scoped.** A credential only sees conversions from its own environment. Anything else answers `404`. A live reversal also takes the conversion off the link's and coupon's counters and fires `conversion.reversed` (webhook and playbook event), with `attributionId`, `conversionKey`, `partnerId`, `linkId`, `couponId`, `reason`, `clawedBack` and `environment`. Each clawback also fires `commission.clawed_back`.\n\n## First-click attribution\n\nAttribution is last-click by default: the visitor's newest click inside the window wins. A program can switch to first-click by setting `attributionModel` in the commercial policy, on the operator org (`PATCH /api/organizations/{id}` with `commercialPolicy`, which replaces the whole policy) or on a product to override it for that product's links:\n\n```json\n{ \"commercialPolicy\": { \"attributionModel\": \"first_click\" } }\n```\n\nUnder `first_click`, a visitor who already holds an unexpired click anywhere in the program keeps it: later clicks are still counted, but they credit nobody and do not extend the window. A server-side conversion with only a `visitorId` takes the visitor's oldest pending click. A click recorded under one model keeps that model on its attribution (`model`). Bindings made by `pw.signup` are unchanged.\n\n## Per-program attribution windows\n\nA sub-program (`POST /api/programs`, `PATCH /api/programs/{id}`, `program:manage`) can override the global window and model for its own links:\n\n```json\n{ \"attributionWindowDays\": 30, \"attributionModel\": \"first_click\" }\n```\n\nA partner names the program when creating a link (`POST /api/tracking/links` with `programId`; the partner must be an active member). Clicks on that link expire after the program's window and record its model, and the `/r/:code` cookie's `Max-Age` follows the same window. On landing, `pw.js` calls `GET /api/pw/visit?k=<publishable key>&v=<visitor id>`, which returns `{ attributed, cookieDays, incentive }`, and re-sets the first-party cookie to the remaining window, unless `data-cookie-days` pins it. When a visitor holds clicks from several programs, the oldest wins if it was recorded under `first_click`, otherwise the newest wins. `null` on either field falls back to `ATTRIBUTION_WINDOW_DAYS` and the commercial-policy cascade.\n\n## Double-sided rewards\n\nOn top of the partner's commission, the referred customer can get an incentive. Set `referredIncentive` on a sub-program, or on a commission rule (the most specific active rule wins over the program):\n\n```json\n{ \"referredIncentive\": { \"kind\": \"discount_percent\", \"value\": 20, \"durationMonths\": 3, \"stripeCoupon\": true } }\n```\n\n`kind` is `discount_percent` (value 1–100), `discount_amount` or `account_credit` (value in minor units, `currency` required), or `free_months` (value 1–36). Tracked links return it as `referredIncentive` with a readable `description`, so the partner's share page can show it. The referral widget takes the same object in `config.referredIncentive` (the iframe shows it; `pwr.incentive()` returns it).\n\nPartnersWatch records one grant per referred customer: at `pw.signup` (keyed on `customerKey`), at a confirmed conversion (keyed on `customerKey`, else the conversion key), or when a widget referral converts. Each grant emits `incentive.granted` with `{ grantId, partnerId, programId, ruleId, attributionId, referralId, customerKey, source, kind, value, currency, durationMonths, description, environment, stripeCoupon }`. Apply it in your product, then call `POST /api/incentives/{id}/applied` (`attribution:write`) with `{ \"status\": \"applied\" }`, `failed` or `void`. `GET /api/incentives` lists grants (operators see all, partners their own; filters `status`, `partnerId`, `customerKey`). With `stripeCoupon: true` and a live Stripe connection, a live grant also gets a single-use Stripe promotion code (`couponCode`); account credit is never a coupon. Test-key conversions record test grants and never create coupons.\n\n## Coupons in bulk\n\n`POST /api/tracking/coupons/bulk` (session or machine credential with `coupon:write`, **live** only, because coupons have no environment) takes up to 500 coupons:\n\n```json\n{ \"coupons\": [\n  { \"partnerId\": \"PARTNER_ID\", \"code\": \"ACME20\", \"discountType\": \"percent\", \"discountValue\": 20 }\n] }\n```\n\n`code` is 3 to 40 characters and is the idempotency key. `discountValue` is 0 to 100 for `percent`, minor units for `amount`. `linkId` is optional. A partner's own session uses itself and ignores `partnerId`. The response counts `created`, `existing`, `conflicts` and `failed`, and lists `results` with each item's `index`, `status` (`created`, `exists`, `conflict`, `failed`), the coupon `id` and an `error`. A code the partner already holds answers `exists`. A code held by another partner answers `conflict` and is never reassigned.\n\n## Billing providers instead of S2S\n\nIf you take payments through Stripe, Paddle, Recurly or Chargebee, you can connect the provider instead. Its webhooks go to `POST /api/ingest/{connectionId}`. Put the same `customerKey` you passed to `pw.signup` in the provider's customer or subscription metadata, under `customerKey`, `customer_key` or `pw_customer_key`. Paid invoices then confirm the referral, refunds claw commission back, and subscription changes are recorded as subscription state.\n\n## Known limits\n\n- Last-click and first-click are the only models. There is no multi-touch or position-based split.\n- A reversal claws back whole deals. A partial refund through the API is not supported; use the billing connectors, which note partial refunds without moving money.\n- A revoked publishable key can take up to a minute to stop working on every API process. Revocation is permanent; issue a new key instead of restoring one.\n- The S2S endpoint does not check that `currency` matches what you sent for the same customer before. Send the same currency for a customer each time.\n- UTM parameters on the inbound URL are not captured on the click.\n- `/api/pw/*` accepts calls from any origin that has a valid publishable key.\n\n# Migrating an existing partner program\n\nIf you already run an affiliate, referral or reseller program elsewhere, import it rather than asking partners to sign up again. The importer reads from **PartnerStack** (through its v2 API) or from a **CSV** file. Those are the only two sources.\n\nEvery import endpoint needs `import:manage`, from a session or an operator org's machine credential, and only operators can use them (partners get `403`). Imports write live program data, so creating, previewing and running a job needs a **live** key; a test key can only read jobs and their records.\n\n## The flow\n\n1. **Create a job.** `POST /api/imports` (JSON, up to 4 MB):\n\n```json\n{ \"source\": \"partnerstack\", \"publicKey\": \"pk_…\", \"secretKey\": \"sk_…\",\n  \"objects\": [\"group\", \"partner\", \"customer\", \"deal\", \"reward\"], \"defaultPartnerType\": \"referral\" }\n```\n\n```json\n{ \"source\": \"csv\", \"objectType\": \"partner\",\n  \"csv\": \"Company,Email,Country\\nAcme Consulting,owner@acme.example.com,US\\n\",\n  \"mapping\": { \"name\": \"Company\", \"contactEmail\": \"Email\", \"country\": \"Country\" },\n  \"defaultPartnerType\": \"referral\" }\n```\n\n   PartnerStack keys are stored encrypted and are never returned.\n\n2. **Preview.** `POST /api/imports/{id}/preview` is a dry run. It fetches and maps everything and writes nothing. It returns `counts`, up to 5 mapped `samples` per object, `warnings`, and `alreadyImported` (rows an earlier job already wrote). The preview is **required**: running a job before it has been previewed returns `409`.\n3. **Run.** `POST /api/imports/{id}/run` writes the data and returns the finished job with per-object `created`/`updated`/`skipped`/`failed` stats. The run is **synchronous**, so a large PartnerStack account holds the request open until it finishes.\n4. **Inspect.** `GET /api/imports/{id}/records?objectType=&status=&page=&pageSize=` (page size up to 200) shows each source row's outcome and its error.\n\n## What maps where\n\n| Source | Becomes |\n|---|---|\n| PartnerStack groups | Static partner groups, with memberships |\n| PartnerStack partnerships, CSV `partner` rows | Partners. A partner already in your program with the same contact email is linked, not duplicated. Your plan's partner quota applies. |\n| PartnerStack customers, CSV `customer` rows | Customers on your default pipeline |\n| PartnerStack deals | Deals. They never accrue commission. |\n| PartnerStack rewards | Earnings-ledger entries. Approved rewards become owed balance. Paid rewards become a matched reward/paid-out pair, so history shows without paying twice. Pending and declined rewards are skipped. A later re-run picks them up once they are approved. |\n\nCSV columns:\n\n- `partner` rows: `externalId`, `name`, `contactName`, `contactEmail`, `website`, `country`, `type`, `group`, `linkCode`, `linkUrl`, `couponCode`, `discountType`, `discountValue`\n- `customer` rows: `externalId`, `name`, `company`, `email`, `phone`, `mrr` (major units), `partnerEmail`, `partnerName`, `accountId`\n\n`mapping` maps our field to your column header. An unmapped field falls back to a column with the same name. A customer with no matching partner column goes to `defaultPartnerId`.\n\n## Keeping identities and links\n\n- **`accountId`** (customers) is your product's own id for that customer, the id your app will send on usage and subscription events. Each one is written as an external link `customer` ↔ `account`, so those events find the right partner from day one. PartnerStack customers carry their `customer_key` the same way. Re-runs are idempotent. An id already linked to a different customer is left alone and noted on the row. Linking needs an active live connection in your program; without one the row imports, unlinked, with a note. Outcomes are counted under `accountLink` in the job stats.\n- **`linkCode` + `linkUrl`** (partners) keep a partner's existing referral link: PartnersWatch creates `/r/<linkCode>` pointing at `linkUrl`, so URLs already in circulation keep working. Codes follow the tracking-link rules (4 to 40 characters of `A–Z a–z 0–9 - _`) and are unique across PartnersWatch. A code the partner already owns is skipped on re-run. A code that belongs to someone else is not kept, and the partner row notes it. A code without a URL is skipped with a preview warning. Outcomes are counted under `link`.\n- **`couponCode`** (partners, optional `discountType` + `discountValue`) keeps a partner's existing promo code, so customers who already hold it still attribute. `discountType` is `percent` (the default) or `amount`. `discountValue` is 0 to 100 for percent (`20` or `20%`) and **major units** for amount (`12.50` becomes 1250). With no value the discount is 0, and the code only attributes, while the discount itself stays in your billing. Codes are 3 to 40 characters and unique across PartnersWatch. A code the partner already holds is skipped on re-run. A code that belongs to another partner is never reassigned: the partner still imports and its row notes the clash. An unreadable discount skips the coupon with a preview warning. Outcomes are counted under `coupon`. To add codes without an import, use `POST /api/tracking/coupons/bulk` (see the attribution guide).\n- **PartnerStack** imports carry no coupons: its partnership data has no promo-code field. Bring them over with a CSV or the bulk route.\n\n### Backfilling account ids without an import\n\n`POST /api/integrations/links/bulk` (session or operator machine credential, `integration:manage`) takes up to 500 links per call:\n\n```json\n{ \"links\": [\n  { \"connectionId\": \"CONNECTION_ID\", \"localType\": \"customer\", \"localId\": \"CUSTOMER_ID\",\n    \"externalType\": \"account\", \"externalId\": \"acct_123\" }\n] }\n```\n\nEach link is judged on its own. The response counts `created`, `existing`, `conflicts` and `failed`, and lists `results` with each item's `index`, `status` (`created`, `exists`, `conflict`, `failed`), the link `id` and an `error`. Repeating a call is safe. An external id already mapped to a different local record answers `conflict` and is never repointed. For `customer` ↔ `account` links that check covers your whole program, since that is how usage and subscription ingest resolve accounts. Other links are checked per connection. A connection outside your org, or a customer outside your program, answers `failed`.\n\n## Re-running\n\nEvery written row is keyed on (your org, source, object type, external id). A re-run updates partners and customers in place, and skips deals and reward lines it already wrote. You can run the import again just before cut-over to pick up late changes.\n\n## Known limits\n\n- The only sources are PartnerStack and CSV. CSV carries partners and customers only, not deals or payouts.\n- There is no rollback. Undo mistakes by hand or with another import.\n- Imported history is written as **live** data. Imported customers and deals fire no webhooks or playbooks. Partners are created through the normal partner flow.\n- PartnerStack deal close dates are set to the time of the import. Customer MRR and phone from PartnerStack are not carried over. Customer currency is USD.\n- PartnerStack fetches stop at 100,000 rows per resource and do not back off on rate limits.\n- The importer itself sends no emails. Tell your partners about the move yourself.\n\n# Outbound webhooks\n\nWebhooks notify your systems when something happens in PartnersWatch: a lead arrives, a conversion is recorded, a ticket is assigned, and so on. They are separate from the provisioning rail. Provisions ask your product to *do* something. Webhooks only *tell* you.\n\nThe delivery is documented as a webhook in this reference, under **Webhook delivery (to your endpoint)**.\n\n## Subscribing\n\nUse either of these:\n\n- **Session or live operator key**: `POST /api/webhooks/endpoints` (`webhook:manage`) with `{ \"url\": \"https://hooks.example.com/partnerswatch\", \"eventTypes\": [\"conversion.recorded\", \"lead.created\"], \"active\": true }`. The URL must be `https`. The response includes the endpoint's `secret` **once**.\n- **Machine credential (REST hooks)**: `POST /api/v1/hooks` (`webhook:manage`) with `{ \"url\", \"event\" }`. This is one event per subscription. The credential must also hold the read scope of that event's resource (for example `deal:read` for `deal.*`), otherwise the request fails with `403`. `GET /api/v1/hooks/events` lists the events and whether your credential may subscribe to each. `GET /api/v1/hooks/samples/{event}` returns recent real envelopes, or a placeholder.\n\nThe same credentials manage subscriptions: list, update, delete, `POST /api/webhooks/endpoints/{id}/test` (sends a `webhook.test` event), `GET /api/webhooks/endpoints/{id}/deliveries`, and `POST /api/webhooks/deliveries/{id}/replay`. Endpoints have no environment, so a test key can list and read them (`integration:read`) but not change, test or replay them.\n\n## Which events reach you\n\nAn endpoint receives an event when any of these is true:\n\n- the event belongs to the **endpoint's own org**;\n- the event belongs to a partner in the endpoint org's program, that is, the endpoint's org is the operator the partner's account tree hangs off;\n- the event names the endpoint's org as its program (`payload.programOrgId`).\n\nMost records belong to the partner that owns them, so this is how an operator hears about its partners' deals (`deal.*`), customers (`customer.*`), commissions (`commission.*`), provisions (`provision.*`) and brands (`whitelabel.*`). The partner's own endpoints receive the same events.\n\nTenancy is strict:\n\n- An operator receives events only from partners in its own program, never from another operator's partners.\n- A partner receives only events stamped with its own org. It never receives a sibling partner's events, or its operator's own events.\n- An endpoint gets **one** delivery per event, even when the event qualifies for it more than once (an operator that is both the program and the partner's operator, for example).\n\nThe envelope's `orgId` is always the org that owns the record, which for a partner's event is the partner, not you.\n\n### Provision events\n\n- `provision.created`: a provision was queued.\n- `provision.delivered`: your product accepted it.\n- `provision.failed`: it will not be retried again. That happens when your product rejected it with a final `4xx`, or when all 5 attempts are used up. When a `credits` provision fails, its credits have already been returned to the partner's wallet by the time this event is emitted (see **Provisioning**). A manual retry that fails again emits `provision.failed` again.\n\nAll three events carry the same payload: `{ provisionId, kind, quantity, unit, productId }`. The event's `subjectId` is the customer.\n\n### Brand events\n\n- `whitelabel.submitted`: the partner sent its brand for review.\n- `whitelabel.approved`: the brand (or an edit to a live brand) was approved and is now applied.\n- `whitelabel.withdrawn`: a live brand stopped being served, because the operator archived it or requested changes on the live brand itself. Editing a live brand does **not** withdraw it: the approved version keeps serving until the edit is approved.\n\nThe payload is `{ from, to }`, giving the statuses before and after the change. The `subjectId` is the white-label profile. Approval and withdrawal also send `partner.updated` on the partner sync rail to every vendor the partner resells for, carrying the live brand (`brand: null` once withdrawn).\n\n## The delivery\n\n```http\nPOST /partnerswatch HTTP/1.1\ncontent-type: application/json\nX-PartnerOS-Signature: t=1767312000,v1=5d41402abc4b2a76b9719d911017c592...\nX-PartnerOS-Event: deal.won\nX-PartnerOS-Delivery: 2b7f…\n\n{\"id\":\"…\",\"type\":\"deal.won\",\"subjectType\":\"deal\",\"subjectId\":\"…\",\"orgId\":\"…\",\"actorId\":null,\"payload\":{…},\"createdAt\":\"2026-10-02T09:30:00.000Z\"}\n```\n\n- `id` is the event id. It is the same on every retry and for every endpoint, so **dedupe on it**.\n- `X-PartnerOS-Delivery` identifies this endpoint's delivery row. A replay re-sends the same row.\n- `payload` is specific to the event type.\n\n## Verifying\n\nThe signature is HMAC-SHA256 with the endpoint secret over `` `${t}.${rawBody}` ``. The header format differs from the provisioning rail: it is a single `t=…,v1=…` header.\n\nThe header can carry **more than one `v1`**. After a secret rotation, and until its grace window ends, each delivery is signed with both the new and the previous secret, newest first (the Stripe convention):\n\n```http\nX-PartnerOS-Signature: t=1767312000,v1=<hmac with new secret>,v1=<hmac with previous secret>\n```\n\nAccept the delivery if **any** `v1` matches the secret you hold. Do not parse the header into a map keyed by name, because that keeps only one `v1`.\n\n```js\nimport crypto from \"node:crypto\";\n\nexport function verifyWebhook(rawBody, header, secret, toleranceSec = 300) {\n  const parts = header.split(\",\").map((p) => p.trim().split(\"=\", 2));\n  const t = parts.find(([k]) => k === \"t\")?.[1];\n  const sigs = parts.filter(([k]) => k === \"v1\").map(([, v]) => Buffer.from(v, \"hex\"));\n  if (!t || sigs.length === 0) return false;\n  if (Math.abs(Date.now() / 1000 - Number(t)) > toleranceSec) return false;\n  const expected = crypto.createHmac(\"sha256\", secret).update(`${t}.${rawBody}`).digest();\n  return sigs.some((given) => given.length === expected.length && crypto.timingSafeEqual(given, expected));\n}\n```\n\n```python\nimport hashlib, hmac, time\n\ndef verify_webhook(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:\n    parts = [p.strip().split(\"=\", 1) for p in header.split(\",\") if \"=\" in p]\n    t = next((v for k, v in parts if k == \"t\"), None)\n    sigs = [v for k, v in parts if k == \"v1\"]\n    if not t or not sigs or abs(time.time() - int(t)) > tolerance:\n        return False\n    expected = hmac.new(secret.encode(), f\"{t}.\".encode() + raw_body, hashlib.sha256).hexdigest()\n    return any(hmac.compare_digest(v, expected) for v in sigs)\n```\n\n## Retries\n\n- **Any** non-2xx response or network error is retried. Unlike provisions, a 4xx is not treated as final. There are 5 attempts, with delays of 1 minute, 5 minutes, 15 minutes and 1 hour, and then the delivery is `failed`. The worker runs about every 5 seconds.\n- Within one attempt, a timeout (10 seconds), network error, `5xx` or `429` is retried up to 3 more times, with the same signature.\n- Respond `2xx` quickly and process the event asynchronously.\n\n## Rotating the secret\n\n`POST /api/webhooks/endpoints/{id}/rotate-secret` returns the new `secret` once. The previous secret **keeps signing** for a grace window: body `{ \"graceSeconds\": 3600 }`, default `86400` (24 hours), maximum `604800` (7 days). During the window every delivery carries two signatures, `v1=<new>,v1=<old>`, so a receiver still holding the old secret keeps verifying while you deploy the new one. The endpoint's `previousSecretExpiresAt` shows when the window ends; after it, deliveries carry only the new signature.\n\n- `graceSeconds: 0` retires the old secret at once, with a single signature from then on.\n- Only one previous secret is kept. Rotating again inside a window drops the oldest secret.\n- The integration MCP tool `rotate_webhook_secret` takes the same `graceSeconds`.\n- Replays and retries are signed when they are sent, so they follow the same rule.\n\n## Event types\n\n`GET /api/v1/hooks/events` returns the authoritative list. The groups are:\n\n- application, partner, deal, customer, lead\n- document, subprocessor, compliance, whitelabel (`whitelabel.submitted`, `whitelabel.approved`, `whitelabel.withdrawn`)\n- course, link, conversion, commission, quote, provision, crm, report\n- ticket, survey, health\n- incentive (`incentive.granted`: a referred customer earned the program's incentive; see **Attribution tracking**), kyc (`kyc.status_changed`: `{ partnerId, status, previousStatus }`)\n- location, territory, sales_report, royalty, audit, corrective_action\n- `*.property_changed` for custom properties\n\n# White-label & domains\n\nWhen a partner resells your product under its own brand, PartnersWatch holds the brand and proves who controls which domain. It then passes both to you. Your product applies the brand and serves the partner's domain.\n\n## The partner's brand\n\nPartners edit their white-label profile in PartnersWatch: brand name, logo, square icon, favicon, primary and accent colours, typeface, support and legal URLs, and email sender. An operator then reviews it (`submitted` → `in_review` → `approved` or `changes_requested`). **Only approved brands are ever handed to you.**\n\nApproval takes a snapshot of the brand. That snapshot is what is served everywhere: to you, on the partner's branded hosts, and in branded email. The partner can then edit and re-submit its working copy without the live brand changing or going dark. The edit reaches you only once an operator approves it.\n\nThe typeface is two fields:\n\n- `fontFamily` is one family name. Only letters, digits, spaces and hyphens are allowed, such as `Inter` or `IBM Plex Sans`. Apply it with your own fallback stack.\n- `fontUrl` is an optional stylesheet that loads the font. It must be `https` and hosted on `fonts.googleapis.com` or `fonts.bunny.net`. Other hosts are refused because the stylesheet is injected into the partner's portal, and a stylesheet from anywhere else could restyle the whole page.\n\nYou receive the brand in three ways:\n\n| Where | What |\n|---|---|\n| `partner.brand` on provisions and partner events | Public brand plus `supportEmail`, `supportUrl` (falls back to the partner's website), `termsUrl`, `privacyUrl`, `billingUrl`, `senderName`, `senderEmail`, `senderDomain`. `null` until approved. |\n| `GET /api/v1/partners/{id}/brand` (machine, `partner:read`) | `orgId`, `brandName`, `logoUrl`, `iconUrl` (falls back to `faviconUrl`), `faviconUrl`, `primaryColor`, `accentColor`, `fontFamily`, `fontUrl`. All URLs are absolute. The response is `404` when there is no live brand, or when the partner has no relationship or provision with your org. Both cases look the same. The MCP tool `get_partner_brand` returns the same shape. |\n| `partner.updated` partner event | Sent when a brand (or an edit to it) is approved, when a live brand is withdrawn, or when a white-label domain is verified, repointed, or loses its verification. |\n\nWhen a partner edits an approved profile, its working copy goes back to `draft`, but **nothing changes for you**. The brand endpoint and every payload keep returning the approved snapshot. When the edit is approved, you receive `partner.updated` with the new brand.\n\nA brand stops being served only when an operator archives it, or requests changes on the live brand itself. When that happens, the brand endpoint returns `404`, payloads carry `brand: null`, the operator receives `whitelabel.withdrawn`, and you receive `partner.updated`. If an operator requests changes on a *pending edit*, the edit is rejected and the previously approved brand stays live.\n\nProfiles approved before snapshots existed are served from their current fields. A snapshot is written the first time such a profile is edited or approved again.\n\n## Domains the partner wants you to serve\n\nA partner adds a hostname in PartnersWatch, then proves control by publishing a DNS TXT record at `_partneros.<domain>`. Publishing it at the hostname itself is also accepted. The TXT value is the domain's `verifyToken`, which already includes the `partneros-verify=` prefix. Each domain has a purpose:\n\n- `portal`: PartnersWatch serves its own partner portal on it. You never receive it. The partner points the host at our edge with a CNAME. The target is returned as `cnameTarget` on the domain. It comes from `PUBLIC_EDGE_HOST`, or, when that is unset, from the hostname of `PORTAL_BASE_URL`. It is `null` when neither is something the partner could point DNS at, such as `localhost`.\n- `vendor_app`: **you** serve your product on it. A verified `vendor_app` host travels to you as `partner.domain` on partner events. A host pinned to your org wins over an unpinned one, and a host that fails DNS resolution is held back.\n\nVerifying the name proves the partner controls it. It does not prove the name points at you. If your edge needs its own record before it issues a certificate, return `domainVerification` in your response to the partner event (see *Partner sync*). PartnersWatch shows your instructions to the partner. For a `vendor_app` host, `cnameTarget` on the domain is the CNAME target you returned.\n\nVerification is checked again every day. Each verified domain's TXT record is looked up roughly 24 hours after its last check. The checks are spread out by when each domain was verified, rather than all running at once. The outcome is recorded on the domain as `ownership`, with these fields: `checkedAt`, `ok`, `failures`, `lapsedAt`.\n\n- A single miss counts as a failure, but the domain stays verified.\n- After **3 consecutive misses**, the domain is marked unverified. It stops resolving to the partner's brand, and the TLS gate stops issuing certificates for it. If it is a `vendor_app` host, it stops being sent to you, and you receive a `partner.updated` without it.\n- The domain is never deleted. Re-publishing the record and verifying again restores it.\n\nPartners must therefore keep the `_partneros.<domain>` TXT record published. A token published only on the host itself has to be removed to add the CNAME, and once it is gone the domain lapses.\n\nPartnersWatch also checks each verified domain itself in the background, every few minutes, for DNS, then TLS, then HTTPS. The result (`live`, `no_dns`, `no_cert`, `unreachable`, `http_error`) is shown to the partner and operator, and is what readiness reports use.\n\n## Domain claims on provisions\n\nSeparately, a partner can claim a customer's domain (`POST /api/domains`, verified by DNS TXT or by `https://<domain>/.well-known/partneros-verification.txt`). When an onboard provision names a domain, the payload may carry:\n\n```json\n\"attributes\": {\n  \"domain\": \"shop.customer.example.com\",\n  \"domainVerified\": true,\n  \"domainVerification\": { \"verified\": true, \"method\": \"dns_txt\", \"token\": \"…\", \"checkedAt\": \"2026-09-30T12:00:00.000Z\" }\n}\n```\n\n- `domainVerified` is the caller's own **claim**. Do not trust it on its own.\n- `domainVerification` is what PartnersWatch actually checked. `verified` is `true` only if the check passed within the last 90 days. If the block is absent, nothing was checked. It does not mean the check failed.\n- If you re-check the record yourself, note that `token` is a bare value for domain claims, so the published TXT is `partneros-verify=<token>`. When the stamp comes from a white-label domain instead, `token` already includes the `partneros-verify=` prefix.\n\n## Known limits\n\n- PartnersWatch has no DNS-provider integration. Partners publish records by hand.\n- Domain claims are re-checked daily in the background. A passing check moves `verifiedAt` forward, so the 90-day freshness counts from the last time the record was seen. A miss is recorded in `lastError`, and the claim stays verified. A claim whose last passing check is more than 3 days old, which means 3 daily misses in a row, becomes `failed`. Claims are never deleted.\n- White-label profile and domain endpoints need a session. The only machine-readable brand endpoint is `GET /api/v1/partners/{id}/brand`.\n- When a brand or an edit to it is approved, the operator receives a `whitelabel.approved` webhook. When a live brand is withdrawn by being archived, or by changes being requested on the live brand, the operator receives `whitelabel.withdrawn`. Editing never withdraws. Both events send a `partner.updated` partner event to the vendors the partner resells for. Nothing is sent when a domain is removed.\n- The partner's portal is themed with the live brand, including its typeface. A pending edit is shown only in the brand editor and in the operator's *Live vs pending* review.\n- `senderEmail` is not checked against `senderDomain`, and PartnersWatch does not check SPF or DKIM records.\n\n# Errors, pagination, idempotency & rate limits\n\n## Errors\n\nEvery handled error has the same shape:\n\n```json\n{ \"error\": { \"code\": \"validation_error\", \"message\": \"Request validation failed\", \"details\": [ … ] } }\n```\n\n| Status | `code` | When |\n|---|---|---|\n| 401 | `unauthorized` | Missing, invalid, revoked or expired credential (`Missing bearer token`, `Invalid API key`, `API key has been revoked`, `API key has expired`, `Invalid access token`, `Invalid client credentials`) |\n| 402 | `payment_required` | Your PartnersWatch plan does not include the feature |\n| 403 | `forbidden` | Authenticated but not allowed (`Missing permission: …`, `Missing scope: …`, or a tenancy rule) |\n| 404 | `not_found` | The resource does not exist **or belongs to another tenant**. The two cases are deliberately indistinguishable. |\n| 409 | `conflict` | A business rule refused the write, for example a provision policy violation, `Insufficient credits`, or a duplicate |\n| 409 | `idempotency_in_progress` | A request with the same `Idempotency-Key` is still running (see below) |\n| 422 | `validation_error` | The body, query or params failed schema validation. `details` lists the failing fields. Some business validations also use 422 without `details`. |\n| 422 | `idempotency_key_mismatch` | The `Idempotency-Key` was already used for a different request |\n| 429 | `rate_limited` | Too many requests (see below) |\n| 503 | `service_unavailable` | A dependency, such as an AI provider, is not configured |\n| 500 | `internal_error` | Anything else |\n\nMalformed JSON and some framework-level rejections, such as an oversized body, currently return `500 internal_error` instead of a 4xx. If you get a 500 on a request you built by hand, check that the body is valid JSON before retrying.\n\n## Pagination\n\nList endpoints that paginate take `page` (1 or more, default 1), `pageSize` (1 to 100, default 20) and usually `search`. They return:\n\n```json\n{ \"data\": [ … ], \"page\": 1, \"pageSize\": 20, \"total\": 134, \"totalPages\": 7 }\n```\n\nNot every list paginates. Some return a plain array with a fixed cap, for example usage (500), subscription states (`limit`, up to 200), imports (the last 100) and domain claims (200). Each endpoint's response schema shows which form it uses.\n\n### Cursor pagination\n\nThe lists you are most likely to sync also take a cursor, which is stable while rows are being written:\n\n| List | Form | Ordered by |\n|---|---|---|\n| `GET /api/provisions` | array | `createdAt` |\n| `GET /api/usage` | array | `periodStart` |\n| `GET /api/subscriptions` | array | `effectiveAt` |\n| `GET /api/webhooks/endpoints/{id}/deliveries` | array | `createdAt` |\n| `GET /api/integrations/links` | array | `createdAt` |\n| `GET /api/v1/hooks` | array | `createdAt` |\n| `GET /api/v1/deals`, `customers`, `documents`, `partners`, `leads`, `referrals` | `{ data, … }` | `createdAt` |\n\nPass `limit` (1 to 200) and, after the first page, `cursor`. Rows come newest first, and rows with the same timestamp are ordered by `id`, so each row appears exactly once across the walk.\n\n- For a list that returns an **array**, the next cursor is in the `X-Next-Cursor` header, and a `Link: <…&cursor=…>; rel=\"next\"` header holds the ready-made URL. The last page has neither header.\n- For a list that returns `{ data, … }`, the next cursor is the `nextCursor` field, and it is `null` on the last page. In cursor mode `page` is always 1 and `pageSize` is your `limit`. `total` still counts every matching row.\n\n```bash\ncurl \"$API/api/provisions?status=failed&limit=100\" -H \"Authorization: Bearer $KEY\" -D -\n# x-next-cursor: eyJ0IjoiMjAyNi0xMC0wMlQwOTo...\ncurl \"$API/api/provisions?status=failed&limit=100&cursor=eyJ0IjoiMjAyNi0xMC0wMlQwOTo...\" -H \"Authorization: Bearer $KEY\"\n```\n\nCursors are opaque. Keep the other filters the same while you follow one. A cursor that has been altered or truncated returns `422 validation_error`. A request with neither `limit` nor `cursor` behaves as it always has. `GET /api/subscriptions?latestOnly=true` cannot be combined with a cursor. The SDKs (see *SDKs*) follow cursors for you.\n\n## Idempotency\n\n### The `Idempotency-Key` header\n\nMachine writes accept an optional `Idempotency-Key` header, so a request you retry after a timeout or a dropped connection runs **once**:\n\n- every `POST`, `PUT`, `PATCH` and `DELETE` under `/api/v1`;\n- `POST /api/track/conversion`, `POST /api/usage/ingest`, `POST /api/subscriptions/ingest` and `POST /api/events/ingest`.\n\n```bash\ncurl -X POST \"$PW_API/api/v1/deals\" \\\n  -H \"Authorization: Bearer $PW_KEY\" -H \"Content-Type: application/json\" \\\n  -H \"Idempotency-Key: 4f1c9a52-2b0e-4f7e-9d0a-6f2b7c1e8a33\" \\\n  -d '{ \"name\": \"Acme expansion\", \"amount\": 120000 }'\n```\n\nHow it behaves:\n\n- Use a fresh random value (a UUID is ideal) per logical operation, and send the **same** value on every retry of it. Keys are 1 to 255 characters.\n- Keys are scoped to your org and the credential's environment: the same key from a live and a test key, or from two orgs, never collide.\n- The first request is recorded with a hash of its method, path and body. When it finishes with a `2xx` or `4xx`, the status and JSON body are stored for **24 hours**.\n- A repeat with the same method, path and body gets the stored response back, with the header `Idempotent-Replayed: true`. Nothing is written again. Body key order does not matter.\n- A repeat with a **different** method, path or body answers `422 idempotency_key_mismatch`. Use a new key for a new request.\n- A repeat while the first is still running answers `409 idempotency_in_progress`. Wait briefly and retry with the same key.\n- A `5xx` is not stored. The key is released, so a retry with it runs the request for real.\n- A request rejected before it runs (authentication `401`/`403`, body validation `422`, rate limit `429`) does not use up the key.\n- After 24 hours a key is forgotten and can be reused.\n- Without the header nothing changes.\n\n### Keys in the body\n\nSome writes also dedupe on a key in the body, independently of the header and with no time limit:\n\n| Endpoint | Key | On repeat |\n|---|---|---|\n| `POST /api/usage/ingest` | `records[].externalRef` | Skipped and counted under `duplicates` |\n| `POST /api/subscriptions/ingest` | `records[].externalRef` | Skipped and counted under `duplicates` |\n| `POST /api/track/conversion` | `conversionKey` (per environment) | Returns the existing attribution |\n| Provisions **to you** | `ref` | You dedupe |\n| Webhooks **to you** | envelope `id` | You dedupe |\n\n`externalRef` values are unique across the whole platform, so namespace them. Writes outside the list above that do not take an `Idempotency-Key` (console and session endpoints) are not idempotent. Before retrying one after a timeout, check whether the first call succeeded.\n\n## Rate limits\n\n- Each API process applies a limit of **300 requests per minute**, counted per client IP. A few public endpoints have their own lower limits.\n- Responses carry `x-ratelimit-limit`, `x-ratelimit-remaining` and `x-ratelimit-reset`. A `429` also carries `retry-after`. Back off until then.\n- Counters live in memory in each API process. They are not shared or persisted.\n- Batch where you can. The ingest endpoints take up to 500 records per call.\n\n# Go-live checklist\n\nWork through this list before you point a **live** connection at production. `GET /api/integrations/readiness?productId=<id>&environment=live` (session or operator key, `integration:read`) scores most of it for you, so CI can gate a release on `ready`. Add `&probe=true` to make it call your health URL as well. A test key is always judged on `environment=test`. The integration MCP tools `integration_readiness` and `partner_readiness` return the same reports.\n\n## Your endpoints\n\n- [ ] The provision endpoint verifies `x-partneros-signature` over the raw body, accepts any listed `v1=`, and rejects stale timestamps.\n- [ ] It dedupes on `ref` and handles the same `ref` arriving minutes or days apart.\n- [ ] It returns `{ \"id\": \"<your account id>\" }` on success.\n- [ ] It returns `400`/`422` for input it will never accept, and `5xx`/`429` for transient trouble. Remember that `401`, `403`, `404` and `408` are retried.\n- [ ] It handles each `event` you can receive: `account.created`, `plan.changed`, `credits.granted`, `units.granted`, `feature.changed`, `custom.applied`, `account.suspended`, `account.cancelled`.\n- [ ] If partners resell your product, the partner endpoint (`…/partner`, or `metadata.urls.partner`) handles `partner.connected`, `partner.updated` and `partner.disconnected`, keyed on `partner.id`, and ignores lower `revision`s.\n- [ ] Webhook receivers verify `X-PartnerOS-Signature` and dedupe on the envelope `id`.\n\n## Configuration in PartnersWatch\n\n- [ ] The product is `active`, and the provision policy is set (`allowedKinds`, `maxQuantityPerProvision`, `requirePlanId`).\n- [ ] Every plan you sell has `config.externalPlanCode` set to your own plan code.\n- [ ] There is one active **test** connection (staging URL) and one active **live** connection (production URL). Readiness warns when the live URL looks like staging (`staging`, `sandbox`, `preview`, `localhost`, `ngrok`, …).\n- [ ] Both connections have a signing secret. Readiness flags unsigned ones.\n- [ ] `run_integration_selftest` has passed against the test connection.\n- [ ] A webhook endpoint is subscribed to the events you act on.\n\n## Reporting back\n\n- [ ] Subscription state changes are sent to `POST /api/subscriptions/ingest` with `externalRef`, and you check `notes` for unresolved accounts.\n- [ ] Usage is sent to `POST /api/usage/ingest` with namespaced `externalRef`s, if partners should see it.\n- [ ] Conversions are confirmed server-side (`POST /api/track/conversion`) or through a billing connector, and `pw.js` is on your marketing site and signup flow.\n\n## Credentials\n\n- [ ] Live machine credentials hold only the scopes they need, and they are stored in a secret manager.\n- [ ] You have a rotation plan. For connection signing secrets, rotate, deploy the new secret, and both keep working until the next rotation. API keys (`POST /api/apikeys/{id}/rotate`), OAuth client secrets and webhook secrets rotate with an overlap window (default 24 hours, up to 7 days) during which the old credential keeps working, or a webhook delivery carries both signatures.\n- [ ] Test keys (`pos_test_…`) are not deployed to production.\n\n## After launch\n\n- [ ] Subscribe to `provision.failed`, which fires once a provision is final-failed, or watch `GET /api/provisions?status=failed` and the readiness report's \"Deliveries are landing\" check.\n- [ ] After fixing a cause, re-send failed provisions with `POST /api/provisions/{id}/retry`. A failed `credits` provision has already had its credits refunded to the wallet. A retry charges them again, and is refused with `409` if the wallet cannot cover them.\n\n# Single sign-on & SCIM\n\nAn org can let its people sign in with their own identity provider, and can let that IdP create and remove their logins. Both are set up in **Settings › Single sign-on** by an operator admin (`sso:manage`).\n\n## Sign-in: SAML or OIDC\n\nEach connection belongs to one org and one email domain. On the login page, a person chooses **Sign in with SSO** and enters their work email. `GET /api/auth/sso/resolve?email=…` returns the connection's `loginUrl`, and the browser goes to the IdP from there.\n\n| | SAML 2.0 | OpenID Connect |\n|---|---|---|\n| You enter | IdP SSO URL, entity ID, signing certificate. You can also add an SP signing key. | Issuer URL, client ID, client secret |\n| You give the IdP | ACS URL, SP entity ID (or the metadata URL) | `oidcRedirectUri`: `<api>/api/auth/oidc/{id}/callback` |\n| Flow | SP-initiated, signed assertion required | Authorization code + PKCE (S256), scope `openid email profile` |\n| Identity | `email` attribute (mapped), else a NameID that is an email | `email` claim (or the mapped claim). An `email_verified: false` email is refused. |\n\nFor OIDC, the issuer must serve `/.well-known/openid-configuration`, and the issuer it reports must match the one configured. The client authenticates with `client_secret_basic`. It uses `client_secret_post` only when that is the only method the IdP lists. The ID token is checked against the IdP's JWKS, issuer, audience (and `azp`), expiry, and the nonce sent with the request. State, nonce and the PKCE verifier are kept in a short-lived, encrypted, HttpOnly cookie on the API origin.\n\nBoth protocols then do the same thing:\n\n- **JIT provisioning.** The first time someone signs in, a login is created for them (without a password) and a membership in the connection's org with its `defaultRole`. A person who already has a login keeps it and gains the membership.\n- **`attributeMapping`** maps your IdP's attribute (SAML) or claim (OIDC) names to `email` and `fullName`.\n- **No JWT in a URL.** The browser returns to the console at `login?sso_code=…`, and the SPA trades that code once for a session at `POST /api/auth/sso/exchange`.\n\nCreate a connection with `POST /api/sso/connections`. The body is discriminated by `type`: `\"saml\"` (the default when `type` is left out) or `\"oidc\"`. A `PATCH` can't change a connection's type. Secrets (the SP key and the client secret) are encrypted at rest and never returned. Reads carry `spPrivateKeyPreview` and `oidcClientSecretSet` instead.\n\n## Provisioning: SCIM 2.0\n\nMint a token with `POST /api/sso/scim/tokens` (`{ \"label\": \"Okta\", \"defaultRole\": \"viewer\" }`). The plaintext `scim_…` token is returned once. Only its hash is stored. Give the IdP:\n\n- **Base URL**: `GET /api/sso/scim` returns it as `baseUrl` (`<api>/scim/v2`).\n- **Auth**: HTTP header `Authorization: Bearer scim_…`.\n\n| Endpoint | Supported |\n|---|---|\n| `GET /ServiceProviderConfig`, `/ResourceTypes`, `/Schemas` | Yes |\n| `GET /Users` | `filter=userName eq \"…\"` or `externalId eq \"…\"`, `startIndex`, `count` (max 200) |\n| `GET /Users/{id}`, `POST /Users`, `PUT /Users/{id}` | Yes |\n| `PATCH /Users/{id}` | `add` / `replace` / `remove` of `active`, `userName`, `externalId`, `displayName`, `name`, `name.*`, `emails`, `emails[type eq \"work\"].value`. Works with or without `path`. `\"True\"`/`\"False\"` strings are accepted. Other attributes are ignored. |\n| `DELETE /Users/{id}` | Deprovisions (see below) |\n| `GET /Groups` | Always an empty list. Group push is not supported, and `POST /Groups` returns `501`. |\n\nRequests and responses are `application/scim+json` (`application/json` is accepted too). Errors use the SCIM format: `{ \"schemas\": [\"urn:ietf:params:scim:api:messages:2.0:Error\"], \"status\": \"409\", \"scimType\": \"uniqueness\", \"detail\": \"…\" }`.\n\nA token only ever reaches its own org:\n\n- **Create** makes the login, or links an existing one with the same email, and gives it a membership in the token's org with the token's `defaultRole`. A user's SCIM `id` is the PartnersWatch user id.\n- **Deactivate** (`active: false`, or `DELETE`) removes the membership in **this org only**. The login itself is left alone, as are any memberships it has in other orgs. The resource stays listed with `active: false`, and SSO will not re-add the membership. Reactivating it restores the membership with the role it had.\n- **Name and email changes** are applied to the login only when this org is the only one it belongs to. Otherwise they are recorded on the SCIM resource alone.\n- Every SCIM write lands in the org's audit log, with the token as the actor.\n\n## Known limits\n\n- One connection per email domain, platform-wide.\n- No IdP-initiated OIDC login, no single logout, and no SAML assertion encryption.\n- Groups are not provisioned. Roles come from the token's or the connection's `defaultRole`, and you change them in PartnersWatch.\n- A deactivated SCIM user's existing session stops working on its next request, because every request checks the membership.\n\n# SDKs\n\nThere are two official clients: `@partnerswatch/sdk` for Node.js and `partnerswatch` for Python. Both are thin. They send the same HTTP requests this reference describes, and they also handle the parts every integration needs:\n\n| | Node.js (`@partnerswatch/sdk`) | Python (`partnerswatch`) |\n|---|---|---|\n| Runtime | Node 18.17+, ESM | Python 3.9+, standard library only |\n| Requests | Typed from this OpenAPI document (`openapi-fetch`) | `get` / `post` / `patch` / `put` / `delete`, returning decoded JSON |\n| Auth | API key or OAuth access token, sent as a bearer token | Same |\n| Environment | `pw.environment` from the key prefix, `expectEnvironment` guard | `pw.environment`, `expect_environment` guard |\n| Retries | `429`, `5xx`, timeouts, honouring `Retry-After` | Same |\n| Pagination | `paginate()` / `pages()` / `listAll()` async iterators | `paginate()` / `pages()` / `page()` iterators |\n| Signatures | `constructWebhookEvent`, `verifyProvisionRequest`, … | `construct_webhook_event`, `verify_provision_request`, … |\n\nNeither package is on a public registry yet. Install them from the repository: the Node package is the `packages/sdk-node` workspace, and the Python package installs with `pip install ./packages/sdk-python`.\n\n## Node.js\n\n```ts\nimport { PartnersWatch } from \"@partnerswatch/sdk\";\n\nconst pw = new PartnersWatch({\n  apiKey: process.env.PARTNERSWATCH_API_KEY!,\n  baseUrl: process.env.PARTNERSWATCH_API_URL,\n  expectEnvironment: \"test\",\n});\n\nconst { data: me } = await pw.api.GET(\"/api/v1/me\");\n\nfor await (const p of pw.paginate(\"/api/provisions\", { query: { status: \"failed\" } })) {\n  console.log(p.id, p.lastError);\n}\n```\n\n`pw.api` is a typed `openapi-fetch` client. Every path, parameter, body and response is checked by the compiler. Calls return `{ data, error, response }` and never throw on an HTTP error. `paginate()` accepts only paths that take a `cursor`, and the type of each row is inferred from the path.\n\n## Python\n\n```python\nfrom partnerswatch import PartnersWatch\n\npw = PartnersWatch(os.environ[\"PARTNERSWATCH_API_KEY\"], os.environ[\"PARTNERSWATCH_API_URL\"], expect_environment=\"test\")\n\nme = pw.get(\"/api/v1/me\")\nfor p in pw.paginate(\"/api/provisions\", status=\"failed\"):\n    print(p[\"id\"], p.get(\"lastError\"))\n```\n\nAny non-2xx response raises `PartnersWatchError`, which carries `status`, `code`, `message` and `details`.\n\n## Live and test\n\nBoth clients read the environment from the credential: `pos_test_…` keys are test, `pos_live_…` keys (and legacy `pos_…` keys) are live, and an OAuth access token's `env` claim decides for a token. Set `expectEnvironment` / `expect_environment` so that a test key cannot reach production by mistake, or the reverse. The client then refuses to start. The server enforces the environment either way (see *Authentication*).\n\n## Retries\n\n`GET`, `PUT`, `PATCH` and `DELETE` are retried on `429`, any `5xx` except `501`, timeouts and network errors. By default there are 3 retries, with exponential backoff and jitter from 0.5 s, capped at 30 s. A `Retry-After` header on the response takes precedence.\n\nA `POST` that got a `5xx` or a network error may already have run, so it is retried only when that is safe:\n\n- `POST /api/usage/ingest` and `POST /api/subscriptions/ingest`, which dedupe on `records[].externalRef`.\n- A request you sent with an `Idempotency-Key` header: `idempotencyKey(\"…\")` in Node, `idempotency_key=\"…\"` in Python. Every retry sends the same key and the same body.\n\nA `429` is always retried, because the server refused the request before it ran. The server dedupes on `Idempotency-Key` for 24 hours on `/api/v1` writes, conversions and the usage, subscription and event ingest routes: a retry with the same key and body replays the first response (`Idempotent-Replayed: true`). See *Errors, pagination, idempotency & rate limits*.\n\n## Pagination\n\nThe SDKs follow the cursor lists described in *Errors, pagination, idempotency & rate limits*. They read `X-Next-Cursor` from array lists and `nextCursor` from `{ data, … }` lists, and stop at the last page. The page size defaults to 100. To resume a long sync after a restart, save the cursor of the last page you finished and pass it back as `cursor`.\n\n## Verifying signatures\n\nEach SDK verifies both signed rails exactly as the server signs them:\n\n- **Webhooks**: `X-PartnerOS-Signature: t=<unix>,v1=<hex>`.\n- **Provisions and partner sync**: `x-partneros-signature: v1=<hex>[,v1=<hex>]` plus `x-partneros-timestamp`.\n\nThe signature is HMAC-SHA256 over `<timestamp>.<raw body>`. Each candidate is compared in constant time, and a timestamp more than 5 minutes from your clock is rejected. Pass a list of secrets while you rotate. Any `v1` that matches any secret is accepted. Always verify the raw bytes you received, before any JSON parsing.\n\nBoth SDKs are tested against fixtures generated by the server's own signing code, and the API's test suite fails if those fixtures drift from what the server sends.\n\n## Regenerating the Node types\n\nThe Node types come from this document. After the API changes, run:\n\n```bash\npnpm --filter @partneros/api openapi      # refresh apps/api/openapi.json\npnpm --filter @partnerswatch/sdk generate # refresh packages/sdk-node/src/schema.d.ts\n```\n\n# Moving an established SaaS onto PartnersWatch\n\nThis guide is for a product that already has its own signup, billing and workspaces, and perhaps an existing affiliate or reseller program. It walks through moving the partner program onto PartnersWatch and connecting the product to it, in the order most teams do it. Each phase links to the guide that holds the full contract. Where this page and another guide differ in detail, the other guide wins.\n\nTwo roles appear below:\n\n- **Program admin**: whoever runs partners, pricing and payouts. They work in the admin console at `/admin`.\n- **Your engineers**: they build the endpoints and jobs, or drive the setup from a coding agent over the integration MCP server (`POST /api/mcp/integration`).\n\n## What PartnersWatch does and what you build\n\n| Area | PartnersWatch does | You build |\n|---|---|---|\n| Partners | Partner orgs, relationships (`referral`, `resale`, `whitelabel`, `direct`), agreements, tiers and the partner portal | Nothing |\n| Catalogue | Products, plans, plan codes, credit packs and price books | The plan codes your billing already uses |\n| Provisioning | Queues, signs, delivers and retries provisions, applies each product's provision policy, debits partner wallets for live credits and refunds them on failure | One HTTPS endpoint that verifies the signature, applies the change and returns your account id |\n| Usage and subscription state | Stores both idempotently, links them to the partner's customer, moves commission on churn and refunds | Jobs that push usage records and subscription changes |\n| Attribution | Tracking links (`/r/<code>`), `pw.js`, coupons, self-referral rejection, commission rules | `pw.signup()` on signup, and a server-side conversion when money is real |\n| Billing providers | Stripe, Paddle, Recurly and Chargebee webhooks become conversions, recurring commission and refund clawbacks | Point the provider's webhook at the connection and put the customer key in billing metadata |\n| Reseller partners | Brand review, domain verification and partner events | A partner endpoint that sets up the reseller's workspace and brand, and serving the reseller's domain |\n| Payouts | Ledger, statements and withdrawals | Nothing |\n| Monitoring | Delivery log, retries, readiness reports and outbound webhooks | Alerting on your own endpoints |\n\n## Phase 0: Workspace and test credentials\n\n1. **Create the workspace.** Sign up at [`https://partnerswatch.com/admin/signup`](https://partnerswatch.com/admin/signup) when self-serve signup is open (the page says so up front; otherwise ask PartnersWatch for an invite). Every workspace starts on **Free**. The machine API, API keys, webhooks and OAuth clients need **Scale** ($799/month or $7,990/year, with a 14-day card-required trial started from **Settings › Plan & billing**). White-label, SSO and limits above 500 partners are **Enterprise**: talk to us.\n2. **Invite your admins** to `/admin`.\n3. **Start in the test environment.** There is no separate sandbox host: test and live share one API, and the credential decides. Mint a `pos_test_…` key first, in the admin console or with `POST /api/apikeys` and `\"environment\": \"test\"` (`apikey:manage`). Everything that key writes is test data. Test rows never pay commission or debit wallets. Your console session always works on **live**, so do your rehearsal with test keys rather than by hand.\n4. **Pick scopes per job.** A reporting key needs `usage:ingest`, `subscription:ingest`, `attribution:write` and `event:ingest`. Add `mcp:use` if a coding agent will use the integration MCP server. Give configuration scopes (`integration:manage`, `product:write`, `webhook:manage`, `credit:allocate`, `import:manage`) only to the key that sets things up. Scopes cannot be edited on an existing key: mint a new one, or rotate (see Phase 9).\n\n**Done when** `GET /api/v1/me` with the test key returns your org and the environment is test. See *Authentication & environments* for scopes, OAuth client credentials and the session-or-machine rules.\n\n## Phase 1: Catalogue and plan codes\n\n1. One **product** per thing a partner sells or refers.\n2. One **plan** per price point. A plan has a `model` (`credit`, `seat`, `usage`, `flat` or `wholesale`), one 3-letter `currency`, and `config` with `unitAmount` (minor units), `interval` (`one_time`, `month` or `year`), `includedUnits`, `overageAmount` and `externalPlanCode`.\n3. **Plan codes are the join key.** Set `config.externalPlanCode` to the exact code your billing uses. `plan` provisions then carry it as `planCode`, and the readiness check `plan_codes` flags plans without one.\n4. **One currency per plan.** If you price in several currencies, create one plan per currency.\n5. Optional: **credit packs** if partners pre-buy credits to resell, and **price books** per reseller (wholesale and retail per item, plus the commercial policy: billing modes, seller of record, white-label and custom pricing).\n\n## Phase 2: Provision endpoint and connections\n\nBuild **one endpoint**, for example `POST https://api.example.com/partnerswatch/provision`, that:\n\n1. **verifies the signature**: HMAC-SHA256 with the connection's signing secret over `<x-partneros-timestamp>.<raw body>`, compared in constant time against every `v1=` value in `x-partneros-signature` (there are two while a rotated secret overlaps), and rejects stale timestamps;\n2. optionally checks the bearer token (or custom header) you gave the connection;\n3. **dedupes on `ref`** and applies the change: `account.created`, `plan.changed`, `credits.granted`, `units.granted`, `feature.changed`, `custom.applied`, `account.suspended` or `account.cancelled`;\n4. answers **2xx with `{ \"id\": \"<your account id>\" }`**. PartnersWatch links that id to the customer and sends it back as `account` on every later provision.\n\nAnswer `400` or `422` for input you will never accept, because that ends the provision at once. Answer `5xx` or `429` for transient trouble. `401`, `403`, `404`, `408` and `429` are retried. The SDKs ship `verifyProvisionRequest` / `verify_provision_request` (see *SDKs*).\n\nThen configure it:\n\n5. **Declare the integration in one manifest.** `POST /api/products/{id}/manifest` (or the MCP tool `submit_integration_manifest`) takes per-environment `provision`, `health` and `partner` URLs, `auth` (`bearer` or `header`), `plans` (`code` plus `planId` or `label`), `events`, `webhookUrl`, `contactEmail` and `docsUrl`, and creates or updates the connections, plan codes and webhook from it. Send `dryRun: true` first to see the diff. Submitting a manifest needs a session or a **live** key with `product:write`. You can also create connections one at a time with `POST /api/integrations/connections`, which a test key can do for the test environment.\n6. **Store the signing secrets.** Each connection's `signingSecret` (`whsec_…`) is returned **once**. A connection's environment cannot change, so live and test are always separate connections.\n7. **Set a provision policy** per product: `PUT /api/products/{id}/provision-policy` with `allowedKinds`, `maxQuantityPerProvision` and `requirePlanId`. A provision that breaks it is refused with `409` before anything is debited or sent.\n8. **Rehearse.** Run the MCP tool `run_integration_selftest` with the test key, or create a provision with it (`POST /api/provisions`, scope `credit:allocate`). Both go through your **test** connection.\n\n**Done when** a test provision reaches `delivered`, your account id is stored, and `GET /api/integrations/readiness?productId=…&environment=test` passes `connection`, `signing` and `deliveries`. See *Quickstart* and *Provisioning rail*.\n\n**Estimate (your engineers, estimate only):** 2 to 4 days to build the endpoint, verify signatures, dedupe, and map `plan` and `account.*` events onto your existing internal APIs.\n\n## Phase 3: Usage, subscription state and lifecycle events\n\n**Usage.** `POST /api/usage/ingest` (`usage:ingest`), 1 to 500 records per call, each with `metric`, integer `quantity`, `periodStart`, `periodEnd`, a namespaced `externalRef` and your `externalCustomerId`. `orgId` (the partner) is optional when the account resolves from an earlier provision or link. Every record gets its own `results` entry, so read them. See *Usage reporting*.\n\n**Subscription state.** `POST /api/subscriptions/ingest` (`subscription:ingest`), 1 to 500 records of `externalAccountId`, `state` (`active`, `trialing`, `past_due`, `paused`, `cancelled`, `churned`), and optionally `planCode`, `mrr` (minor units), `currency`, `reason`, `effectiveAt` and `externalRef`.\n\n- A record that resolves to no partner is **dropped, not stored**, and counted under `unresolved` with a note. Send `orgId` for accounts PartnersWatch never provisioned, or link them first (Phase 5).\n- States move commission: `cancelled` or `churned` claws back won deals inside the program's `clawback` rule window, and a refund `reason` is treated as a full refund. A program without a clawback rule never loses commission this way. See *Subscription state*.\n- If you bill through Stripe, Paddle, Recurly or Chargebee, you can connect the provider instead. Its events go through the same logic.\n\n**Lifecycle events** (optional, for playbooks and customer health). `POST /api/events/ingest` (`event:ingest`) resolves the customer by `customerId`, then `externalCustomerId`, then `customerEmail`. An event for a customer that does not resolve answers `422` (`customer not resolved`). It will never succeed on retry, so log and drop it. Use the canonical onboarding types (`invitation.sent`, `invitation.delivered`, `invitation.opened`, `invitation.clicked`, `invitation.bounced`, `invitation.expired`, `invitation.accepted`, `user.signed_in`, `customer.activated`) so partners can follow each customer's onboarding. See *Lifecycle events*.\n\nAll three ingest routes accept an `Idempotency-Key` header, and usage and subscription records also dedupe on `externalRef`. A rerun of the same batch only adds to `duplicates`. See *Errors, pagination, idempotency & rate limits*.\n\n**Estimate (your engineers, estimate only):** 2 to 3 days if your metering already rolls up per account per day. Add about a week if it has to be built.\n\n## Phase 4: Attribution with your existing signup\n\n1. Partners share `https://partnerswatch.com/r/<code>`. The redirect records the click and appends `?pos_ref=<visitorId>` to your destination URL.\n2. Add `pw.js` to your marketing site and app. The publishable keys (`pk_live_…`, `pk_test_…`) and the snippet come from the admin console or `GET /api/tracking/setup`. You can issue one key per site and revoke them independently.\n   ```html\n   <script src=\"https://partnerswatch.com/pw.js\" data-key=\"pk_test_…\" async></script>\n   ```\n3. **At signup**, call `pw.signup({ customerKey: \"<your account id>\", email })`. This binds the click to your account.\n4. **When money is real**, confirm it from your server: `POST /api/track/conversion` (`attribution:write`) with a unique `conversionKey`, the same `customerKey`, `amount` in minor units, an optional ISO 4217 `currency`, and your `externalCustomerId`. Browser `pw.conversion()` calls are recorded as unconfirmed and never paid. A `404 Attribution not found` means the conversion was not partner-sourced; nothing was written. Refunds and chargebacks go to `POST /api/track/conversion/reverse`.\n5. With a supported billing provider, put the same key in the customer's billing metadata (`customerKey`, `customer_key` or `pw_customer_key`) and paid invoices attribute without a separate call.\n\n**Done when**, in test, a click followed by a signup and a conversion attributes to the partner, a self-referral is stored as `rejected`, and a coupon-only conversion attributes. See *Attribution & tracking*.\n\n**Estimate (your engineers, estimate only):** 1 to 3 days.\n\n## Phase 5: Migrating partners, customers and referral links\n\n- **Import the program.** `/api/imports` reads PartnerStack (groups, partners, customers, deals, rewards) or CSV (partners and customers). The steps are create, `preview` (required, a dry run), `run`, then inspect `records`. Re-runs are idempotent, imported deals never accrue commission again, and approved or paid rewards land in the ledger as history. Imports write live data, so they need a session or a live key with `import:manage`.\n- **Keep existing referral URLs.** CSV partner rows take `linkCode` + `linkUrl`, which recreates `/r/<linkCode>` pointing at your destination, and `couponCode` with an optional discount, which keeps promo codes attributing. Outside an import, `POST /api/tracking/links` accepts your own `code`, and `POST /api/tracking/coupons/bulk` (`coupon:write`, live) takes up to 500 coupons per call. PartnerStack imports carry no coupons, so bring those over with CSV or the bulk route.\n- **Keep account ids.** A CSV customer's `accountId` (or a PartnerStack `customer_key`) is written as a `customer` ↔ `account` link, so usage and subscription records for that account find the right partner from day one. To backfill links without an import, use `POST /api/integrations/links/bulk` (`integration:manage`, up to 500 per call).\n- **Add partners from code** with `POST /api/v1/partners` (`partner:write`), or invite them after the import. The importer sends no email, so tell partners about the move yourself.\n\n**Done when** partner counts and balances reconcile with the old system, a sample of legacy referral URLs and codes still attribute, and partners know about the move. See *Migrating an existing partner program*.\n\n**Estimate (your engineers, estimate only):** 0.5 to 1 day of engineering. The calendar time is usually driven by data cleanup.\n\n## Phase 6: Reseller and white-label partners\n\n1. Give resellers a `whitelabel` relationship, or an edge with billing mode `resale`. Only reselling partners generate **partner events**. Plain referral and commission partners never do.\n2. Resellers submit a **brand profile** (name, logo, square icon, favicon, colours, typeface, support and legal URLs, email sender). Your program admin reviews it, and only the approved snapshot is ever sent to you. You can also read it with `GET /api/v1/partners/{id}/brand` (`partner:read`).\n3. Build a **partner endpoint** (the manifest's `partner` URL, or by default the sibling `…/partner` of your `…/provision` URL). It receives `partner.connected`, `partner.updated` and `partner.disconnected`, signed like provisions. Key the reseller's workspace on `partner.id`, ignore deliveries with a lower `revision`, and return `{ \"id\": \"<your reseller id>\" }`. Return a `domainVerification` block if your edge needs its own DNS record before it can serve the partner's domain.\n4. **Domains.** The reseller adds a `vendor_app` domain in PartnersWatch and proves control with a TXT record at `_partneros.<host>`. The verified host travels to you as `partner.domain`. You point it at your app and serve TLS for it.\n5. **Rehearse in test.** A partner event is queued in the environment of the credential that triggered it, so a brand review done with a `pos_test_…` key over the integration MCP server reaches only your test connection. Changes made in the console are live.\n\n**Done when**, for one pilot reseller, the brand is approved, the domain is verified, `partner.connected` was delivered with your reseller id stored, their customers load your app on their domain with their brand, and `GET /api/partners/{id}/readiness` shows no blockers. See *Partner sync* and *White-label & domains*.\n\n**Estimate (your engineers, estimate only):** 3 to 5 days if your product already has multi-brand workspaces and custom domains. Several weeks if it does not.\n\n## Phase 7: Single sign-on and SCIM\n\nOn Enterprise, your staff (and, if you want, partners) can sign in to PartnersWatch through your identity provider with **SAML 2.0 or OpenID Connect**, one connection per email domain, with users created just in time. **SCIM 2.0** lets the IdP create and deactivate logins. Both are set up in **Settings › Single sign-on** (`sso:manage`). PartnersWatch is not an identity provider for your own app. See *Single sign-on & SCIM*.\n\n**Estimate (estimate only):** about half a day of IdP configuration.\n\n## Phase 8: Going live\n\n1. Create the **live** connection with its own signing secret (or declare `environments.live` in the manifest) and store the secret in your secret manager.\n2. Mint live keys with only the scopes each job needs. Never deploy a `pos_test_…` key to production, and set `expectEnvironment` in the SDKs so a wrong key refuses to start.\n3. Switch `pw.js` to the **live** publishable key.\n4. Subscribe a webhook endpoint to the events you act on, for example `provision.failed` and `conversion.recorded`, and verify `X-PartnerOS-Signature` on every delivery.\n5. Run `GET /api/integrations/readiness?productId=…&environment=live&probe=true` with a live key until `ready` is `true`, and gate your release on it in CI.\n6. Send one low-value live provision end to end.\n\nWork through the *Go-live checklist* for the full list.\n\n## Phase 9: Running it\n\n- **Deliveries.** `GET /api/provisions?status=failed` lists provisions that will not be retried, with your endpoint's stored `response` and `lastError`. Lists you sync take a `cursor` (see *Errors, pagination, idempotency & rate limits*). After fixing the cause, re-send with `POST /api/provisions/{id}/retry`.\n- **Failure alerts.** `provision.failed` is emitted once a provision is final-failed, to both the partner's and your webhook endpoints. A failed `credits` provision has already been refunded to the partner's wallet by then.\n- **Readiness from CI.** The integration REST surface, readiness included, takes an operator machine key, so CI can call `GET /api/integrations/readiness` and `GET /api/partners/{id}/readiness` directly. The MCP tools `integration_readiness` and `partner_readiness` return the same reports.\n- **Retries from your side.** Send an `Idempotency-Key` on `/api/v1` writes, conversions and the ingest routes, so a timed-out request can be retried safely. The SDKs retry only when it is safe.\n- **Rotation without downtime:**\n  - API keys: `POST /api/apikeys/{id}/rotate` mints a replacement and keeps the old key working for `graceSeconds` (default 24 hours, up to 7 days).\n  - Webhook secrets: `POST /api/webhooks/endpoints/{id}/rotate-secret` with `graceSeconds`. During the window every delivery carries two signatures, `v1=<new>,v1=<old>`, so accept any `v1` that matches.\n  - Connection signing secrets: `POST /api/integrations/connections/{id}/rotate-signing-secret`. The previous secret keeps signing until the next rotation, so accept both `v1=` values.\n  - OAuth client secrets: `POST /api/oauth/clients/{id}/rotate-secret` with `graceSeconds`.\n- **SDKs.** `@partnerswatch/sdk` (Node.js) and `partnerswatch` (Python) handle auth, retries, cursor pagination and signature verification for both signed rails. See *SDKs*.\n\n## Typical timeline (estimate only)\n\nA focused team usually goes live with phases 0 to 4 in **three to four weeks** of calendar time, then adds migration and reseller partners (phases 5 and 6). Most of the engineering is in phases 2 and 3; the rest is mostly decisions about pricing, data and partner communication. These figures are estimates, not commitments.\n\n# Programs, payouts, KYC and the partner finder\n\nThis guide covers program settings (visibility, invites, attribution window, referred-customer incentive), paying partners in several currencies and by bank transfer or check, identity checks before payout, and the AI partner finder. The tracking side of double-sided rewards (`pw.incentive()`, `incentive.granted`) is in **Attribution tracking**.\n\n## Programs\n\nA program groups partners under shared terms. Create one with `POST /api/programs` or update it with `PATCH /api/programs/{id}` (`program:manage`). The settings added here are:\n\n| Field | Default | Meaning |\n|---|---|---|\n| `visibility` | `public` | `public` programs are listed to partners and they can join on their own. `invite_only` programs are hidden and need an invite. |\n| `attributionWindowDays` | none | Click window for links in this program. When unset, the org-wide window applies. |\n| `attributionModel` | none | `first_click` or `last_click` for links in this program. When unset, the product or org model applies. |\n| `referredIncentive` | none | What the referred customer gets (see below). |\n| `requireKyc` | `false` | Members must pass identity verification before they can be paid. |\n\nPartners see the programs they can join with `GET /api/programs/available` and join a public one with `POST /api/programs/{id}/join`. An invite-only program returns `404` to both, so it stays hidden.\n\n### Invites\n\n- `POST /api/programs/{id}/invites` creates an invite: `{ label?, email?, maxUses?, expiresInDays? }`. The response includes the `token` and a ready-made `url` (`/programs/join/<token>` in the partner portal).\n- `GET /api/programs/{id}/invites` lists them with their `state` (`active`, `exhausted`, `expired`, `revoked`).\n- `DELETE /api/programs/{id}/invites/{inviteId}` revokes one. Revoking is final.\n- `GET /api/public/program-invites/{token}` is public. It returns the program name and `valid`, so a landing page can show what the partner is joining.\n- `POST /api/programs/invites/{token}/accept` (a signed-in partner) joins the program. An invite with an `email` admits only a partner user with that email. An invite fails once it is revoked, expired or out of uses.\n\nThe partner application form can also carry an invite token. Approving that application adds the partner to the invited program.\n\n### Attribution per program\n\nA tracking link may name a `programId` (`POST /api/tracking/links`). The partner must be an active member of that program, otherwise the request fails with `422`. A click on that link:\n\n- sets the tracking cookie for the program's window;\n- stores the program's window and model on the attribution, so a later settings change does not alter clicks that already happened.\n\nWith `first_click`, a later click on another partner's link does not take the credit. `pw.js` reads the window from `GET /api/pw/visit` and keeps its first-party cookie in step.\n\n### Referred-customer incentive\n\n`referredIncentive` is one of:\n\n- `{ kind: \"discount_percent\", value: 1-100, durationMonths? }`\n- `{ kind: \"discount_amount\", value, currency, durationMonths? }`\n- `{ kind: \"account_credit\", value, currency }`\n- `{ kind: \"trial_extension\", value: days }`\n- `{ kind: \"custom\", description }`\n\nAmounts are in minor units. Any kind can also take `description` (the text shown to customers) and `stripeCoupon: true`. With `stripeCoupon: true` and a Stripe connection, each grant is issued as a single-use promotion code.\n\nA commission rule can set its own `referredIncentive`, which overrides the program's for the partners it covers. The resolved offer appears on the link (`referredIncentive`), on the referral widget and through `pw.incentive()`. Each referred customer gets it **once** (live environment): on signup through `pw.signup()`, on the first confirmed conversion, or when a referral converts. List grants with `GET /api/incentives` and confirm them with `POST /api/incentives/{id}/applied` (session or operator machine key with `attribution:read` / `attribution:write`).\n\n## Multi-currency payouts\n\nPartners hold one wallet per currency. Commission is credited in the conversion's currency.\n\n- `GET /api/payouts/balances` lists every wallet.\n- `GET /api/payouts/balance?currency=eur` and `GET /api/payouts/ledger?currency=eur` read one wallet. Without `currency`, they read the default currency.\n- `POST /api/payouts/withdrawals` takes `currency` and draws only on that wallet.\n- Payout batches run per currency, and each batch releases through its own currency's wallet.\n\nWithdrawal events (`withdrawal.requested`, `approved`, `paid`, `rejected`, `canceled`, `failed`) all carry `amount` and `currency`.\n\n## Bank transfer, SEPA, wire and check\n\nA partner adds a payout method with `POST /api/payouts/methods`:\n\n- `{ provider: \"bank_transfer\", bank: { scheme, accountHolder, ... } }`\n- `{ provider: \"check\", bank: { scheme: \"check\", accountHolder, addressLine1, city, postalCode?, country } }`\n\nThe `scheme` field sets the bank fields that are required:\n\n| `scheme` | Required |\n|---|---|\n| `iban` (SEPA) | `iban` (`bic` optional) |\n| `ach` | `accountNumber`, `routingNumber` |\n| `swift` (wire) | `accountNumber` or `iban`, plus `swiftCode` |\n| `check` | `addressLine1`, `city`, `country` |\n\nBank details are encrypted at rest. Every response shows only a masked summary (for example `DE89 •••• 3000`). The full details are decrypted only to build the bank export.\n\nHow a bank or check withdrawal is paid out:\n\n- **With Wise connected:** after approval, the payout worker sends `bank_transfer` withdrawals through Wise.\n- **Without Wise (the manual rail):** the withdrawal stays `approved` until someone marks it paid.\n  1. Export it. `POST /api/payouts/bank-export` (`payout:approve`) takes `{ format: \"csv\" | \"sepa\", currency?, withdrawalIds? }` and returns `{ filename, contentType, content, count, total, skipped }`. `sepa` is an ISO 20022 `pain.001.001.03` credit-transfer file for EUR IBAN payouts. It needs the debtor account set in `PUT /api/payouts/settings` (`sepaDebtorName`, `sepaDebtorIban`, `sepaDebtorBic`). Withdrawals that cannot go in the file are listed in `skipped` with a reason.\n  2. Upload the file to your bank.\n  3. Call `POST /api/payouts/withdrawals/{id}/mark-paid` with `{ reference? }`. It emits `withdrawal.paid`.\n\n## Identity verification (KYC)\n\nIdentity checks go through a provider port. The shipped adapter is **Stripe Identity**, which uses the operator's Stripe connection. Without a Stripe connection, the KYC endpoints return `503`.\n\n| Endpoint | Who | Purpose |\n|---|---|---|\n| `GET /api/kyc/me` | Partner | Shows the partner's verification status: `unverified`, `pending`, `requires_input`, `verified` or `canceled`. |\n| `POST /api/kyc/sessions` | Partner | Starts a verification and returns a hosted `url` to send the partner to. |\n| `GET /api/kyc/partners` | Operator | Lists the status of each partner. |\n| `PUT /api/kyc/partners/{partnerId}` | Operator | Records a manual decision. |\n| `POST /api/kyc/webhooks/stripe` | Stripe | Receives `identity.verification_session.*` events. Point Stripe's webhook here. The payload only names the session, which PartnersWatch re-reads from Stripe before trusting it. |\n\nEvery status change emits `kyc.status_changed` (`{ partnerId, status, previousStatus }`).\n\n`requireKyc` can be set org-wide with `PUT /api/payouts/settings`, or per program. While it is on, a partner who is not `verified` gets `409` on withdrawal requests, and payout batches skip that partner with a reason.\n\n## AI partner finder\n\nThe finder searches the web for candidate partners that match a plain-language description. It ranks them with AI and saves the results, and each result can be added as a recruiting prospect.\n\n| Env var | Values |\n|---|---|\n| `FINDER_SEARCH_PROVIDER` | `brave` or `serper` |\n| `FINDER_SEARCH_API_KEY` | that provider's API key |\n\nUntil both are set, searching returns `503`.\n\n- `GET /api/finder/credits` returns `{ allowance, used, remaining, periodStart, periodEnd, configured, provider }`. Each search costs one credit. Credits reset on the first of each UTC month and do not roll over. The monthly allowance is 3 on Starter, 50 on Growth and 500 on Enterprise. Out of credits, a search returns `402`.\n- `POST /api/finder/searches` (`recruit:manage`) takes `{ description, limit? }` and runs one web search. For each new domain it reads, at most once, that site's public homepage (title, description and contact link), with a 5-second timeout and a size cap. Private and internal addresses are never fetched. The search then ranks the candidates and saves the search. Domains already in your prospects, and social or marketplace sites, are skipped.\n- `GET /api/finder/searches` and `GET /api/finder/searches/{id}` return saved searches and their candidates.\n- `POST /api/finder/candidates/{id}/prospect` adds a candidate to recruiting prospects (source `finder`). Calling it again returns the same prospect.\n\nIf the search provider fails, the search is saved as `failed`, no credit is charged, and the call returns `503`. If AI is unavailable, candidates are ranked by keyword match instead.\n\n# Privacy: data export and erasure\n\nPartnersWatch answers GDPR data-subject requests. A signed-in person can download a copy of their own data or erase their own account. An operator admin can erase a partner's contact person or a customer contact inside their own program.\n\nErasure **anonymises** rows instead of deleting them. Names and emails become placeholders (`Erased …`, `erased+…@erased.invalid`), and phone numbers, addresses and free-text personal fields are cleared. Deals, commissions, ledger entries, invoices, payouts and e-signature evidence keep their rows, ids and amounts, so balances still add up. The hash-chained audit log is never rewritten. Each erasure appends a new audit entry (`privacy.*`) that lists the cleared columns but never the erased values, and `GET /api/audit/verify` still passes.\n\n## Export my data\n\n`GET /api/privacy/me/export` (permission `privacy:self`, a signed-in person rather than a machine credential) answers a JSON attachment in the format `partnerswatch.personal-data.v1`. It contains:\n\n- `profile`: the account. Password hashes and secrets are never included.\n- `memberships`: each org you belong to, with your role.\n- `partnerRecords`: the organizations and partner records you own or are the named contact of.\n- `consents`: directory inquiries (with their consent timestamp), community memberships, and e-signature events.\n- `activity`: activities, deals, leads, tickets and ticket messages you authored, your assistant conversations, and your audit-log entries. Each section holds at most the newest 1000 rows.\n\n## Erase my account\n\n`POST /api/privacy/me/erase` with `{ \"confirmEmail\": \"<your sign-in email>\" }` (`privacy:self`). This:\n\n- anonymises the account and deactivates it, which ends every open session at once;\n- removes its memberships, SCIM and chat identities, and assistant chat history;\n- anonymises your community profiles, your directory inquiries, the contact fields of your own orgs that name you, and activity recipients addressed to you.\n\nThe request is refused with `409` while you are the only admin of an organization that still has other members. Make someone else an admin first.\n\n## Erase a customer contact or partner contact\n\nBoth need `privacy:erase` (operator admins), and both are scoped to the caller's program. Another operator's records answer `404`.\n\n- `POST /api/privacy/customers/{id}/erase` anonymises the customer's name and email and clears their phone and notes. It also clears activity recipients, survey comments and contact emails, referral emails, and community profiles that point at the customer. The customer's company, status, MRR, subscriptions and money stay.\n- `POST /api/privacy/partners/{id}/erase` anonymises the partner org's contact name and email and clears its signatory, signatory title, address and notes. It does the same on the partner record and on activity recipients addressed to the old contact. Only operator staff can call it. The org's name, memberships and money stay. To remove a partner user's login, that user erases their own account.\n\nEach erasure returns `{ subjectType, subjectId, erasedAt, cleared[], retained[] }`.\n\n# One-click Stripe connect\n\nAn operator can connect their Stripe account with Stripe Connect OAuth (standard accounts) instead of pasting a webhook secret. PartnersWatch stores the account's tokens encrypted, creates the webhook endpoint on that account, and keeps the endpoint's signing secret. Payments then attribute to partners and accrue commission exactly as they do on a pasted-key Stripe connection.\n\nThe pasted-key path (`POST /api/integrations/connections` with `provider: \"stripe\"` and `webhookSecret`) still works and is unchanged.\n\n## Enabling it on a deployment\n\nSet `STRIPE_CONNECT_CLIENT_ID` (your platform's `ca_…` id from Stripe → Settings → Connect) next to `STRIPE_SECRET_KEY`, the platform secret that trades the code. In the Connect settings, register this redirect URI:\n\n```\n{PUBLIC_API_URL}/api/integrations/stripe/connect/callback\n```\n\nUntil both values are set, `GET /api/integrations/stripe/connect` answers `enabled: false`, the console hides the button, and `start` / `complete` answer `503`.\n\n## Flow\n\n1. `POST /api/integrations/stripe/connect/start` (signed-in operator, `integration:manage`; optional `label`, `productId`) answers `{ url, expiresAt }`. `url` is `https://connect.stripe.com/oauth/authorize?response_type=code&client_id=…&scope=read_write&state=…`. The state is HMAC-signed, expires after 10 minutes, and is bound to your org **and** your user.\n2. Stripe sends the browser to the public `GET /api/integrations/stripe/connect/callback`. This endpoint changes nothing. It checks the state signature and forwards the browser (`303`) to the console at `/integrations/stripe/callback`, carrying `code` and `state`, or `error`.\n3. The console, signed in as the same user, posts `{ code, state }` to `POST /api/integrations/stripe/connect/complete`. The API refuses a state from another user or org (`403`), an expired, forged or already-used state (`401`), and a partner or machine credential (`403`). It then trades the code at `POST https://connect.stripe.com/oauth/token` and stores the tokens encrypted. Last, it creates a webhook endpoint on the connected account that points at `/api/ingest/{connectionId}` and subscribes it to the same events the pasted-key setup lists.\n\nThe response reports `webhookConfigured`. If Stripe refused to create the endpoint, the connection is kept, `webhookError` explains why, and you can add the endpoint by hand from the delivery log. The connection's environment follows the account's `livemode`. Reconnecting the same Stripe account refreshes the tokens on its existing connection rather than adding a second one, so a payment is never paid twice.\n\n## Disconnecting\n\n`POST /api/integrations/stripe/connect/{id}/disconnect` deletes the webhook endpoint, calls `POST https://connect.stripe.com/oauth/deauthorize`, and removes the connection. `DELETE /api/integrations/connections/{id}` on a one-click connection does the same. If Stripe is unreachable or answers `5xx`, you get `503` and the connection is kept, so you can retry. A `4xx` from Stripe means the access was already revoked on Stripe's side, and the connection is removed anyway. Commissions already earned are never touched.\n\n# Partner mail\n\nWhen a partner resells your product under their own brand, the email your product sends their customers should come from the partner too: their name, their domain, signed so inboxes trust it. The partner mail rail does that with one integration on your side. You send every message through `POST /api/mail/send`. PartnersWatch works out which partner it belongs to and sends it from that partner's verified address. If the partner hasn't finished setting up, it goes out from your own sender instead.\n\nYou never handle a partner's keys or DNS. PartnersWatch generates the DKIM key, shows the partner the records to publish, and checks DNS itself.\n\n## How a partner's sender gets set up\n\n1. The partner opens **Settings → Domains & email → Email sender** in their portal (or you open **White-label → Mail senders** in the admin and pick the partner) and enters a sender name, an address on their own domain, and a reply-to address.\n2. PartnersWatch generates a 2048-bit RSA DKIM key under a selector named `pw<yyyymm>`, for example `pw202610`. The private key is stored encrypted and is never shown or returned to anyone.\n3. The partner gets three TXT records:\n   - **DKIM** (required) at `<selector>._domainkey.<domain>`, value `v=DKIM1; k=rsa; p=…`.\n   - **SPF** (recommended) at the domain itself: `v=spf1 include:<relay> ~all`. A domain can only have one SPF record, so a partner who already has one adds the `include:` to it.\n   - **DMARC** (recommended) at `_dmarc.<domain>`: `v=DMARC1; p=none; adkim=r; aspf=r`. A partner who already publishes a stricter policy keeps theirs.\n4. The partner publishes them and presses **Verify**. PartnersWatch looks the records up. Once the DKIM key it generated is found, the sender is `verified`.\n\nWhen the relay is Amazon SES, there is one more step and nobody has to do it by hand. SES only sends from domains it has verified itself, so as soon as PartnersWatch has seen the DKIM record it registers the partner's domain with SES using the same key and selector. SES verifies it from the record the partner already published, usually within minutes. Until it has, the sender stays `pending` with a note saying so, and mail goes out from your sender. A domain that is already in SES and wasn't registered by PartnersWatch is used as it is and never changed.\n\nMail goes out as the partner only when **both** of these are true: the sender is `verified` and the partner's brand is approved. Changing only the name or reply-to keeps the verification. A new domain, or a key rotation, starts it over under a new selector.\n\nPartnersWatch re-checks DNS on its own: verified senders once a day, pending or failed ones every hour. A verified sender has to miss the DKIM record on three checks in a row before it is marked `failed` and mail falls back to your sender. A lookup that can't reach DNS doesn't count as a miss.\n\n### Partners who bring their own key\n\nThe older bring-your-own path still works. A partner who stores their own DKIM private key (`POST /api/whitelabel/email-secret`, PEM) with a selector and domain can press **Verify** on the same card. PartnersWatch checks the public half of that key in DNS, and from then on it is handled like a managed sender. Storing a new key puts it back to pending until DNS is checked again.\n\n### Sender endpoints\n\n| Who | Endpoint | Permission |\n| --- | --- | --- |\n| The org's own sender | `GET` / `PUT /api/whitelabel/mail-sender`, `POST /api/whitelabel/mail-sender/verify` | `whitelabel:read` / `whitelabel:write` |\n| Operator, every partner | `GET /api/whitelabel/admin/mail-senders` | `whitelabel:manage` |\n| Operator, one partner | `GET` / `PUT /api/whitelabel/admin/{orgId}/mail-sender`, `POST …/verify` | `whitelabel:manage` |\n\nEvery response is the same `MailSender` shape: the identity, `status` (`pending | verified | failed`), `lastCheckedAt`, `verifiedAt`, `lastError`, the `records` with what the last lookup saw for each (`found | missing | mismatch | unchecked`), and `active` with an `inactiveReason` written for the partner to act on.\n\n## Sending\n\nCreate an API key with the `mail:send` scope (Settings → Integrations → API access, or the `create_api_key` MCP tool). Only an operator org's key can hold it.\n\n```http\nPOST /api/mail/send\nAuthorization: Bearer pos_live_…\nContent-Type: application/json\n\n{\n  \"partnerId\": \"4b1f…\",\n  \"to\": \"jane@customer.example.com\",\n  \"subject\": \"Your invoice for October\",\n  \"html\": \"<p>Hi Jane…</p>\",\n  \"text\": \"Hi Jane…\",\n  \"replyTo\": null,\n  \"idempotencyKey\": \"invoice:inv_2026_10_123\",\n  \"category\": \"transactional\",\n  \"headers\": { \"List-Unsubscribe\": \"<mailto:unsub@example.com>\" }\n}\n```\n\n- **Which partner.** `partnerId` is the `partner.id` you receive on every provision and partner event. Instead of it you can send `customerExternalId`, the account id you returned when PartnersWatch provisioned the customer (or the account you were sent). Send neither and the message is your own mail, from your own sender. A partner outside your program, or an account we can't place, is a `422`.\n- **Who it's from.** The partner's verified sender, DKIM-signed for their domain. Otherwise your own verified sender (set it up under **White-label → Mail senders → Your sender**). Otherwise the deployment's default address.\n- **Reply-To** is `replyTo` from the body, else the reply-to on the sender being used.\n- **Body.** `html`, `text` or both. With only `html`, a plain-text part is derived from it. Up to 50 recipients.\n- **Headers.** Only `List-Unsubscribe`, `List-Unsubscribe-Post` and `X-Entity-Ref-ID` are passed through. Anything else is dropped without an error. `tags` is accepted and ignored.\n\nThe answer is `202`:\n\n```json\n{ \"id\": \"…\", \"status\": \"sent\", \"branded\": true, \"from\": { \"name\": \"Acme\", \"address\": \"hello@acme.com\" } }\n```\n\n`branded: true` means the message left from the partner's own address. `status` is `queued`, `sent` or `failed`. `failed` here means the receiving server refused it for good, and retrying won't help.\n\n`GET /api/mail/messages/{id}` (same scope, or a signed-in operator) reads the receipt back. The message body is never stored.\n\n### Idempotency\n\nSend `idempotencyKey` in the body or an `Idempotency-Key` header (the body wins if both are set). The same key from the same org returns the original message instead of sending again, for as long as the message exists. We guarantee at least 7 days, and in practice receipts are not purged. The same key with a different message is `422 idempotency_key_mismatch`. A message that failed with a retryable error is sent again when you retry with its key.\n\n### Status codes, and what to do with them\n\n| Answer | Meaning | What to do |\n| --- | --- | --- |\n| `202` | Accepted. `status` says what happened. | Nothing. |\n| `429`, `5xx` (`503 mail_retryable`) | Maybe. The relay or the rate limit got in the way. | Retry with the same idempotency key. |\n| `403` | The key lacks `mail:send`, or isn't an operator key. | Send it yourself and fix the key. |\n| `422` | A definitive no: `partner_not_resolved`, `partner_mismatch`, `idempotency_key_mismatch`, `mail_relay_not_configured`, or an invalid body. | Send it yourself. |\n\nRetrying on `5xx` and `429` and falling back to your own mailer on any other `4xx` is safe: a `4xx` never means \"maybe\".\n\n### Test keys\n\nA `pos_test_` key runs the whole path (partner resolution, sender choice, idempotency, receipts, webhooks) but the message goes to the logged sink instead of an inbox.\n\n### Webhooks\n\nSubscribe an endpoint to `mail.sent` and `mail.failed` (see *Webhooks*). The payload is the receipt: `messageId`, `partnerId`, `customerId`, `to`, `subject`, `category`, `branded`, `from`, `status`, `error`, `idempotencyKey`, `environment`. A retryable failure emits nothing, because your retry may still succeed.\n\n### Limits\n\n- 600 sends a minute per key (`429` past that).\n- 1.5 MB request body; `html` up to 512 KB, `text` up to 256 KB, subject up to 998 characters.\n- 50 recipients per message.\n\n### Privacy\n\nReceipts keep the recipient address. Erasing a person (self-service account erasure, or an operator erasing a customer or partner contact) replaces their address in every receipt that names them.\n\n## MCP tools\n\nOn the integration MCP, `get_partner_mail_identity` tells you who a send for a partner would be from right now and why, with the partner's sender and DNS record states. `send_test_mail` sends one short test message through the rail. In your integration manifest, declare `\"mail\": { \"send\": true }`. PartnersWatch then warns you if no key in your org holds `mail:send`."},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"User session token from `POST /api/auth/login`. Send as `Authorization: Bearer <jwt>`."},"machineAuth":{"type":"http","scheme":"bearer","description":"Machine credential: an API key (`Authorization: Bearer pos_live_…` / `pos_test_…`, minted via `POST /api/apikeys`, plaintext returned once) or an OAuth access token from `POST /api/oauth/token`. The credential's environment (live/test) decides which rows it writes."},"scimAuth":{"type":"http","scheme":"bearer","description":"SCIM provisioning token (`Authorization: Bearer scim_…`), minted in Settings › Single sign-on (`POST /api/sso/scim/tokens`, plaintext returned once). It provisions users into the org that minted it, and nothing else."}},"schemas":{}},"paths":{"/health":{"get":{"tags":["system"],"responses":{"200":{"description":"Default Response"}}}},"/api/auth/login":{"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"password":{"type":"string","minLength":1}},"required":["email","password"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"orgKind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]}},"required":["orgId","orgName","orgKind","role","accountType"],"additionalProperties":false}},"activeOrgId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]},"permissions":{"type":"array","items":{"type":"string"}},"customRole":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"emailVerified":{"type":"boolean"}},"required":["token","user","memberships","activeOrgId","role","accountType"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/signup/availability":{"get":{"tags":["auth"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"open":{"type":"boolean"}},"required":["open"],"additionalProperties":false}}}}}}},"/api/auth/signup":{"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["brand"]},"email":{"type":"string","format":"email","maxLength":200},"password":{"type":"string","minLength":8,"maxLength":200},"fullName":{"type":"string","minLength":1,"maxLength":120},"orgName":{"type":"string","minLength":1,"maxLength":160},"website":{"type":"string","maxLength":300},"country":{"type":"string","maxLength":80},"description":{"type":"string","maxLength":1000},"profile":{"type":"object","properties":{"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"downstream":{"type":"array","items":{"type":"string","enum":["franchisees","locations","resellers","agencies","affiliates","distributors","agents","instructors"]},"default":[]},"physicalLocations":{"type":"boolean","default":false},"billing":{"type":"string","enum":["we_bill","they_bill","mixed"],"default":"we_bill"},"brandMode":{"type":"string","enum":["our_brand","their_brand","both"],"default":"our_brand"},"size":{"type":"string","enum":["1-10","11-50","51-200","200+"]}},"required":["businessType"],"additionalProperties":false}},"required":["kind","email","password","fullName","orgName","profile"],"additionalProperties":false},{"type":"object","properties":{"kind":{"type":"string","enum":["partner"]},"email":{"type":"string","format":"email","maxLength":200},"password":{"type":"string","minLength":8,"maxLength":200},"fullName":{"type":"string","minLength":1,"maxLength":120},"companyName":{"type":"string","minLength":1,"maxLength":160},"website":{"type":"string","maxLength":300},"country":{"type":"string","maxLength":80},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"minItems":1},"listingSlug":{"type":"string","maxLength":120}},"required":["kind","email","password","fullName","companyName","partnerKinds"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"orgKind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]}},"required":["orgId","orgName","orgKind","role","accountType"],"additionalProperties":false}},"activeOrgId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]},"permissions":{"type":"array","items":{"type":"string"}},"customRole":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"emailVerified":{"type":"boolean"},"listingSlug":{"type":"string"}},"required":["token","user","memberships","activeOrgId","role","accountType"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/password/set":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"query","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"fullName":{"type":"string"}},"required":["email","fullName"],"additionalProperties":false}}}},"410":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1},"password":{"type":"string","minLength":8,"maxLength":200}},"required":["token","password"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"orgKind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]}},"required":["orgId","orgName","orgKind","role","accountType"],"additionalProperties":false}},"activeOrgId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]},"permissions":{"type":"array","items":{"type":"string"}},"customRole":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"emailVerified":{"type":"boolean"}},"required":["token","user","memberships","activeOrgId","role","accountType"],"additionalProperties":false}}}},"410":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/verify-email":{"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1,"maxLength":2000}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"email":{"type":"string"}},"required":["ok","email"],"additionalProperties":false}}}},"410":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/verify-email/resend":{"post":{"tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean"},"alreadyVerified":{"type":"boolean"},"email":{"type":"string"}},"required":["sent","alreadyVerified","email"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/password/forgot":{"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","maxLength":200}},"required":["email"],"additionalProperties":false}}}},"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/password/reset":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"query","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"fullName":{"type":"string"}},"required":["email","fullName"],"additionalProperties":false}}}},"410":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1,"maxLength":2000},"password":{"type":"string","minLength":8,"maxLength":200}},"required":["token","password"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"orgKind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]}},"required":["orgId","orgName","orgKind","role","accountType"],"additionalProperties":false}},"activeOrgId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]},"permissions":{"type":"array","items":{"type":"string"}},"customRole":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"emailVerified":{"type":"boolean"}},"required":["token","user","memberships","activeOrgId","role","accountType"],"additionalProperties":false}}}},"410":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/me":{"get":{"tags":["auth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"orgKind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]}},"required":["orgId","orgName","orgKind","role","accountType"],"additionalProperties":false}},"activeOrgId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]},"permissions":{"type":"array","items":{"type":"string"}},"customRole":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"emailVerified":{"type":"boolean"}},"required":["token","user","memberships","activeOrgId","role","accountType"],"additionalProperties":false}}}}}}},"/api/auth/switch-org":{"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"}},"required":["orgId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"orgKind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]}},"required":["orgId","orgName","orgKind","role","accountType"],"additionalProperties":false}},"activeOrgId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]},"permissions":{"type":"array","items":{"type":"string"}},"customRole":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"emailVerified":{"type":"boolean"}},"required":["token","user","memberships","activeOrgId","role","accountType"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/users":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"customRoleId":{"type":"string","format":"uuid","nullable":true},"customRoleName":{"type":"string","nullable":true}},"required":["id","email","fullName","isActive","createdAt","updatedAt","role"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"orgId":{"type":"string","format":"uuid"},"password":{"type":"string","minLength":8}},"required":["email","fullName","role","password"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/organizations":{"get":{"tags":["organizations"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"kind","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"managedByOrgId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["operator","partner","customer"]},"managedByOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"partnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"],"nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"status":{"type":"string"},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"notes":{"type":"string","nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true,"default":null},"setup":{"type":"object","properties":{"completed":{"type":"boolean","default":false},"steps":{"type":"array","items":{"type":"string"},"default":[]},"profile":{"type":"object","properties":{"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"downstream":{"type":"array","items":{"type":"string","enum":["franchisees","locations","resellers","agencies","affiliates","distributors","agents","instructors"]},"default":[]},"physicalLocations":{"type":"boolean","default":false},"billing":{"type":"string","enum":["we_bill","they_bill","mixed"],"default":"we_bill"},"brandMode":{"type":"string","enum":["our_brand","their_brand","both"],"default":"our_brand"},"size":{"type":"string","enum":["1-10","11-50","51-200","200+"]}},"required":["businessType"],"additionalProperties":false},"features":{"type":"array","items":{"type":"string","enum":["deals","customers","commissions","billing","automation","documents","subprocessors","ai","integrations","sso","courses","cx","whitelabel","marketplace","leads","engagement","services","usage","locations","territories","royalties","requests","campaigns","feedback","exchange"]}}},"additionalProperties":false,"nullable":true,"default":null},"terminology":{"type":"object","properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false,"nullable":true,"default":null},"planTier":{"type":"string","enum":["starter","growth","enterprise"],"default":"starter"},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","kind","managedByOrgId","name","legalName","address","signatory","signatoryTitle","website","country","contactName","contactEmail","partnerType","tier","status","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["organizations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["operator","partner","customer"],"default":"partner"},"managedByOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"legalName":{"type":"string","maxLength":200,"nullable":true},"address":{"type":"string","maxLength":2000,"nullable":true},"signatory":{"type":"string","maxLength":200,"nullable":true},"signatoryTitle":{"type":"string","maxLength":200,"nullable":true},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","maxLength":100,"nullable":true},"contactName":{"type":"string","maxLength":200,"nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"partnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"],"nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"status":{"type":"string","maxLength":50},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["operator","partner","customer"]},"managedByOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"partnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"],"nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"status":{"type":"string"},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"notes":{"type":"string","nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true,"default":null},"setup":{"type":"object","properties":{"completed":{"type":"boolean","default":false},"steps":{"type":"array","items":{"type":"string"},"default":[]},"profile":{"type":"object","properties":{"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"downstream":{"type":"array","items":{"type":"string","enum":["franchisees","locations","resellers","agencies","affiliates","distributors","agents","instructors"]},"default":[]},"physicalLocations":{"type":"boolean","default":false},"billing":{"type":"string","enum":["we_bill","they_bill","mixed"],"default":"we_bill"},"brandMode":{"type":"string","enum":["our_brand","their_brand","both"],"default":"our_brand"},"size":{"type":"string","enum":["1-10","11-50","51-200","200+"]}},"required":["businessType"],"additionalProperties":false},"features":{"type":"array","items":{"type":"string","enum":["deals","customers","commissions","billing","automation","documents","subprocessors","ai","integrations","sso","courses","cx","whitelabel","marketplace","leads","engagement","services","usage","locations","territories","royalties","requests","campaigns","feedback","exchange"]}}},"additionalProperties":false,"nullable":true,"default":null},"terminology":{"type":"object","properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false,"nullable":true,"default":null},"planTier":{"type":"string","enum":["starter","growth","enterprise"],"default":"starter"},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","kind","managedByOrgId","name","legalName","address","signatory","signatoryTitle","website","country","contactName","contactEmail","partnerType","tier","status","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/organizations/me":{"get":{"tags":["organizations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["operator","partner","customer"]},"managedByOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"partnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"],"nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"status":{"type":"string"},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"notes":{"type":"string","nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true,"default":null},"setup":{"type":"object","properties":{"completed":{"type":"boolean","default":false},"steps":{"type":"array","items":{"type":"string"},"default":[]},"profile":{"type":"object","properties":{"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"downstream":{"type":"array","items":{"type":"string","enum":["franchisees","locations","resellers","agencies","affiliates","distributors","agents","instructors"]},"default":[]},"physicalLocations":{"type":"boolean","default":false},"billing":{"type":"string","enum":["we_bill","they_bill","mixed"],"default":"we_bill"},"brandMode":{"type":"string","enum":["our_brand","their_brand","both"],"default":"our_brand"},"size":{"type":"string","enum":["1-10","11-50","51-200","200+"]}},"required":["businessType"],"additionalProperties":false},"features":{"type":"array","items":{"type":"string","enum":["deals","customers","commissions","billing","automation","documents","subprocessors","ai","integrations","sso","courses","cx","whitelabel","marketplace","leads","engagement","services","usage","locations","territories","royalties","requests","campaigns","feedback","exchange"]}}},"additionalProperties":false,"nullable":true,"default":null},"terminology":{"type":"object","properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false,"nullable":true,"default":null},"planTier":{"type":"string","enum":["starter","growth","enterprise"],"default":"starter"},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","kind","managedByOrgId","name","legalName","address","signatory","signatoryTitle","website","country","contactName","contactEmail","partnerType","tier","status","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/organizations/{id}":{"get":{"tags":["organizations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["operator","partner","customer"]},"managedByOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"partnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"],"nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"status":{"type":"string"},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"notes":{"type":"string","nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true,"default":null},"setup":{"type":"object","properties":{"completed":{"type":"boolean","default":false},"steps":{"type":"array","items":{"type":"string"},"default":[]},"profile":{"type":"object","properties":{"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"downstream":{"type":"array","items":{"type":"string","enum":["franchisees","locations","resellers","agencies","affiliates","distributors","agents","instructors"]},"default":[]},"physicalLocations":{"type":"boolean","default":false},"billing":{"type":"string","enum":["we_bill","they_bill","mixed"],"default":"we_bill"},"brandMode":{"type":"string","enum":["our_brand","their_brand","both"],"default":"our_brand"},"size":{"type":"string","enum":["1-10","11-50","51-200","200+"]}},"required":["businessType"],"additionalProperties":false},"features":{"type":"array","items":{"type":"string","enum":["deals","customers","commissions","billing","automation","documents","subprocessors","ai","integrations","sso","courses","cx","whitelabel","marketplace","leads","engagement","services","usage","locations","territories","royalties","requests","campaigns","feedback","exchange"]}}},"additionalProperties":false,"nullable":true,"default":null},"terminology":{"type":"object","properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false,"nullable":true,"default":null},"planTier":{"type":"string","enum":["starter","growth","enterprise"],"default":"starter"},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","kind","managedByOrgId","name","legalName","address","signatory","signatoryTitle","website","country","contactName","contactEmail","partnerType","tier","status","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["organizations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["operator","partner","customer"],"default":"partner"},"managedByOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"legalName":{"type":"string","maxLength":200,"nullable":true},"address":{"type":"string","maxLength":2000,"nullable":true},"signatory":{"type":"string","maxLength":200,"nullable":true},"signatoryTitle":{"type":"string","maxLength":200,"nullable":true},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","maxLength":100,"nullable":true},"contactName":{"type":"string","maxLength":200,"nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"partnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"],"nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"status":{"type":"string","maxLength":50},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"setup":{"type":"object","properties":{"completed":{"type":"boolean","default":false},"steps":{"type":"array","items":{"type":"string"},"default":[]},"profile":{"type":"object","properties":{"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"downstream":{"type":"array","items":{"type":"string","enum":["franchisees","locations","resellers","agencies","affiliates","distributors","agents","instructors"]},"default":[]},"physicalLocations":{"type":"boolean","default":false},"billing":{"type":"string","enum":["we_bill","they_bill","mixed"],"default":"we_bill"},"brandMode":{"type":"string","enum":["our_brand","their_brand","both"],"default":"our_brand"},"size":{"type":"string","enum":["1-10","11-50","51-200","200+"]}},"required":["businessType"],"additionalProperties":false},"features":{"type":"array","items":{"type":"string","enum":["deals","customers","commissions","billing","automation","documents","subprocessors","ai","integrations","sso","courses","cx","whitelabel","marketplace","leads","engagement","services","usage","locations","territories","royalties","requests","campaigns","feedback","exchange"]}}},"additionalProperties":false,"nullable":true},"terminology":{"type":"object","properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["operator","partner","customer"]},"managedByOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"partnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"],"nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"status":{"type":"string"},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"notes":{"type":"string","nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true,"default":null},"setup":{"type":"object","properties":{"completed":{"type":"boolean","default":false},"steps":{"type":"array","items":{"type":"string"},"default":[]},"profile":{"type":"object","properties":{"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"downstream":{"type":"array","items":{"type":"string","enum":["franchisees","locations","resellers","agencies","affiliates","distributors","agents","instructors"]},"default":[]},"physicalLocations":{"type":"boolean","default":false},"billing":{"type":"string","enum":["we_bill","they_bill","mixed"],"default":"we_bill"},"brandMode":{"type":"string","enum":["our_brand","their_brand","both"],"default":"our_brand"},"size":{"type":"string","enum":["1-10","11-50","51-200","200+"]}},"required":["businessType"],"additionalProperties":false},"features":{"type":"array","items":{"type":"string","enum":["deals","customers","commissions","billing","automation","documents","subprocessors","ai","integrations","sso","courses","cx","whitelabel","marketplace","leads","engagement","services","usage","locations","territories","royalties","requests","campaigns","feedback","exchange"]}}},"additionalProperties":false,"nullable":true,"default":null},"terminology":{"type":"object","properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false,"nullable":true,"default":null},"planTier":{"type":"string","enum":["starter","growth","enterprise"],"default":"starter"},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","kind","managedByOrgId","name","legalName","address","signatory","signatoryTitle","website","country","contactName","contactEmail","partnerType","tier","status","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["organizations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/plan":{"get":{"tags":["plan"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"string","enum":["starter","growth","enterprise"]},"status":{"type":"string","nullable":true},"renewsAt":{"type":"string","nullable":true},"cancelAtPeriodEnd":{"type":"boolean"},"billingConfigured":{"type":"boolean"},"hasBillingAccount":{"type":"boolean"},"trialDays":{"type":"integer","minimum":0},"partnersLimit":{"type":"integer","nullable":true},"aiAllowanceMicros":{"type":"integer"},"aiUsedMicros":{"type":"integer"}},"required":["tier","status","renewsAt","cancelAtPeriodEnd","billingConfigured","hasBillingAccount","trialDays","partnersLimit","aiAllowanceMicros","aiUsedMicros"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/plan/checkout":{"post":{"tags":["plan"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"string","enum":["growth"]},"interval":{"type":"string","enum":["month","year"],"default":"month"}},"required":["tier"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/plan/portal":{"post":{"tags":["plan"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/plan/webhook":{"post":{"tags":["plan"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"received":{"type":"boolean"}},"required":["received"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/relationships":{"get":{"tags":["relationships"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"orgId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"upstreamOrgId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"downstreamOrgId","required":false},{"schema":{"type":"string"},"in":"query","name":"kind","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"upstreamOrgId":{"type":"string","format":"uuid"},"downstreamOrgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["resale","whitelabel","referral","direct"]},"status":{"type":"string","enum":["prospect","onboarding","active","suspended","churned"]},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"billingMode":{"type":"string","enum":["commission","resale","credits"],"nullable":true},"allocationMode":{"type":"string","enum":["pooled","pass_through"],"nullable":true},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","upstreamOrgId","downstreamOrgId","kind","status","commissionBps","billingMode","allocationMode","mrr","currency","ownerUserId","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["relationships"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"upstreamOrgId":{"type":"string","format":"uuid"},"downstreamOrgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["resale","whitelabel","referral","direct"],"default":"resale"},"status":{"type":"string","enum":["prospect","onboarding","active","suspended","churned"],"default":"active"},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"billingMode":{"type":"string","enum":["commission","resale","credits"],"nullable":true},"allocationMode":{"type":"string","enum":["pooled","pass_through"],"nullable":true},"mrr":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true}},"required":["upstreamOrgId","downstreamOrgId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"upstreamOrgId":{"type":"string","format":"uuid"},"downstreamOrgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["resale","whitelabel","referral","direct"]},"status":{"type":"string","enum":["prospect","onboarding","active","suspended","churned"]},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"billingMode":{"type":"string","enum":["commission","resale","credits"],"nullable":true},"allocationMode":{"type":"string","enum":["pooled","pass_through"],"nullable":true},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","upstreamOrgId","downstreamOrgId","kind","status","commissionBps","billingMode","allocationMode","mrr","currency","ownerUserId","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/relationships/{id}":{"get":{"tags":["relationships"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"upstreamOrgId":{"type":"string","format":"uuid"},"downstreamOrgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["resale","whitelabel","referral","direct"]},"status":{"type":"string","enum":["prospect","onboarding","active","suspended","churned"]},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"billingMode":{"type":"string","enum":["commission","resale","credits"],"nullable":true},"allocationMode":{"type":"string","enum":["pooled","pass_through"],"nullable":true},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","upstreamOrgId","downstreamOrgId","kind","status","commissionBps","billingMode","allocationMode","mrr","currency","ownerUserId","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["relationships"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["resale","whitelabel","referral","direct"],"default":"resale"},"status":{"type":"string","enum":["prospect","onboarding","active","suspended","churned"],"default":"active"},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"billingMode":{"type":"string","enum":["commission","resale","credits"],"nullable":true},"allocationMode":{"type":"string","enum":["pooled","pass_through"],"nullable":true},"mrr":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"upstreamOrgId":{"type":"string","format":"uuid"},"downstreamOrgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["resale","whitelabel","referral","direct"]},"status":{"type":"string","enum":["prospect","onboarding","active","suspended","churned"]},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"billingMode":{"type":"string","enum":["commission","resale","credits"],"nullable":true},"allocationMode":{"type":"string","enum":["pooled","pass_through"],"nullable":true},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","upstreamOrgId","downstreamOrgId","kind","status","commissionBps","billingMode","allocationMode","mrr","currency","ownerUserId","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["relationships"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/partners":{"get":{"tags":["partners"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"]},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","type","tier","status","website","country","contactName","contactEmail","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["partners"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"default":"registered"},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"],"default":"prospect"},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","maxLength":100,"nullable":true},"contactName":{"type":"string","maxLength":200,"nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"default":1000},"notes":{"type":"string","maxLength":5000,"nullable":true}},"required":["name","type"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"]},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","type","tier","status","website","country","contactName","contactEmail","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"402":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/partners/{id}":{"get":{"tags":["partners"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"]},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","type","tier","status","website","country","contactName","contactEmail","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["partners"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"default":"registered"},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"],"default":"prospect"},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","maxLength":100,"nullable":true},"contactName":{"type":"string","maxLength":200,"nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"default":1000},"notes":{"type":"string","maxLength":5000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"]},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","type","tier","status","website","country","contactName","contactEmail","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["partners"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/onboarding/applications":{"post":{"tags":["onboarding"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"companyName":{"type":"string","minLength":1,"maxLength":200},"contactName":{"type":"string","minLength":1,"maxLength":200},"contactEmail":{"type":"string","format":"email"},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"country":{"type":"string","maxLength":100,"nullable":true},"website":{"type":"string","format":"uri","nullable":true},"motivation":{"type":"string","maxLength":5000,"nullable":true},"managingOrgId":{"type":"string","format":"uuid","nullable":true}},"required":["companyName","contactName","contactEmail","type"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"managingOrgId":{"type":"string","format":"uuid","nullable":true},"orgId":{"type":"string","format":"uuid","nullable":true},"companyName":{"type":"string","minLength":1},"contactName":{"type":"string","minLength":1},"contactEmail":{"type":"string","format":"email"},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"country":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"motivation":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string"},"reviewerId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"declineReason":{"type":"string","nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","managingOrgId","orgId","companyName","contactName","contactEmail","type","country","website","motivation","pipelineId","stage","reviewerId","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}}}},"get":{"tags":["onboarding"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"stage","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"managingOrgId":{"type":"string","format":"uuid","nullable":true},"orgId":{"type":"string","format":"uuid","nullable":true},"companyName":{"type":"string","minLength":1},"contactName":{"type":"string","minLength":1},"contactEmail":{"type":"string","format":"email"},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"country":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"motivation":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string"},"reviewerId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"declineReason":{"type":"string","nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","managingOrgId","orgId","companyName","contactName","contactEmail","type","country","website","motivation","pipelineId","stage","reviewerId","decisionNote","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/onboarding/applications/{id}":{"get":{"tags":["onboarding"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"managingOrgId":{"type":"string","format":"uuid","nullable":true},"orgId":{"type":"string","format":"uuid","nullable":true},"companyName":{"type":"string","minLength":1},"contactName":{"type":"string","minLength":1},"contactEmail":{"type":"string","format":"email"},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"country":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"motivation":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string"},"reviewerId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"declineReason":{"type":"string","nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","managingOrgId","orgId","companyName","contactName","contactEmail","type","country","website","motivation","pipelineId","stage","reviewerId","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/onboarding/applications/{id}/advance":{"post":{"tags":["onboarding"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"stage":{"type":"string"},"decisionNote":{"type":"string","maxLength":5000,"nullable":true},"declineReason":{"type":"string","maxLength":2000,"nullable":true},"adminPassword":{"type":"string","minLength":8,"maxLength":200}},"required":["stage"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"managingOrgId":{"type":"string","format":"uuid","nullable":true},"orgId":{"type":"string","format":"uuid","nullable":true},"companyName":{"type":"string","minLength":1},"contactName":{"type":"string","minLength":1},"contactEmail":{"type":"string","format":"email"},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"country":{"type":"string","nullable":true},"website":{"type":"string","format":"uri","nullable":true},"motivation":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string"},"reviewerId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"declineReason":{"type":"string","nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","managingOrgId","orgId","companyName","contactName","contactEmail","type","country","website","motivation","pipelineId","stage","reviewerId","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/onboarding/applications/{id}/tasks":{"get":{"tags":["onboarding"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1},"status":{"type":"string","enum":["todo","in_progress","done"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"dueDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","applicationId","title","status","assigneeId","dueDate","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["onboarding"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"assigneeId":{"type":"string","format":"uuid","nullable":true},"dueDate":{"type":"string","nullable":true}},"required":["title"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1},"status":{"type":"string","enum":["todo","in_progress","done"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"dueDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","applicationId","title","status","assigneeId","dueDate","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/onboarding/tasks/{taskId}":{"patch":{"tags":["onboarding"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"status":{"type":"string","enum":["todo","in_progress","done"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"dueDate":{"type":"string","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"taskId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1},"status":{"type":"string","enum":["todo","in_progress","done"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"dueDate":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","applicationId","title","status","assigneeId","dueDate","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"company":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"onboardingStage":{"type":"string","enum":["not_started","provisioned","invited","delivered","opened","clicked","accepted","signed_in","activated"],"nullable":true},"onboardingProblem":{"type":"string","enum":["bounced","expired","failed"],"nullable":true},"trialEnded":{"type":"boolean"}},"required":["id","partnerId","name","company","email","phone","pipelineId","status","mrr","currency","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["customers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","maxLength":200,"nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","maxLength":50,"nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"notes":{"type":"string","maxLength":5000,"nullable":true},"provision":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credits","units","plan","feature","custom"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000},"unit":{"type":"string","minLength":1,"maxLength":40},"attributes":{"type":"object","additionalProperties":{}},"note":{"type":"string","maxLength":500},"onboard":{"type":"object","properties":{"domain":{"type":"string","minLength":3,"maxLength":253},"companyName":{"type":"string","minLength":1,"maxLength":200},"platform":{"type":"string","enum":["web","shopify","woocommerce","shopware"],"default":"web"},"location":{"type":"string","minLength":2,"maxLength":8}},"required":["domain"],"additionalProperties":false}},"required":["productId","kind","onboard"],"additionalProperties":false},"partnerId":{"type":"string","format":"uuid"}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"company":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"provision":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid","nullable":true},"walletId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["credits","units","plan","feature","custom"]},"quantity":{"type":"integer","nullable":true},"unit":{"type":"string","nullable":true},"attributes":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"attempts":{"type":"integer"},"environment":{"type":"string","enum":["live","test"]},"externalAccountId":{"type":"string"},"externalId":{"type":"string","nullable":true},"response":{"type":"object","additionalProperties":{},"nullable":true},"lastError":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"partnerName":{"type":"string","nullable":true},"customerName":{"type":"string","nullable":true},"productName":{"type":"string","nullable":true},"planName":{"type":"string","nullable":true}},"required":["id","partnerId","customerId","productId","connectionId","walletId","kind","quantity","unit","attributes","status","attempts","environment","externalAccountId","externalId","response","lastError","note","deliveredAt","createdAt","updatedAt","partnerName","customerName","productName"],"additionalProperties":false,"nullable":true}},"required":["id","partnerId","name","company","email","phone","pipelineId","status","mrr","currency","notes","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/customers/{id}":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"company":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","name","company","email","phone","pipelineId","status","mrr","currency","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["customers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","maxLength":200,"nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","maxLength":50,"nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"notes":{"type":"string","maxLength":5000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"company":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","name","company","email","phone","pipelineId","status","mrr","currency","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["customers"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers/{id}/journey":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string","enum":["live","test"]},"in":"query","name":"environment","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"stage":{"type":"string","enum":["not_started","provisioned","invited","delivered","opened","clicked","accepted","signed_in","activated"]},"problem":{"type":"object","properties":{"kind":{"type":"string","enum":["bounced","expired","failed"]},"at":{"type":"string"},"detail":{"type":"string","nullable":true}},"required":["kind","at"],"additionalProperties":false,"nullable":true},"steps":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","enum":["provisioned","invited","delivered","opened","clicked","accepted","signed_in","activated"]},"label":{"type":"string"},"at":{"type":"string","nullable":true},"source":{"type":"string","enum":["vendor","provisioning"]}},"required":["key","label","at","source"],"additionalProperties":false}},"lastActivityAt":{"type":"string","nullable":true},"stuckDays":{"type":"integer","nullable":true},"vendorReporting":{"type":"boolean"}},"required":["customerId","stage","steps","lastActivityAt","vendorReporting"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers/{id}/timeline":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string","enum":["live","test"]},"in":"query","name":"environment","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["activity","event","provision"]},"at":{"type":"string"},"title":{"type":"string"},"detail":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"eventType":{"type":"string","nullable":true},"refId":{"type":"string","format":"uuid"}},"required":["id","kind","at","title","detail","status","eventType","refId"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers/{id}/vendor-accounts":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"productName":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"]},"accountId":{"type":"string"},"domain":{"type":"string","nullable":true},"linkedAt":{"type":"string"},"companyName":{"type":"string","nullable":true},"platform":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"ownerEmail":{"type":"string","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"planName":{"type":"string","nullable":true},"planStatus":{"type":"string","nullable":true},"trialEnded":{"type":"boolean"},"invitation":{"type":"string","nullable":true},"partnerBills":{"type":"boolean"}},"required":["productId","productName","environment","accountId","domain","linkedAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/deals":{"get":{"tags":["deals"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"stage","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"commissionAmount":{"type":"integer","minimum":0},"expectedCloseDate":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"],"default":"live"},"quantity":{"type":"integer","nullable":true,"default":null},"isRenewal":{"type":"boolean","default":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","productId","pipelineId","name","stage","amount","currency","commissionBps","commissionAmount","expectedCloseDate","closedAt","createdById","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["deals"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"expectedCloseDate":{"type":"string","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"partnerId":{"type":"string","format":"uuid"},"quantity":{"type":"integer","minimum":1,"nullable":true},"isRenewal":{"type":"boolean"}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"commissionAmount":{"type":"integer","minimum":0},"expectedCloseDate":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"],"default":"live"},"quantity":{"type":"integer","nullable":true,"default":null},"isRenewal":{"type":"boolean","default":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","productId","pipelineId","name","stage","amount","currency","commissionBps","commissionAmount","expectedCloseDate","closedAt","createdById","notes","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/deals/{id}":{"get":{"tags":["deals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"commissionAmount":{"type":"integer","minimum":0},"expectedCloseDate":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"],"default":"live"},"quantity":{"type":"integer","nullable":true,"default":null},"isRenewal":{"type":"boolean","default":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","productId","pipelineId","name","stage","amount","currency","commissionBps","commissionAmount","expectedCloseDate","closedAt","createdById","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["deals"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"expectedCloseDate":{"type":"string","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"quantity":{"type":"integer","minimum":1,"nullable":true},"isRenewal":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"commissionAmount":{"type":"integer","minimum":0},"expectedCloseDate":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"],"default":"live"},"quantity":{"type":"integer","nullable":true,"default":null},"isRenewal":{"type":"boolean","default":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","productId","pipelineId","name","stage","amount","currency","commissionBps","commissionAmount","expectedCloseDate","closedAt","createdById","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["deals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/deals/forecast":{"get":{"tags":["deals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string"},"totals":{"type":"object","properties":{"open":{"type":"integer"},"weighted":{"type":"integer"},"deals":{"type":"integer"}},"required":["open","weighted","deals"],"additionalProperties":false},"byStage":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string"},"label":{"type":"string"},"probability":{"type":"number"},"count":{"type":"integer"},"amount":{"type":"integer"},"weighted":{"type":"integer"}},"required":["stage","label","probability","count","amount","weighted"],"additionalProperties":false}},"byMonth":{"type":"array","items":{"type":"object","properties":{"month":{"type":"string"},"count":{"type":"integer"},"amount":{"type":"integer"},"weighted":{"type":"integer"}},"required":["month","count","amount","weighted"],"additionalProperties":false}}},"required":["currency","totals","byStage","byMonth"],"additionalProperties":false}}}}}}},"/api/deals/{id}/history":{"get":{"tags":["deals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dealId":{"type":"string","format":"uuid"},"fromStage":{"type":"string","nullable":true},"toStage":{"type":"string"},"actorId":{"type":"string","format":"uuid","nullable":true},"actorName":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","dealId","fromStage","toStage","actorId","actorName","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/deals/{id}/refund":{"post":{"tags":["deals"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","maxLength":500}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"clawedBack":{"type":"integer"}},"required":["clawedBack"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commissions/tiers":{"get":{"tags":["commissions"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"name":{"type":"string","minLength":1},"baseBps":{"type":"integer","minimum":0,"maximum":10000},"multiplier":{"type":"integer","minimum":0,"maximum":1000},"thresholdAmount":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","tier","name","baseBps","multiplier","thresholdAmount","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["commissions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"name":{"type":"string","minLength":1,"maxLength":100},"baseBps":{"type":"integer","minimum":0,"maximum":10000},"multiplier":{"type":"integer","minimum":0,"maximum":1000,"default":100},"thresholdAmount":{"type":"integer","minimum":0,"default":0}},"required":["tier","name","baseBps"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"name":{"type":"string","minLength":1},"baseBps":{"type":"integer","minimum":0,"maximum":10000},"multiplier":{"type":"integer","minimum":0,"maximum":1000},"thresholdAmount":{"type":"integer","minimum":0},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","tier","name","baseBps","multiplier","thresholdAmount","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/commissions/payouts":{"get":{"tags":["commissions"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending","approved","paid","void"]},"reference":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","periodStart","periodEnd","amount","currency","status","reference","note","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["commissions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"note":{"type":"string","maxLength":2000,"nullable":true}},"required":["partnerId","periodStart","periodEnd","amount"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending","approved","paid","void"]},"reference":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","periodStart","periodEnd","amount","currency","status","reference","note","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/commissions/payouts/{id}":{"patch":{"tags":["commissions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["pending","approved","paid","void"]},"reference":{"type":"string","maxLength":200,"nullable":true},"note":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending","approved","paid","void"]},"reference":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","periodStart","periodEnd","amount","currency","status","reference","note","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commission-rules":{"get":{"tags":["commission-rules"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","draft","archived"]},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"priority":{"type":"integer"},"config":{"type":"object","additionalProperties":{}},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","status","type","partnerId","productId","priority","config","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["commission-rules"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":2000,"nullable":true},"status":{"type":"string","enum":["active","draft","archived"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"priority":{"type":"integer","minimum":-1000,"maximum":1000},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"config":{"type":"object","additionalProperties":{}}},"required":["name","type","config"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","draft","archived"]},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"priority":{"type":"integer"},"config":{"type":"object","additionalProperties":{}},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","status","type","partnerId","productId","priority","config","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commission-rules/preview":{"post":{"tags":["commission-rules"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"amount":{"type":"integer","minimum":0},"quantity":{"type":"integer","minimum":1},"isRenewal":{"type":"boolean"}},"required":["partnerId","amount"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string","format":"uuid","nullable":true},"ruleName":{"type":"string"},"ruleType":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"],"nullable":true},"kind":{"type":"string","enum":["base","bonus","override"]},"partnerId":{"type":"string","format":"uuid"},"amount":{"type":"integer"},"recurring":{"type":"object","properties":{"remaining":{"type":"integer","nullable":true},"intervalDays":{"type":"integer"},"perPeriod":{"type":"integer"}},"required":["remaining","intervalDays","perPeriod"],"additionalProperties":false,"nullable":true},"installments":{"type":"object","properties":{"count":{"type":"integer"},"interval":{"type":"string","enum":["month","week"]},"firstAt":{"type":"string","enum":["immediate","next_period"]},"schedule":{"type":"array","items":{"type":"object","properties":{"n":{"type":"integer"},"at":{"type":"string"},"amount":{"type":"integer"}},"required":["n","at","amount"],"additionalProperties":false}}},"required":["count","interval","firstAt","schedule"],"additionalProperties":false,"nullable":true},"note":{"type":"string"}},"required":["ruleId","ruleName","ruleType","kind","partnerId","amount","recurring","note"],"additionalProperties":false}},"total":{"type":"integer"},"capped":{"type":"boolean"}},"required":["lines","total","capped"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commission-rules/simulate":{"post":{"tags":["commission-rules"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ruleIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":2000,"nullable":true},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"priority":{"type":"integer","minimum":-1000,"maximum":1000},"config":{"type":"object","additionalProperties":{}}},"required":["name","type","config"],"additionalProperties":false},"maxItems":20},"scenario":{"type":"object","properties":{"partners":{"type":"integer","minimum":1,"maximum":100000},"dealsPerMonth":{"type":"number","minimum":0,"maximum":1000000},"avgDealValue":{"type":"integer","minimum":0},"churnPct":{"type":"number","minimum":0,"maximum":100,"default":0},"months":{"type":"integer","minimum":1,"maximum":60,"default":12},"avgQuantity":{"type":"integer","minimum":1,"maximum":100000},"renewalPct":{"type":"number","minimum":0,"maximum":100},"partnerTier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["partners","dealsPerMonth","avgDealValue"],"additionalProperties":false}},"required":["scenario"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string"},"months":{"type":"array","items":{"type":"object","properties":{"month":{"type":"integer"},"newDeals":{"type":"number"},"revenue":{"type":"integer"},"accrued":{"type":"integer"},"paid":{"type":"integer"},"deferred":{"type":"integer"},"clawedBack":{"type":"integer"},"cumulativePaid":{"type":"integer"}},"required":["month","newDeals","revenue","accrued","paid","deferred","clawedBack","cumulativePaid"],"additionalProperties":false}},"totals":{"type":"object","properties":{"revenue":{"type":"integer"},"accrued":{"type":"integer"},"paid":{"type":"integer"},"clawedBack":{"type":"integer"},"deferredBeyondHorizon":{"type":"integer"},"effectiveTakeRateBps":{"type":"integer"}},"required":["revenue","accrued","paid","clawedBack","deferredBeyondHorizon","effectiveTakeRateBps"],"additionalProperties":false},"distribution":{"type":"object","properties":{"p10":{"type":"integer"},"p25":{"type":"integer"},"median":{"type":"integer"},"p75":{"type":"integer"},"p90":{"type":"integer"},"max":{"type":"integer"},"mean":{"type":"integer"},"top10SharePct":{"type":"number"},"buckets":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"partners":{"type":"integer"},"earningsEach":{"type":"integer"}},"required":["label","partners","earningsEach"],"additionalProperties":false}}},"required":["p10","p25","median","p75","p90","max","mean","top10SharePct","buckets"],"additionalProperties":false},"sampleDeal":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string","format":"uuid","nullable":true},"ruleName":{"type":"string"},"ruleType":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"],"nullable":true},"kind":{"type":"string","enum":["base","bonus","override"]},"partnerId":{"type":"string","format":"uuid"},"amount":{"type":"integer"},"recurring":{"type":"object","properties":{"remaining":{"type":"integer","nullable":true},"intervalDays":{"type":"integer"},"perPeriod":{"type":"integer"}},"required":["remaining","intervalDays","perPeriod"],"additionalProperties":false,"nullable":true},"installments":{"type":"object","properties":{"count":{"type":"integer"},"interval":{"type":"string","enum":["month","week"]},"firstAt":{"type":"string","enum":["immediate","next_period"]},"schedule":{"type":"array","items":{"type":"object","properties":{"n":{"type":"integer"},"at":{"type":"string"},"amount":{"type":"integer"}},"required":["n","at","amount"],"additionalProperties":false}}},"required":["count","interval","firstAt","schedule"],"additionalProperties":false,"nullable":true},"note":{"type":"string"}},"required":["ruleId","ruleName","ruleType","kind","partnerId","amount","recurring","note"],"additionalProperties":false}},"total":{"type":"integer"},"capped":{"type":"boolean"}},"required":["lines","total","capped"],"additionalProperties":false},"rulesUsed":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","nullable":true},"name":{"type":"string"},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]}},"required":["id","name","type"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"string"}}},"required":["currency","months","totals","distribution","sampleDeal","rulesUsed","notes"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commission-rules/simulate/explain":{"post":{"tags":["commission-rules"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ruleIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":50},"rules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":2000,"nullable":true},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"priority":{"type":"integer","minimum":-1000,"maximum":1000},"config":{"type":"object","additionalProperties":{}}},"required":["name","type","config"],"additionalProperties":false},"maxItems":20},"scenario":{"type":"object","properties":{"partners":{"type":"integer","minimum":1,"maximum":100000},"dealsPerMonth":{"type":"number","minimum":0,"maximum":1000000},"avgDealValue":{"type":"integer","minimum":0},"churnPct":{"type":"number","minimum":0,"maximum":100,"default":0},"months":{"type":"integer","minimum":1,"maximum":60,"default":12},"avgQuantity":{"type":"integer","minimum":1,"maximum":100000},"renewalPct":{"type":"number","minimum":0,"maximum":100},"partnerTier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["partners","dealsPerMonth","avgDealValue"],"additionalProperties":false}},"required":["scenario"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"string"},"highlights":{"type":"array","items":{"type":"string"}},"suggestions":{"type":"array","items":{"type":"string"}},"provider":{"type":"string","nullable":true},"model":{"type":"string","nullable":true}},"required":["summary","highlights","suggestions","provider","model"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commission-rules/{id}":{"get":{"tags":["commission-rules"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","draft","archived"]},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"priority":{"type":"integer"},"config":{"type":"object","additionalProperties":{}},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","status","type","partnerId","productId","priority","config","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["commission-rules"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":2000,"nullable":true},"status":{"type":"string","enum":["active","draft","archived"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"priority":{"type":"integer","minimum":-1000,"maximum":1000},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true},"config":{"type":"object","additionalProperties":{}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","draft","archived"]},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"priority":{"type":"integer"},"config":{"type":"object","additionalProperties":{}},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","status","type","partnerId","productId","priority","config","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["commission-rules"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commission-rules/{id}/activity":{"get":{"tags":["commission-rules"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"deals":{"type":"array","items":{"type":"object","properties":{"dealId":{"type":"string","format":"uuid","nullable":true},"dealName":{"type":"string"},"partnerId":{"type":"string","format":"uuid"},"amount":{"type":"integer"},"lines":{"type":"integer"},"lastAt":{"type":"string"}},"required":["dealId","dealName","partnerId","amount","lines","lastAt"],"additionalProperties":false}}},"required":["total","deals"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/earnings/breakdown":{"get":{"tags":["earnings"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","minLength":3,"maxLength":3},"in":"query","name":"currency","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string"},"totals":{"type":"object","properties":{"earned":{"type":"integer"},"reversed":{"type":"integer"},"withdrawn":{"type":"integer"},"available":{"type":"integer"},"pending":{"type":"integer"}},"required":["earned","reversed","withdrawn","available","pending"],"additionalProperties":false},"byRule":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string","format":"uuid","nullable":true},"ruleName":{"type":"string"},"kind":{"type":"string"},"amount":{"type":"integer"}},"required":["ruleId","ruleName","kind","amount"],"additionalProperties":false}},"byDeal":{"type":"array","items":{"type":"object","properties":{"dealId":{"type":"string","format":"uuid"},"dealName":{"type":"string"},"amount":{"type":"integer"},"lines":{"type":"integer"},"lastAt":{"type":"string"}},"required":["dealId","dealName","amount","lines","lastAt"],"additionalProperties":false}},"upcoming":{"type":"array","items":{"type":"object","properties":{"dealId":{"type":"string","format":"uuid","nullable":true},"ruleId":{"type":"string","format":"uuid","nullable":true},"amount":{"type":"integer"},"nextRunAt":{"type":"string"},"remaining":{"type":"integer","nullable":true},"kind":{"type":"string","enum":["recurring","installment"]},"installment":{"type":"object","properties":{"n":{"type":"integer"},"of":{"type":"integer"}},"required":["n","of"],"additionalProperties":false,"nullable":true}},"required":["dealId","ruleId","amount","nextRunAt","remaining"],"additionalProperties":false}}},"required":["currency","totals","byRule","byDeal","upcoming"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/roles":{"get":{"tags":["roles"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["internal","partner"]},"baseRole":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"permissions":{"type":"array","items":{"type":"string"}},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","audience","baseRole","permissions","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["roles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":500,"nullable":true},"baseRole":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"permissions":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]},"maxItems":181}},"required":["name","baseRole","permissions"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["internal","partner"]},"baseRole":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"permissions":{"type":"array","items":{"type":"string"}},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","audience","baseRole","permissions","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/roles/catalog":{"get":{"tags":["roles"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"permissions":{"type":"array","items":{"type":"string"}},"builtIn":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"required":["permissions","builtIn"],"additionalProperties":false}}}}}}},"/api/roles/{id}":{"get":{"tags":["roles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["internal","partner"]},"baseRole":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"permissions":{"type":"array","items":{"type":"string"}},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","audience","baseRole","permissions","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["roles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"description":{"type":"string","maxLength":500,"nullable":true},"permissions":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]},"maxItems":181}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["internal","partner"]},"baseRole":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"permissions":{"type":"array","items":{"type":"string"}},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","audience","baseRole","permissions","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}}}},"delete":{"tags":["roles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}}}}},"/api/roles/members/{id}":{"put":{"tags":["roles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customRoleId":{"type":"string","format":"uuid","nullable":true}},"required":["customRoleId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}}}}},"/api/materials":{"get":{"tags":["materials"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"kind","required":false},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}]},"in":"query","name":"templates","required":false},{"schema":{"type":"string"},"in":"query","name":"folderId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["materials"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1,"maxLength":200},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false},"default":[]},"isTemplate":{"type":"boolean","default":false},"status":{"type":"string","enum":["draft","published","archived"],"default":"draft"},"productId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true}},"required":["kind","title"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/materials/{id}":{"get":{"tags":["materials"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["materials"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"productId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["materials"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/materials/{id}/clone":{"post":{"tags":["materials"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/materials/{id}/share":{"post":{"tags":["materials"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["materials"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/folders":{"get":{"tags":["folders"],"parameters":[{"schema":{"type":"string","enum":["material","document"]},"in":"query","name":"scope","required":true},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"scope":{"type":"string","enum":["material","document"]},"parentId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"position":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","productId","scope","parentId","name","position","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["folders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scope":{"type":"string","enum":["material","document"]},"name":{"type":"string","minLength":1,"maxLength":120},"parentId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"position":{"type":"integer"}},"required":["scope","name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"scope":{"type":"string","enum":["material","document"]},"parentId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"position":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","productId","scope","parentId","name","position","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/folders/{id}":{"patch":{"tags":["folders"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"parentId":{"type":"string","format":"uuid","nullable":true},"position":{"type":"integer"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"scope":{"type":"string","enum":["material","document"]},"parentId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"position":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","productId","scope","parentId","name","position","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["folders"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/invoices":{"get":{"tags":["invoices"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"number":{"type":"string"},"status":{"type":"string","enum":["draft","sent","paid","overdue","void"]},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}},"taxBps":{"type":"integer","minimum":0,"maximum":10000},"subtotal":{"type":"integer","minimum":0},"taxAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"billTo":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","number","status","issueDate","dueDate","currency","lines","taxBps","subtotal","taxAmount","total","billTo","notes","createdById","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["invoices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid","nullable":true},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false},"minItems":1},"taxBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"billTo":{"type":"string","maxLength":500,"nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"source":{"type":"string","minLength":1,"maxLength":60},"number":{"type":"string","minLength":1,"maxLength":120},"partnerId":{"type":"string","format":"uuid"}},"required":["issueDate","lines"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"number":{"type":"string"},"status":{"type":"string","enum":["draft","sent","paid","overdue","void"]},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}},"taxBps":{"type":"integer","minimum":0,"maximum":10000},"subtotal":{"type":"integer","minimum":0},"taxAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"billTo":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","number","status","issueDate","dueDate","currency","lines","taxBps","subtotal","taxAmount","total","billTo","notes","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/invoices/series":{"get":{"tags":["invoices"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"source":{"type":"string","minLength":1},"prefix":{"type":"string","nullable":true},"nextSeq":{"type":"integer","exclusiveMinimum":true,"minimum":0},"padWidth":{"type":"integer","minimum":0,"maximum":20},"resetPeriod":{"type":"string","enum":["never","yearly"]},"includePeriod":{"type":"boolean"},"periodKey":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","source","prefix","nextSeq","padWidth","resetPeriod","includePeriod","periodKey","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["invoices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"source":{"type":"string","minLength":1,"maxLength":60,"default":"manual"},"prefix":{"type":"string","maxLength":40,"nullable":true},"nextSeq":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"padWidth":{"type":"integer","minimum":0,"maximum":20,"default":0},"resetPeriod":{"type":"string","enum":["never","yearly"],"default":"never"},"includePeriod":{"type":"boolean","default":false}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"source":{"type":"string","minLength":1},"prefix":{"type":"string","nullable":true},"nextSeq":{"type":"integer","exclusiveMinimum":true,"minimum":0},"padWidth":{"type":"integer","minimum":0,"maximum":20},"resetPeriod":{"type":"string","enum":["never","yearly"]},"includePeriod":{"type":"boolean"},"periodKey":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","source","prefix","nextSeq","padWidth","resetPeriod","includePeriod","periodKey","createdAt","updatedAt"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/invoices/series/preview":{"post":{"tags":["invoices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"source":{"type":"string","minLength":1,"maxLength":60,"default":"manual"}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string"},"number":{"type":"string"},"nextSeq":{"type":"integer"},"periodKey":{"type":"string","nullable":true},"exists":{"type":"boolean"}},"required":["source","number","nextSeq","periodKey","exists"],"additionalProperties":false}}}}}}},"/api/invoices/series/{id}":{"patch":{"tags":["invoices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prefix":{"type":"string","maxLength":40,"nullable":true},"nextSeq":{"type":"integer","exclusiveMinimum":true,"minimum":0},"padWidth":{"type":"integer","minimum":0,"maximum":20},"resetPeriod":{"type":"string","enum":["never","yearly"]},"includePeriod":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"source":{"type":"string","minLength":1},"prefix":{"type":"string","nullable":true},"nextSeq":{"type":"integer","exclusiveMinimum":true,"minimum":0},"padWidth":{"type":"integer","minimum":0,"maximum":20},"resetPeriod":{"type":"string","enum":["never","yearly"]},"includePeriod":{"type":"boolean"},"periodKey":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","source","prefix","nextSeq","padWidth","resetPeriod","includePeriod","periodKey","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/invoices/import":{"post":{"tags":["invoices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid","nullable":true},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false},"minItems":1},"taxBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"billTo":{"type":"string","maxLength":500,"nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"source":{"type":"string","minLength":1,"maxLength":60},"number":{"type":"string","minLength":1,"maxLength":120},"partnerId":{"type":"string","format":"uuid"}},"required":["issueDate","lines","number"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"number":{"type":"string"},"status":{"type":"string","enum":["draft","sent","paid","overdue","void"]},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}},"taxBps":{"type":"integer","minimum":0,"maximum":10000},"subtotal":{"type":"integer","minimum":0},"taxAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"billTo":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","number","status","issueDate","dueDate","currency","lines","taxBps","subtotal","taxAmount","total","billTo","notes","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/invoices/export":{"get":{"tags":["invoices"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["csv","json"],"default":"csv"},"in":"query","name":"format","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/invoices/{id}":{"get":{"tags":["invoices"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"number":{"type":"string"},"status":{"type":"string","enum":["draft","sent","paid","overdue","void"]},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}},"taxBps":{"type":"integer","minimum":0,"maximum":10000},"subtotal":{"type":"integer","minimum":0},"taxAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"billTo":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","number","status","issueDate","dueDate","currency","lines","taxBps","subtotal","taxAmount","total","billTo","notes","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["invoices"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["draft","sent","paid","overdue","void"]},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false},"minItems":1},"taxBps":{"type":"integer","minimum":0,"maximum":10000},"billTo":{"type":"string","maxLength":500,"nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"number":{"type":"string"},"status":{"type":"string","enum":["draft","sent","paid","overdue","void"]},"issueDate":{"type":"string"},"dueDate":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"lines":{"type":"array","items":{"type":"object","properties":{"description":{"type":"string","minLength":1},"quantity":{"type":"integer","minimum":1},"unitPrice":{"type":"integer","minimum":0}},"required":["description","quantity","unitPrice"],"additionalProperties":false}},"taxBps":{"type":"integer","minimum":0,"maximum":10000},"subtotal":{"type":"integer","minimum":0},"taxAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"billTo":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","number","status","issueDate","dueDate","currency","lines","taxBps","subtotal","taxAmount","total","billTo","notes","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["invoices"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/emails/templates":{"get":{"tags":["emails"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"audience","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"audience":{"type":"string","enum":["partner","customer","internal"]},"category":{"type":"string","enum":["welcome","onboarding","deal","proposal","invoice","reminder","general"]},"subject":{"type":"string","minLength":1},"body":{"type":"string"},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","audience","category","subject","body","isActive","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["emails"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":200},"audience":{"type":"string","enum":["partner","customer","internal"]},"category":{"type":"string","enum":["welcome","onboarding","deal","proposal","invoice","reminder","general"],"default":"general"},"subject":{"type":"string","minLength":1,"maxLength":300},"body":{"type":"string","minLength":1},"isActive":{"type":"boolean","default":true}},"required":["key","name","audience","subject","body"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"audience":{"type":"string","enum":["partner","customer","internal"]},"category":{"type":"string","enum":["welcome","onboarding","deal","proposal","invoice","reminder","general"]},"subject":{"type":"string","minLength":1},"body":{"type":"string"},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","audience","category","subject","body","isActive","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/emails/outbox":{"get":{"tags":["emails"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"to","required":false},{"schema":{"type":"string"},"in":"query","name":"kind","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"transport":{"type":"string","enum":["smtp","logged"]},"from":{"type":"string"},"to":{"type":"string","nullable":true},"subject":{"type":"string"},"body":{"type":"string"},"kind":{"type":"string","nullable":true}},"required":["at","transport","from","to","subject","body","kind"],"additionalProperties":false}}}}}}}},"/api/playbooks/pipelines":{"get":{"tags":["playbooks"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"entityType":{"type":"string","enum":["partner","deal","customer"]},"isDefault":{"type":"boolean"},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"order":{"type":"integer"},"color":{"type":"string","enum":["grey","green","red","blue","orange","purple"]},"isInitial":{"type":"boolean"},"isWon":{"type":"boolean"},"isLost":{"type":"boolean"},"isClosed":{"type":"boolean"},"isTrial":{"type":"boolean"},"probability":{"type":"number","minimum":0,"maximum":100}},"required":["key","label","order"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","entityType","isDefault","stages","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["playbooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":120},"entityType":{"type":"string","enum":["partner","deal","customer"]},"isDefault":{"type":"boolean"},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"order":{"type":"integer"},"color":{"type":"string","enum":["grey","green","red","blue","orange","purple"]},"isInitial":{"type":"boolean"},"isWon":{"type":"boolean"},"isLost":{"type":"boolean"},"isClosed":{"type":"boolean"},"isTrial":{"type":"boolean"},"probability":{"type":"number","minimum":0,"maximum":100}},"required":["key","label","order"],"additionalProperties":false},"minItems":1}},"required":["key","name","entityType","stages"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"entityType":{"type":"string","enum":["partner","deal","customer"]},"isDefault":{"type":"boolean"},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"order":{"type":"integer"},"color":{"type":"string","enum":["grey","green","red","blue","orange","purple"]},"isInitial":{"type":"boolean"},"isWon":{"type":"boolean"},"isLost":{"type":"boolean"},"isClosed":{"type":"boolean"},"isTrial":{"type":"boolean"},"probability":{"type":"number","minimum":0,"maximum":100}},"required":["key","label","order"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","entityType","isDefault","stages","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/pipelines/{id}":{"get":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"entityType":{"type":"string","enum":["partner","deal","customer"]},"isDefault":{"type":"boolean"},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"order":{"type":"integer"},"color":{"type":"string","enum":["grey","green","red","blue","orange","purple"]},"isInitial":{"type":"boolean"},"isWon":{"type":"boolean"},"isLost":{"type":"boolean"},"isClosed":{"type":"boolean"},"isTrial":{"type":"boolean"},"probability":{"type":"number","minimum":0,"maximum":100}},"required":["key","label","order"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","entityType","isDefault","stages","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows":{"get":{"tags":["playbooks"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"in":"query","name":"subjectType","required":false},{"schema":{"type":"string","enum":["draft","published","archived"]},"in":"query","name":"status","required":false},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}]},"in":"query","name":"templates","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"nodeCount":{"type":"integer"},"activeRuns":{"type":"integer"},"totalRuns":{"type":"integer"},"lastRunAt":{"type":"string","nullable":true}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt","nodeCount","activeRuns","totalRuns","lastRunAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["playbooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false}},"required":["name","subjectType"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/runs":{"get":{"tags":["playbooks"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"playbookId","required":false},{"schema":{"type":"string","enum":["active","waiting","completed","exited","failed","cancelled"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"subjectId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"playbookId":{"type":"string","format":"uuid"},"playbookKey":{"type":"string"},"playbookVersion":{"type":"integer"},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"subjectId":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","cancelled"]},"currentNodeId":{"type":"string","format":"uuid","nullable":true},"context":{"type":"object","additionalProperties":{}},"waitUntil":{"type":"string","nullable":true},"waitEvent":{"type":"string","nullable":true},"goalReached":{"type":"boolean"},"triggeredByEventId":{"type":"string","format":"uuid","nullable":true},"enrolledById":{"type":"string","format":"uuid","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"playbookName":{"type":"string"}},"required":["id","playbookId","playbookKey","playbookVersion","subjectType","subjectId","orgId","status","currentNodeId","context","waitUntil","waitEvent","goalReached","triggeredByEventId","enrolledById","completedAt","createdAt","updatedAt","playbookName"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/runs/{id}":{"get":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"playbookId":{"type":"string","format":"uuid"},"playbookKey":{"type":"string"},"playbookVersion":{"type":"integer"},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"subjectId":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","cancelled"]},"currentNodeId":{"type":"string","format":"uuid","nullable":true},"context":{"type":"object","additionalProperties":{}},"waitUntil":{"type":"string","nullable":true},"waitEvent":{"type":"string","nullable":true},"goalReached":{"type":"boolean"},"triggeredByEventId":{"type":"string","format":"uuid","nullable":true},"enrolledById":{"type":"string","format":"uuid","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"runId":{"type":"string","format":"uuid"},"nodeId":{"type":"string","format":"uuid","nullable":true},"nodeType":{"type":"string"},"actionType":{"type":"string","nullable":true},"name":{"type":"string"},"status":{"type":"string","enum":["pending","scheduled","running","completed","skipped","waiting","failed"]},"input":{"type":"object","additionalProperties":{},"nullable":true},"output":{"type":"object","additionalProperties":{},"nullable":true},"refType":{"type":"string","nullable":true},"refId":{"type":"string","format":"uuid","nullable":true},"error":{"type":"string","nullable":true},"attempts":{"type":"integer"},"scheduledFor":{"type":"string","nullable":true},"executedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","runId","nodeId","nodeType","actionType","name","status","input","output","refType","refId","error","attempts","scheduledFor","executedAt","createdAt"],"additionalProperties":false}},"playbookName":{"type":"string"}},"required":["id","playbookId","playbookKey","playbookVersion","subjectType","subjectId","orgId","status","currentNodeId","context","waitUntil","waitEvent","goalReached","triggeredByEventId","enrolledById","completedAt","createdAt","updatedAt","steps","playbookName"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/runs/{id}/cancel":{"post":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"playbookId":{"type":"string","format":"uuid"},"playbookKey":{"type":"string"},"playbookVersion":{"type":"integer"},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"subjectId":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","cancelled"]},"currentNodeId":{"type":"string","format":"uuid","nullable":true},"context":{"type":"object","additionalProperties":{}},"waitUntil":{"type":"string","nullable":true},"waitEvent":{"type":"string","nullable":true},"goalReached":{"type":"boolean"},"triggeredByEventId":{"type":"string","format":"uuid","nullable":true},"enrolledById":{"type":"string","format":"uuid","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","playbookId","playbookKey","playbookVersion","subjectType","subjectId","orgId","status","currentNodeId","context","waitUntil","waitEvent","goalReached","triggeredByEventId","enrolledById","completedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/runs/{id}/approve":{"post":{"tags":["playbooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string","maxLength":2000}},"required":["decision"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"playbookId":{"type":"string","format":"uuid"},"playbookKey":{"type":"string"},"playbookVersion":{"type":"integer"},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"subjectId":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["active","waiting","completed","exited","failed","cancelled"]},"currentNodeId":{"type":"string","format":"uuid","nullable":true},"context":{"type":"object","additionalProperties":{}},"waitUntil":{"type":"string","nullable":true},"waitEvent":{"type":"string","nullable":true},"goalReached":{"type":"boolean"},"triggeredByEventId":{"type":"string","format":"uuid","nullable":true},"enrolledById":{"type":"string","format":"uuid","nullable":true},"completedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","playbookId","playbookKey","playbookVersion","subjectType","subjectId","orgId","status","currentNodeId","context","waitUntil","waitEvent","goalReached","triggeredByEventId","enrolledById","completedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}":{"get":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"playbookId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["action","condition","branch","merge","delay","wait_event","approval","goal","exit"]},"actionType":{"type":"string","enum":["send_email","send_agreement","send_for_signature","share_material","generate_invoice","create_task","generate_document","grant_credits","adjust_commission_tier","register_deal","advance_deal","set_property","notify","grant_access","webhook","ai_step","enumerate_recipients","regenerate_document","notify_parties","grant_recurring_commission","clawback_commission"],"nullable":true},"name":{"type":"string"},"config":{"type":"object","additionalProperties":{}},"edges":{"type":"array","items":{"type":"object","properties":{"to":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"}},"required":["to"],"additionalProperties":false}},"position":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","playbookId","type","actionType","name","config","edges","position","createdAt","updatedAt"],"additionalProperties":false}}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt","nodes"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["playbooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"exitOnGoal":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/graph":{"put":{"tags":["playbooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entryNodeId":{"type":"string","format":"uuid","nullable":true},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["action","condition","branch","merge","delay","wait_event","approval","goal","exit"]},"actionType":{"type":"string","enum":["send_email","send_agreement","send_for_signature","share_material","generate_invoice","create_task","generate_document","grant_credits","adjust_commission_tier","register_deal","advance_deal","set_property","notify","grant_access","webhook","ai_step","enumerate_recipients","regenerate_document","notify_parties","grant_recurring_commission","clawback_commission"],"nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"config":{"type":"object","additionalProperties":{},"default":{}},"edges":{"type":"array","items":{"type":"object","properties":{"to":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"}},"required":["to"],"additionalProperties":false},"default":[]},"position":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false,"nullable":true}},"required":["id","type","name"],"additionalProperties":false},"maxItems":200}},"required":["entryNodeId","nodes"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"playbookId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["action","condition","branch","merge","delay","wait_event","approval","goal","exit"]},"actionType":{"type":"string","enum":["send_email","send_agreement","send_for_signature","share_material","generate_invoice","create_task","generate_document","grant_credits","adjust_commission_tier","register_deal","advance_deal","set_property","notify","grant_access","webhook","ai_step","enumerate_recipients","regenerate_document","notify_parties","grant_recurring_commission","clawback_commission"],"nullable":true},"name":{"type":"string"},"config":{"type":"object","additionalProperties":{}},"edges":{"type":"array","items":{"type":"object","properties":{"to":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"}},"required":["to"],"additionalProperties":false}},"position":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","playbookId","type","actionType","name","config","edges","position","createdAt","updatedAt"],"additionalProperties":false}}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt","nodes"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/publish":{"post":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/unpublish":{"post":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/archive":{"post":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/clone":{"post":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"version":{"type":"integer"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"subjectType":{"type":"string","enum":["partner","deal","customer","application","document","subprocessor","compliance","whitelabel","course","lead","ticket","location","territory","sales_report","audit"]},"status":{"type":"string","enum":["draft","published","archived"]},"trigger":{"type":"object","properties":{"type":{"type":"string","enum":["record_event","property_changed","scheduled","date_anniversary","segment_changed","webhook","manual"]},"event":{"type":"string"},"fromStages":{"type":"array","items":{"type":"string"}},"toStages":{"type":"array","items":{"type":"string"}},"property":{"type":"string"},"dateField":{"type":"string"},"offsetDays":{"type":"integer"},"schedule":{"type":"object","properties":{"everyDays":{"type":"integer","exclusiveMinimum":true,"minimum":0},"atHour":{"type":"integer","minimum":0,"maximum":23},"cron":{"type":"string"}},"additionalProperties":false},"segment":{"type":"string"},"filter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}]}},"required":["type"],"additionalProperties":false},"enrollmentFilter":{"anyOf":[{"type":"object","properties":{"all":{"type":"array","items":{}}},"required":["all"],"additionalProperties":false},{"type":"object","properties":{"any":{"type":"array","items":{}}},"required":["any"],"additionalProperties":false},{"type":"object","properties":{"not":{}},"required":["not"],"additionalProperties":false},{"type":"object","properties":{"fact":{"type":"string","minLength":1},"op":{"type":"string","enum":["eq","neq","gt","gte","lt","lte","in","nin","contains","exists","not_exists","changed_to","changed_from"]},"value":{}},"required":["fact","op"],"additionalProperties":false}],"nullable":true},"allowReEnroll":{"type":"boolean"},"reEnrollCap":{"type":"integer","nullable":true},"exitOnGoal":{"type":"boolean"},"entryNodeId":{"type":"string","format":"uuid","nullable":true},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","version","name","description","subjectType","status","trigger","enrollmentFilter","allowReEnroll","reEnrollCap","exitOnGoal","entryNodeId","ownerOrgId","isTemplate","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/enroll":{"post":{"tags":["playbooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subjectIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":500},"force":{"type":"boolean"}},"required":["subjectIds"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"enrolled":{"type":"integer"},"skipped":{"type":"integer"},"runIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["enrolled","skipped","runIds"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/simulate":{"post":{"tags":["playbooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subjectId":{"type":"string","format":"uuid"}},"required":["subjectId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"enrolled":{"type":"boolean"},"reason":{"type":"string","nullable":true},"path":{"type":"array","items":{"type":"object","properties":{"nodeId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string"},"name":{"type":"string"},"outcome":{"type":"string"}},"required":["nodeId","type","name","outcome"],"additionalProperties":false}}},"required":["enrolled","reason","path"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/playbooks/workflows/{id}/stats":{"get":{"tags":["playbooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"active":{"type":"integer"},"waiting":{"type":"integer"},"completed":{"type":"integer"},"exited":{"type":"integer"},"failed":{"type":"integer"},"cancelled":{"type":"integer"},"funnel":{"type":"array","items":{"type":"object","properties":{"nodeId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"type":{"type":"string"},"entered":{"type":"integer"},"completed":{"type":"integer"}},"required":["nodeId","name","type","entered","completed"],"additionalProperties":false}}},"required":["total","active","waiting","completed","exited","failed","cancelled","funnel"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/activities":{"get":{"tags":["activities"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string"},"in":"query","name":"entityType","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"entityType":{"type":"string","enum":["partner","deal","customer"]},"entityId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string","nullable":true},"actionType":{"type":"string","enum":["send_email","send_agreement","share_material","generate_invoice","create_task"]},"audience":{"type":"string","enum":["partner","customer","internal"]},"status":{"type":"string","enum":["suggested","queued","sent","viewed","completed","skipped","failed"]},"title":{"type":"string"},"refType":{"type":"string","nullable":true},"refId":{"type":"string","format":"uuid","nullable":true},"recipientName":{"type":"string","nullable":true},"recipientEmail":{"type":"string","nullable":true},"playbookActionId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"sentAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","entityType","entityId","partnerId","stage","actionType","audience","status","title","refType","refId","recipientName","recipientEmail","playbookActionId","createdById","sentAt","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["activities"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"entityType":{"type":"string","enum":["partner","deal","customer"]},"entityId":{"type":"string","format":"uuid"},"actionType":{"type":"string","enum":["send_email","send_agreement","share_material","generate_invoice","create_task"]},"audience":{"type":"string","enum":["partner","customer","internal"],"default":"partner"},"title":{"type":"string","minLength":1,"maxLength":300},"recipientName":{"type":"string","maxLength":200,"nullable":true},"recipientEmail":{"type":"string","format":"email","nullable":true}},"required":["entityType","entityId","actionType","title"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"entityType":{"type":"string","enum":["partner","deal","customer"]},"entityId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string","nullable":true},"actionType":{"type":"string","enum":["send_email","send_agreement","share_material","generate_invoice","create_task"]},"audience":{"type":"string","enum":["partner","customer","internal"]},"status":{"type":"string","enum":["suggested","queued","sent","viewed","completed","skipped","failed"]},"title":{"type":"string"},"refType":{"type":"string","nullable":true},"refId":{"type":"string","format":"uuid","nullable":true},"recipientName":{"type":"string","nullable":true},"recipientEmail":{"type":"string","nullable":true},"playbookActionId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"sentAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","entityType","entityId","partnerId","stage","actionType","audience","status","title","refType","refId","recipientName","recipientEmail","playbookActionId","createdById","sentAt","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/activities/{entityType}/{entityId}":{"get":{"tags":["activities"],"parameters":[{"schema":{"type":"string","enum":["partner","deal","customer"]},"in":"path","name":"entityType","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"entityId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"entityType":{"type":"string","enum":["partner","deal","customer"]},"entityId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string","nullable":true},"actionType":{"type":"string","enum":["send_email","send_agreement","share_material","generate_invoice","create_task"]},"audience":{"type":"string","enum":["partner","customer","internal"]},"status":{"type":"string","enum":["suggested","queued","sent","viewed","completed","skipped","failed"]},"title":{"type":"string"},"refType":{"type":"string","nullable":true},"refId":{"type":"string","format":"uuid","nullable":true},"recipientName":{"type":"string","nullable":true},"recipientEmail":{"type":"string","nullable":true},"playbookActionId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"sentAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","entityType","entityId","partnerId","stage","actionType","audience","status","title","refType","refId","recipientName","recipientEmail","playbookActionId","createdById","sentAt","createdAt","updatedAt"],"additionalProperties":false}}}}}}}},"/api/activities/{id}":{"patch":{"tags":["activities"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["suggested","queued","sent","viewed","completed","skipped","failed"]}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"entityType":{"type":"string","enum":["partner","deal","customer"]},"entityId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string","nullable":true},"actionType":{"type":"string","enum":["send_email","send_agreement","share_material","generate_invoice","create_task"]},"audience":{"type":"string","enum":["partner","customer","internal"]},"status":{"type":"string","enum":["suggested","queued","sent","viewed","completed","skipped","failed"]},"title":{"type":"string"},"refType":{"type":"string","nullable":true},"refId":{"type":"string","format":"uuid","nullable":true},"recipientName":{"type":"string","nullable":true},"recipientEmail":{"type":"string","nullable":true},"playbookActionId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"sentAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","entityType","entityId","partnerId","stage","actionType","audience","status","title","refType","refId","recipientName","recipientEmail","playbookActionId","createdById","sentAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/analytics/summary":{"get":{"tags":["analytics"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partners":{"type":"object","properties":{"total":{"type":"integer"},"active":{"type":"integer"},"onboarding":{"type":"integer"}},"required":["total","active","onboarding"],"additionalProperties":false},"deals":{"type":"object","properties":{"open":{"type":"integer"},"won":{"type":"integer"},"pipelineValue":{"type":"integer","minimum":0},"wonValue":{"type":"integer","minimum":0}},"required":["open","won","pipelineValue","wonValue"],"additionalProperties":false},"commissions":{"type":"object","properties":{"earned":{"type":"integer","minimum":0},"pendingPayout":{"type":"integer","minimum":0}},"required":["earned","pendingPayout"],"additionalProperties":false},"onboarding":{"type":"object","properties":{"pending":{"type":"integer"}},"required":["pending"],"additionalProperties":false},"agreements":{"type":"object","properties":{"awaitingSignature":{"type":"integer"}},"required":["awaitingSignature"],"additionalProperties":false}},"required":["partners","deals","commissions","onboarding","agreements"],"additionalProperties":false}}}}}}},"/api/documents/templates":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string"},"in":"query","name":"level","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}]},"in":"query","name":"includeUnpublished","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"version":{"type":"string"},"governingLaw":{"type":"string","nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"string"}},"autoAttachOnOnboarding":{"type":"boolean"},"isPublished":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","type","level","category","title","description","version","governingLaw","sections","variables","tags","autoAttachOnOnboarding","isPublished","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","nullable":true},"version":{"type":"string","maxLength":40,"default":"1.0"},"governingLaw":{"type":"string","nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false},"default":[]},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false},"default":[]},"tags":{"type":"array","items":{"type":"string"},"default":[]},"autoAttachOnOnboarding":{"type":"boolean","default":false},"isPublished":{"type":"boolean","default":true}},"required":["key","type","level","category","title"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"version":{"type":"string"},"governingLaw":{"type":"string","nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"string"}},"autoAttachOnOnboarding":{"type":"boolean"},"isPublished":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","type","level","category","title","description","version","governingLaw","sections","variables","tags","autoAttachOnOnboarding","isPublished","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/documents/templates/{id}":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string","minLength":1},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"version":{"type":"string"},"governingLaw":{"type":"string","nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"tags":{"type":"array","items":{"type":"string"}},"autoAttachOnOnboarding":{"type":"boolean"},"isPublished":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","type","level","category","title","description","version","governingLaw","sections","variables","tags","autoAttachOnOnboarding","isPublished","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/subprocessors":{"get":{"tags":["subprocessors"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"ownerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"ownerId","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"purpose":{"type":"string"},"category":{"type":"string","nullable":true},"location":{"type":"string"},"country":{"type":"string"},"region":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"dpaUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","pending","inactive"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","name","purpose","category","location","country","region","website","dpaUrl","status","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["subprocessors"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"],"default":"vendor"},"ownerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"purpose":{"type":"string","minLength":1,"maxLength":500},"category":{"type":"string","maxLength":120,"nullable":true},"location":{"type":"string","minLength":1,"maxLength":160},"country":{"type":"string","minLength":1,"maxLength":120},"region":{"type":"string","maxLength":80,"nullable":true},"website":{"type":"string","maxLength":300,"nullable":true},"dpaUrl":{"type":"string","maxLength":300,"nullable":true},"status":{"type":"string","enum":["active","pending","inactive"],"default":"active"}},"required":["name","purpose","location","country"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"purpose":{"type":"string"},"category":{"type":"string","nullable":true},"location":{"type":"string"},"country":{"type":"string"},"region":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"dpaUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","pending","inactive"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","name","purpose","category","location","country","region","website","dpaUrl","status","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/subprocessors/{id}":{"delete":{"tags":["subprocessors"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/documents/bundles":{"get":{"tags":["documents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"rootType":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"reason":{"type":"string","enum":["manual","subprocessor_change","compliance_change","renewal","amendment"]},"sourceType":{"type":"string","nullable":true},"sourceId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["draft","issued","superseded"]},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","rootType","reason","sourceType","sourceId","status","ownerOrgId","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rootType":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"],"default":"dpa"},"name":{"type":"string","minLength":1,"maxLength":200},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"]},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"reason":{"type":"string","enum":["manual","subprocessor_change","compliance_change","renewal","amendment"],"default":"manual"},"includeScc":{"type":"boolean"},"includeToms":{"type":"boolean"},"includeSubprocessorAddendum":{"type":"boolean"},"governingLaw":{"type":"string","nullable":true},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"default":{}},"effectiveDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"rootType":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"reason":{"type":"string","enum":["manual","subprocessor_change","compliance_change","renewal","amendment"]},"sourceType":{"type":"string","nullable":true},"sourceId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["draft","issued","superseded"]},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}},"required":["id","key","name","rootType","reason","sourceType","sourceId","status","ownerOrgId","createdById","createdAt","updatedAt","members"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/bundles/{id}":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"rootType":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"reason":{"type":"string","enum":["manual","subprocessor_change","compliance_change","renewal","amendment"]},"sourceType":{"type":"string","nullable":true},"sourceId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["draft","issued","superseded"]},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}},"required":["id","key","name","rootType","reason","sourceType","sourceId","status","ownerOrgId","createdById","createdAt","updatedAt","members"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string"},"in":"query","name":"level","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string"},"in":"query","name":"folderId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"]},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"counterpartyName":{"type":"string","maxLength":200,"nullable":true},"governingLaw":{"type":"string","nullable":true},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"default":{}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true},"noticePeriodDays":{"type":"integer","minimum":0,"maximum":3650},"signingProvider":{"type":"string","enum":["builtin","docusign"]}},"required":["templateId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"productId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"counterpartyName":{"type":"string","maxLength":200,"nullable":true},"governingLaw":{"type":"string","nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true},"noticePeriodDays":{"type":"integer","minimum":0,"maximum":3650},"signingProvider":{"type":"string","enum":["builtin","docusign"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/documents/ai-draft":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"],"default":"partner_agreement"},"templateId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"dealId":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1,"maxLength":200},"terms":{"type":"string","maxLength":8000},"governingLaw":{"type":"string","maxLength":120}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"document":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false},"source":{"type":"string","enum":["ai","template"]},"summary":{"type":"string"},"riskNotes":{"type":"array","items":{"type":"object","properties":{"clause":{"type":"string"},"note":{"type":"string"},"severity":{"type":"string","enum":["low","medium","high"]}},"required":["clause","note","severity"],"additionalProperties":false}}},"required":["document","source","summary","riskNotes"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/adhoc":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"title":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"counterpartyName":{"type":"string","maxLength":200,"nullable":true},"governingLaw":{"type":"string","nullable":true},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true}},"required":["type","title","body"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/send":{"post":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/sign":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email"},"title":{"type":"string","maxLength":160},"role":{"type":"string","enum":["vendor","partner","customer"],"default":"partner"},"accept":{"type":"boolean","enum":[true]}},"required":["name","accept"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/countersign":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email"},"title":{"type":"string","maxLength":160},"role":{"type":"string","enum":["vendor","partner","customer"],"default":"partner"},"accept":{"type":"boolean","enum":[true]}},"required":["name","accept"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/renew":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"effectiveDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true},"expiryDate":{"type":"string","nullable":true},"autoRenew":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/terminate":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":2000},"effectiveDate":{"type":"string","nullable":true}},"required":["reason"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/amend":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"templateId":{"type":"string","format":"uuid","nullable":true},"summary":{"type":"string","maxLength":4000},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/signature":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["builtin","docusign"]},"signers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","maxLength":200},"role":{"type":"string","minLength":1,"maxLength":40},"title":{"type":"string","maxLength":120,"nullable":true}},"required":["name","email","role"],"additionalProperties":false},"maxItems":10},"message":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/signature/void":{"post":{"tags":["documents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["reason"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/signing-events":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"documentId":{"type":"string","format":"uuid"},"event":{"type":"string","enum":["sent","viewed","consented","signed","declined","voided"]},"actor":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"role":{"type":"string","nullable":true},"title":{"type":"string","nullable":true}},"required":["name","email","role","title"],"additionalProperties":false},"integrityHash":{"type":"string","nullable":true},"ip":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"provider":{"type":"string","enum":["builtin","docusign"]},"providerRef":{"type":"string","nullable":true},"at":{"type":"string"}},"required":["id","documentId","event","actor","integrityHash","ip","userAgent","provider","providerRef","at"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/documents/{id}/certificate":{"get":{"tags":["documents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"documentId":{"type":"string","format":"uuid"},"title":{"type":"string"},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"complete":{"type":"boolean"},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"documentId":{"type":"string","format":"uuid"},"event":{"type":"string","enum":["sent","viewed","consented","signed","declined","voided"]},"actor":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"role":{"type":"string","nullable":true},"title":{"type":"string","nullable":true}},"required":["name","email","role","title"],"additionalProperties":false},"integrityHash":{"type":"string","nullable":true},"ip":{"type":"string","nullable":true},"userAgent":{"type":"string","nullable":true},"provider":{"type":"string","enum":["builtin","docusign"]},"providerRef":{"type":"string","nullable":true},"at":{"type":"string"}},"required":["id","documentId","event","actor","integrityHash","ip","userAgent","provider","providerRef","at"],"additionalProperties":false}}},"required":["documentId","title","signingProvider","signingStatus","envelopeId","complete","events"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/signing/docusign":{"post":{"tags":["webhooks"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"updated":{"type":"number"}},"required":["updated"],"additionalProperties":false}}}}}}},"/api/commerce/plans":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"ownerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"ownerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string"},"in":"query","name":"model","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"model":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"currency":{"type":"string"},"config":{"type":"object","properties":{"unitAmount":{"type":"integer","minimum":0},"interval":{"type":"string","enum":["one_time","month","year"],"default":"month"},"includedUnits":{"type":"integer","minimum":0},"overageAmount":{"type":"integer","minimum":0},"creditUnit":{"type":"string"},"minQuantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"wholesaleDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"features":{"type":"array","items":{"type":"string"}},"externalPlanCode":{"type":"string"}},"additionalProperties":false},"isPublic":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","description","model","currency","config","isPublic","status","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"],"default":"vendor"},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","nullable":true},"model":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"config":{"type":"object","properties":{"unitAmount":{"type":"integer","minimum":0},"interval":{"type":"string","enum":["one_time","month","year"],"default":"month"},"includedUnits":{"type":"integer","minimum":0},"overageAmount":{"type":"integer","minimum":0},"creditUnit":{"type":"string"},"minQuantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"wholesaleDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"features":{"type":"array","items":{"type":"string"}},"externalPlanCode":{"type":"string"}},"additionalProperties":false,"default":{"interval":"month"}},"isPublic":{"type":"boolean","default":true},"status":{"type":"string","enum":["draft","active","archived"],"default":"active"}},"required":["name","model"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"model":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"currency":{"type":"string"},"config":{"type":"object","properties":{"unitAmount":{"type":"integer","minimum":0},"interval":{"type":"string","enum":["one_time","month","year"],"default":"month"},"includedUnits":{"type":"integer","minimum":0},"overageAmount":{"type":"integer","minimum":0},"creditUnit":{"type":"string"},"minQuantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"wholesaleDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"features":{"type":"array","items":{"type":"string"}},"externalPlanCode":{"type":"string"}},"additionalProperties":false},"isPublic":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","description","model","currency","config","isPublic","status","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/commerce/plans/{id}":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"model":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"currency":{"type":"string"},"config":{"type":"object","properties":{"unitAmount":{"type":"integer","minimum":0},"interval":{"type":"string","enum":["one_time","month","year"],"default":"month"},"includedUnits":{"type":"integer","minimum":0},"overageAmount":{"type":"integer","minimum":0},"creditUnit":{"type":"string"},"minQuantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"wholesaleDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"features":{"type":"array","items":{"type":"string"}},"externalPlanCode":{"type":"string"}},"additionalProperties":false},"isPublic":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","description","model","currency","config","isPublic","status","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/commerce/packs":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"ownerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"ownerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"credits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"bonusCredits":{"type":"integer","minimum":0},"price":{"type":"integer","minimum":0},"currency":{"type":"string"},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","credits","bonusCredits","price","currency","isActive","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"],"default":"vendor"},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":120},"credits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"bonusCredits":{"type":"integer","minimum":0,"default":0},"price":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"isActive":{"type":"boolean","default":true},"sortOrder":{"type":"integer","default":0}},"required":["name","credits","price"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"credits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"bonusCredits":{"type":"integer","minimum":0},"price":{"type":"integer","minimum":0},"currency":{"type":"string"},"isActive":{"type":"boolean"},"sortOrder":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","credits","bonusCredits","price","currency","isActive","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/commerce/packs/{id}":{"delete":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/commerce/wallets":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"ownerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"ownerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["partner","customer"]},"ownerId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credit","earnings"],"default":"credit"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true},"currency":{"type":"string"},"balance":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","currency","balance","createdAt","updatedAt"],"additionalProperties":false}}}}}}}},"/api/commerce/wallets/{id}":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["partner","customer"]},"ownerId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credit","earnings"],"default":"credit"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true},"currency":{"type":"string"},"balance":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","currency","balance","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commerce/wallets/{id}/ledger":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"walletId":{"type":"string","format":"uuid"},"delta":{"type":"integer"},"reason":{"type":"string"},"balanceAfter":{"type":"integer"},"amount":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","nullable":true},"refType":{"type":"string","nullable":true},"refId":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"}},"required":["id","walletId","delta","reason","balanceAfter","amount","currency","refType","refId","note","createdById","createdAt"],"additionalProperties":false}}}}}}}},"/api/commerce/purchase":{"post":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ownerType":{"type":"string","enum":["partner","customer"]},"ownerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"packId":{"type":"string","format":"uuid"},"credits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"note":{"type":"string","maxLength":300}},"required":["ownerType","ownerId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["partner","customer"]},"ownerId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credit","earnings"],"default":"credit"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true},"currency":{"type":"string"},"balance":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","currency","balance","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/commerce/consume":{"post":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"walletId":{"type":"string","format":"uuid"},"credits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"reason":{"type":"string","enum":["consumption","resale"],"default":"consumption"},"refType":{"type":"string","maxLength":60},"refId":{"type":"string","maxLength":120},"note":{"type":"string","maxLength":300}},"required":["walletId","credits"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["partner","customer"]},"ownerId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credit","earnings"],"default":"credit"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true},"currency":{"type":"string"},"balance":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","currency","balance","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commerce/adjust":{"post":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"walletId":{"type":"string","format":"uuid"},"delta":{"type":"integer"},"reason":{"type":"string","enum":["grant","adjustment","refund","expiry"],"default":"grant"},"note":{"type":"string","maxLength":300}},"required":["walletId","delta"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["partner","customer"]},"ownerId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credit","earnings"],"default":"credit"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true},"currency":{"type":"string"},"balance":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","currency","balance","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commerce/allocate":{"post":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fromWalletId":{"type":"string","format":"uuid"},"toOrgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"credits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"note":{"type":"string","maxLength":300}},"required":["fromWalletId","toOrgId","credits"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["partner","customer"]},"ownerId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credit","earnings"],"default":"credit"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","nullable":true},"currency":{"type":"string"},"balance":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","currency","balance","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/commerce/subscriptions":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"buyerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"buyerId","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"buyerType":{"type":"string","enum":["partner","customer"]},"buyerId":{"type":"string","format":"uuid"},"planId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["trialing","active","past_due","paused","canceled"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string"},"startedAt":{"type":"string","nullable":true},"currentPeriodEnd":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","buyerType","buyerId","planId","status","quantity","currency","startedAt","currentPeriodEnd","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"buyerType":{"type":"string","enum":["partner","customer"]},"buyerId":{"type":"string","format":"uuid"},"planId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["trialing","active","past_due","paused","canceled"],"default":"active"},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"default":1},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"startedAt":{"type":"string","nullable":true},"currentPeriodEnd":{"type":"string","nullable":true}},"required":["buyerType","buyerId","planId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"buyerType":{"type":"string","enum":["partner","customer"]},"buyerId":{"type":"string","format":"uuid"},"planId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["trialing","active","past_due","paused","canceled"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string"},"startedAt":{"type":"string","nullable":true},"currentPeriodEnd":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","buyerType","buyerId","planId","status","quantity","currency","startedAt","currentPeriodEnd","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/commerce/price-books":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false},{"schema":{"type":"string"},"in":"query","name":"tier","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"currency":{"type":"string"},"productId":{"type":"string","format":"uuid","nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"basePlanId":{"type":"string","format":"uuid","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"unit":{"type":"string"},"wholesaleAmount":{"type":"integer","minimum":0},"retailAmount":{"type":"integer","minimum":0},"retailModel":{"type":"string","enum":["markup_bps","margin_bps","fixed_price"],"default":"fixed_price"},"rateBps":{"type":"integer","minimum":0},"creditsPerUnit":{"type":"integer","exclusiveMinimum":true,"minimum":0}},"required":["id","label","unit","wholesaleAmount","retailAmount"],"additionalProperties":false}},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","name","description","currency","productId","tier","basePlanId","items","commercialPolicy","isActive","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["commerce"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"productId":{"type":"string","format":"uuid","nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"basePlanId":{"type":"string","format":"uuid","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"unit":{"type":"string"},"wholesaleAmount":{"type":"integer","minimum":0},"retailAmount":{"type":"integer","minimum":0},"retailModel":{"type":"string","enum":["markup_bps","margin_bps","fixed_price"],"default":"fixed_price"},"rateBps":{"type":"integer","minimum":0},"creditsPerUnit":{"type":"integer","exclusiveMinimum":true,"minimum":0}},"required":["id","label","unit","wholesaleAmount","retailAmount"],"additionalProperties":false},"default":[]},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"isActive":{"type":"boolean","default":true}},"required":["partnerId","name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"currency":{"type":"string"},"productId":{"type":"string","format":"uuid","nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"basePlanId":{"type":"string","format":"uuid","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"unit":{"type":"string"},"wholesaleAmount":{"type":"integer","minimum":0},"retailAmount":{"type":"integer","minimum":0},"retailModel":{"type":"string","enum":["markup_bps","margin_bps","fixed_price"],"default":"fixed_price"},"rateBps":{"type":"integer","minimum":0},"creditsPerUnit":{"type":"integer","exclusiveMinimum":true,"minimum":0}},"required":["id","label","unit","wholesaleAmount","retailAmount"],"additionalProperties":false}},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","name","description","currency","productId","tier","basePlanId","items","commercialPolicy","isActive","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/commerce/price-books/{id}":{"get":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"currency":{"type":"string"},"productId":{"type":"string","format":"uuid","nullable":true},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"nullable":true},"basePlanId":{"type":"string","format":"uuid","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"unit":{"type":"string"},"wholesaleAmount":{"type":"integer","minimum":0},"retailAmount":{"type":"integer","minimum":0},"retailModel":{"type":"string","enum":["markup_bps","margin_bps","fixed_price"],"default":"fixed_price"},"rateBps":{"type":"integer","minimum":0},"creditsPerUnit":{"type":"integer","exclusiveMinimum":true,"minimum":0}},"required":["id","label","unit","wholesaleAmount","retailAmount"],"additionalProperties":false}},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","name","description","currency","productId","tier","basePlanId","items","commercialPolicy","isActive","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["commerce"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/products":{"get":{"tags":["products"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"vendorOrgId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"vendorName":{"type":"string"},"partnerBills":{"type":"boolean"}},"required":["id","vendorOrgId","name","description","category","status","commercialPolicy","createdAt","updatedAt","vendorName"],"additionalProperties":false}}}}}}},"put":{"tags":["products"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"vendorOrgId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":2000,"nullable":true},"category":{"type":"string","maxLength":80,"nullable":true},"status":{"type":"string","enum":["draft","active","archived"],"default":"active"},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"vendorOrgId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","vendorOrgId","name","description","category","status","commercialPolicy","createdAt","updatedAt"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/products/{id}":{"get":{"tags":["products"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"vendorOrgId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"commercialPolicy":{"type":"object","properties":{"platformType":{"type":"string","enum":["saas","shopify_app","wordpress","web","self_hosted","other"]},"billingModes":{"type":"array","items":{"type":"string","enum":["commission","resale","credits"]},"minItems":1},"whitelabelAllowed":{"type":"boolean"},"customPricingAllowed":{"type":"boolean"},"sellerOfRecord":{"type":"string","enum":["vendor","partner"]},"creditScope":{"type":"string","enum":["org","product","catalogue"]},"volumeTiers":{"type":"array","items":{"type":"object","properties":{"minCredits":{"type":"integer","exclusiveMinimum":true,"minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000}},"required":["minCredits","discountBps"],"additionalProperties":false}},"attributionModel":{"type":"string","enum":["last_click","first_click"]}},"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","vendorOrgId","name","description","category","status","commercialPolicy","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["products"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/providers":{"get":{"tags":["providers"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"ownerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"ownerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner","customer"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["gemini","openai","anthropic","azure_openai","vertex","bedrock","mistral","cohere","custom"]},"label":{"type":"string"},"maskedKey":{"type":"string"},"model":{"type":"string","nullable":true},"baseUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"lastUsedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","provider","label","maskedKey","model","baseUrl","isActive","lastUsedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["providers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ownerType":{"type":"string","enum":["vendor","partner","customer"],"default":"vendor"},"ownerId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["gemini","openai","anthropic","azure_openai","vertex","bedrock","mistral","cohere","custom"]},"label":{"type":"string","minLength":1,"maxLength":120},"apiKey":{"type":"string","minLength":8,"maxLength":400},"model":{"type":"string","maxLength":120,"nullable":true},"baseUrl":{"type":"string","maxLength":300,"nullable":true},"isActive":{"type":"boolean","default":true}},"required":["provider","label","apiKey"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner","customer"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["gemini","openai","anthropic","azure_openai","vertex","bedrock","mistral","cohere","custom"]},"label":{"type":"string"},"maskedKey":{"type":"string"},"model":{"type":"string","nullable":true},"baseUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"lastUsedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","provider","label","maskedKey","model","baseUrl","isActive","lastUsedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/providers/{id}":{"patch":{"tags":["providers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"apiKey":{"type":"string","minLength":8,"maxLength":400},"model":{"type":"string","maxLength":120,"nullable":true},"baseUrl":{"type":"string","maxLength":300,"nullable":true},"isActive":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner","customer"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["gemini","openai","anthropic","azure_openai","vertex","bedrock","mistral","cohere","custom"]},"label":{"type":"string"},"maskedKey":{"type":"string"},"model":{"type":"string","nullable":true},"baseUrl":{"type":"string","nullable":true},"isActive":{"type":"boolean"},"lastUsedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","provider","label","maskedKey","model","baseUrl","isActive","lastUsedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["providers"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}}},"/api/ai/runs":{"get":{"tags":["ai"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","maxLength":80},"in":"query","name":"feature","required":false},{"schema":{"type":"string","enum":["ok","error"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"userId":{"type":"string","format":"uuid","nullable":true},"feature":{"type":"string"},"provider":{"type":"string"},"model":{"type":"string"},"status":{"type":"string","enum":["ok","error"]},"inputTokens":{"type":"integer"},"outputTokens":{"type":"integer"},"costMicros":{"type":"integer"},"latencyMs":{"type":"integer"},"subjectType":{"type":"string","nullable":true},"subjectId":{"type":"string","format":"uuid","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","userId","feature","provider","model","status","inputTokens","outputTokens","costMicros","latencyMs","subjectType","subjectId","error","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/ai/usage":{"get":{"tags":["ai"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":365,"default":30},"in":"query","name":"days","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"days":{"type":"integer"},"since":{"type":"string"},"totals":{"type":"object","properties":{"calls":{"type":"integer"},"errors":{"type":"integer"},"inputTokens":{"type":"integer"},"outputTokens":{"type":"integer"},"costMicros":{"type":"integer","default":0}},"required":["calls","errors","inputTokens","outputTokens"],"additionalProperties":false},"rows":{"type":"array","items":{"type":"object","properties":{"feature":{"type":"string"},"provider":{"type":"string"},"calls":{"type":"integer"},"errors":{"type":"integer"},"inputTokens":{"type":"integer"},"outputTokens":{"type":"integer"},"costMicros":{"type":"integer","default":0},"avgLatencyMs":{"type":"integer"}},"required":["feature","provider","calls","errors","inputTokens","outputTokens","avgLatencyMs"],"additionalProperties":false}}},"required":["days","since","totals","rows"],"additionalProperties":false}}}}}}},"/api/ai/budget":{"get":{"tags":["ai"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"monthlyTokenLimit":{"type":"integer","nullable":true},"hardStop":{"type":"boolean"},"alertPct":{"type":"integer","minimum":1,"maximum":100},"month":{"type":"object","properties":{"start":{"type":"string"},"usedTokens":{"type":"integer"},"costMicros":{"type":"integer"},"pct":{"type":"number","nullable":true},"alertSent":{"type":"boolean"}},"required":["start","usedTokens","costMicros","pct","alertSent"],"additionalProperties":false}},"required":["monthlyTokenLimit","hardStop","alertPct","month"],"additionalProperties":false}}}}}},"put":{"tags":["ai"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"monthlyTokenLimit":{"type":"integer","minimum":0,"maximum":2000000000,"nullable":true},"hardStop":{"type":"boolean"},"alertPct":{"type":"integer","minimum":1,"maximum":100}},"required":["monthlyTokenLimit"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"monthlyTokenLimit":{"type":"integer","nullable":true},"hardStop":{"type":"boolean"},"alertPct":{"type":"integer","minimum":1,"maximum":100},"month":{"type":"object","properties":{"start":{"type":"string"},"usedTokens":{"type":"integer"},"costMicros":{"type":"integer"},"pct":{"type":"number","nullable":true},"alertSent":{"type":"boolean"}},"required":["start","usedTokens","costMicros","pct","alertSent"],"additionalProperties":false}},"required":["monthlyTokenLimit","hardStop","alertPct","month"],"additionalProperties":false}}}}}}},"/api/ai/status":{"get":{"tags":["ai"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"available":{"type":"boolean"},"provider":{"type":"string","nullable":true}},"required":["available","provider"],"additionalProperties":false}}}}}}},"/api/ai/program-designer/draft":{"post":{"tags":["ai"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"goals":{"type":"string","maxLength":4000},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"template":{"type":"boolean"}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["ai","template"]},"provider":{"type":"string","nullable":true},"model":{"type":"string","nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"]},"fallbackReason":{"type":"string","nullable":true},"draft":{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":2000},"partnerTypes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"default":""}},"required":["type","label"],"additionalProperties":false},"maxItems":8,"default":[]},"groups":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"default":""},"kind":{"type":"string","enum":["static","dynamic"],"default":"static"},"tiers":{"type":"array","items":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"maxItems":5},"types":{"type":"array","items":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"maxItems":8}},"required":["name"],"additionalProperties":false},"maxItems":10,"default":[]},"commissionRules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":2000,"nullable":true},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"priority":{"type":"integer","minimum":-1000,"maximum":1000},"config":{"type":"object","additionalProperties":{}}},"required":["name","type","config"],"additionalProperties":false},"maxItems":10,"default":[]},"tiers":{"type":"array","items":{"type":"object","properties":{"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"label":{"type":"string","maxLength":100,"nullable":true},"rank":{"type":"integer","minimum":0},"minPoints":{"type":"integer","minimum":0,"default":0},"minCustomers":{"type":"integer","minimum":0,"default":0},"minWonDeals":{"type":"integer","minimum":0,"default":0},"benefits":{"type":"string","maxLength":2000,"nullable":true}},"required":["tier","rank"],"additionalProperties":false},"maxItems":5,"default":[]},"missions":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"missions":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"points":{"type":"integer","minimum":0,"maximum":100000,"default":0},"eventType":{"type":"string","maxLength":100,"nullable":true}},"required":["title"],"additionalProperties":false},"maxItems":20,"default":[]}},"required":["name"],"additionalProperties":false,"nullable":true,"default":null},"onboarding":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9_]+$"},"label":{"type":"string","minLength":1,"maxLength":80},"color":{"type":"string","enum":["grey","green","red","blue","orange","purple"]}},"required":["key","label"],"additionalProperties":false},"minItems":2,"maxItems":12}},"required":["name","stages"],"additionalProperties":false,"nullable":true,"default":null},"materials":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1,"maxLength":200},"outline":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]}},"required":["kind","title"],"additionalProperties":false},"maxItems":8,"default":[]},"listing":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"tagline":{"type":"string","maxLength":240,"nullable":true},"description":{"type":"string","maxLength":20000,"nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"],"default":"other"},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"minItems":1},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":60,"default":[]},"perks":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":20,"default":[]},"requirements":{"type":"string","maxLength":5000,"nullable":true},"commissionSummary":{"type":"string","maxLength":200,"nullable":true}},"required":["title","partnerKinds"],"additionalProperties":false,"nullable":true,"default":null}},"required":["summary"],"additionalProperties":false}},"required":["source","provider","model","businessType","fallbackReason","draft"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/ai/program-designer/apply":{"post":{"tags":["ai"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"idempotencyKey":{"type":"string","minLength":8,"maxLength":120},"parts":{"type":"array","items":{"type":"string","enum":["partnerTypes","groups","commissionRules","tiers","missions","onboarding","materials","listing"]},"minItems":1},"draft":{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":2000},"partnerTypes":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"label":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"default":""}},"required":["type","label"],"additionalProperties":false},"maxItems":8,"default":[]},"groups":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"default":""},"kind":{"type":"string","enum":["static","dynamic"],"default":"static"},"tiers":{"type":"array","items":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"maxItems":5},"types":{"type":"array","items":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"maxItems":8}},"required":["name"],"additionalProperties":false},"maxItems":10,"default":[]},"commissionRules":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"description":{"type":"string","maxLength":2000,"nullable":true},"type":{"type":"string","enum":["percent_of_deal","recurring_mrr","per_unit","tiered","bonus","cap","clawback","override"]},"priority":{"type":"integer","minimum":-1000,"maximum":1000},"config":{"type":"object","additionalProperties":{}}},"required":["name","type","config"],"additionalProperties":false},"maxItems":10,"default":[]},"tiers":{"type":"array","items":{"type":"object","properties":{"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"label":{"type":"string","maxLength":100,"nullable":true},"rank":{"type":"integer","minimum":0},"minPoints":{"type":"integer","minimum":0,"default":0},"minCustomers":{"type":"integer","minimum":0,"default":0},"minWonDeals":{"type":"integer","minimum":0,"default":0},"benefits":{"type":"string","maxLength":2000,"nullable":true}},"required":["tier","rank"],"additionalProperties":false},"maxItems":5,"default":[]},"missions":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"missions":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"points":{"type":"integer","minimum":0,"maximum":100000,"default":0},"eventType":{"type":"string","maxLength":100,"nullable":true}},"required":["title"],"additionalProperties":false},"maxItems":20,"default":[]}},"required":["name"],"additionalProperties":false,"nullable":true,"default":null},"onboarding":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"stages":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z0-9_]+$"},"label":{"type":"string","minLength":1,"maxLength":80},"color":{"type":"string","enum":["grey","green","red","blue","orange","purple"]}},"required":["key","label"],"additionalProperties":false},"minItems":2,"maxItems":12}},"required":["name","stages"],"additionalProperties":false,"nullable":true,"default":null},"materials":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1,"maxLength":200},"outline":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]}},"required":["kind","title"],"additionalProperties":false},"maxItems":8,"default":[]},"listing":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"tagline":{"type":"string","maxLength":240,"nullable":true},"description":{"type":"string","maxLength":20000,"nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"],"default":"other"},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"minItems":1},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":60,"default":[]},"perks":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":20,"default":[]},"requirements":{"type":"string","maxLength":5000,"nullable":true},"commissionSummary":{"type":"string","maxLength":200,"nullable":true}},"required":["title","partnerKinds"],"additionalProperties":false,"nullable":true,"default":null}},"required":["summary"],"additionalProperties":false},"activateRules":{"type":"boolean","default":true}},"required":["idempotencyKey","parts","draft"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"idempotencyKey":{"type":"string"},"replayed":{"type":"boolean"},"appliedAt":{"type":"string"},"results":{"type":"array","items":{"type":"object","properties":{"part":{"type":"string","enum":["partnerTypes","groups","commissionRules","tiers","missions","onboarding","materials","listing"]},"status":{"type":"string","enum":["created","updated","skipped","failed"]},"message":{"type":"string","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"id":{"type":"string","nullable":true},"name":{"type":"string"},"status":{"type":"string","enum":["created","updated","skipped","failed"]}},"required":["kind","id","name","status"],"additionalProperties":false}}},"required":["part","status","message","items"],"additionalProperties":false}}},"required":["idempotencyKey","replayed","appliedAt","results"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/compliance":{"get":{"tags":["compliance"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"ownerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"ownerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner","customer"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"region":{"type":"string","enum":["us_east","us_west","eu_frankfurt","eu_ireland","uk_london","ca_central","ap_sydney","ap_singapore","ap_mumbai","sa_saopaulo"]},"dataResidency":{"type":"string","enum":["US","EU","UK","CA","APAC","IN","BR"]},"frameworks":{"type":"array","items":{"type":"string","enum":["gdpr","ccpa","hipaa","soc2","iso27001","pci_dss"]}},"dpaSigned":{"type":"boolean"},"subprocessorsAck":{"type":"boolean"},"crossBorderTransfers":{"type":"boolean"},"retentionDays":{"type":"integer","minimum":0},"breachNotifyHours":{"type":"integer","minimum":0},"dpoName":{"type":"string","nullable":true},"dpoEmail":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","region","dataResidency","frameworks","dpaSigned","subprocessorsAck","crossBorderTransfers","retentionDays","breachNotifyHours","dpoName","dpoEmail","notes","createdAt","updatedAt"],"additionalProperties":false}}}}}},"put":{"tags":["compliance"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ownerType":{"type":"string","enum":["vendor","partner","customer"],"default":"vendor"},"ownerId":{"type":"string","format":"uuid","nullable":true},"region":{"type":"string","enum":["us_east","us_west","eu_frankfurt","eu_ireland","uk_london","ca_central","ap_sydney","ap_singapore","ap_mumbai","sa_saopaulo"],"default":"us_east"},"dataResidency":{"type":"string","enum":["US","EU","UK","CA","APAC","IN","BR"],"default":"US"},"frameworks":{"type":"array","items":{"type":"string","enum":["gdpr","ccpa","hipaa","soc2","iso27001","pci_dss"]},"default":[]},"dpaSigned":{"type":"boolean","default":false},"subprocessorsAck":{"type":"boolean","default":false},"crossBorderTransfers":{"type":"boolean","default":false},"retentionDays":{"type":"integer","minimum":0,"default":395},"breachNotifyHours":{"type":"integer","minimum":0,"default":72},"dpoName":{"type":"string","maxLength":160,"nullable":true},"dpoEmail":{"type":"string","maxLength":200,"nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner","customer"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"region":{"type":"string","enum":["us_east","us_west","eu_frankfurt","eu_ireland","uk_london","ca_central","ap_sydney","ap_singapore","ap_mumbai","sa_saopaulo"]},"dataResidency":{"type":"string","enum":["US","EU","UK","CA","APAC","IN","BR"]},"frameworks":{"type":"array","items":{"type":"string","enum":["gdpr","ccpa","hipaa","soc2","iso27001","pci_dss"]}},"dpaSigned":{"type":"boolean"},"subprocessorsAck":{"type":"boolean"},"crossBorderTransfers":{"type":"boolean"},"retentionDays":{"type":"integer","minimum":0},"breachNotifyHours":{"type":"integer","minimum":0},"dpoName":{"type":"string","nullable":true},"dpoEmail":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","region","dataResidency","frameworks","dpaSigned","subprocessorsAck","crossBorderTransfers","retentionDays","breachNotifyHours","dpoName","dpoEmail","notes","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/public/pages/{token}":{"get":{"tags":["public"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}}},"required":["kind","title","blocks"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/uploads":{"post":{"tags":["uploads"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}}}}},"/api/whitelabel":{"get":{"tags":["whitelabel"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"eligible":{"type":"boolean"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","submitted","in_review","approved","changes_requested","archived"]},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"supportEmail":{"type":"string","format":"email","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","format":"email","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"dkimPublicKey":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"submittedAt":{"type":"string","nullable":true},"approvedAt":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","status","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","dkimSelector","dkimPublicKey","footerText","fontFamily","fontUrl","decisionNote","submittedAt","approvedAt","publishedAt","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"completion":{"type":"object","properties":{"percent":{"type":"integer","minimum":0,"maximum":100},"missing":{"type":"array","items":{"type":"string"}},"ready":{"type":"boolean"}},"required":["percent","missing","ready"],"additionalProperties":false},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}},"hasEmailSecret":{"type":"boolean"},"live":{"type":"object","properties":{"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true}},"required":["brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","fontFamily","fontUrl","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","footerText"],"additionalProperties":false,"nullable":true},"pendingChanges":{"type":"array","items":{"type":"string"}}},"required":["eligible","profile","completion","domains","hasEmailSecret","live","pendingChanges"],"additionalProperties":false}}}}}},"patch":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"brandName":{"type":"string","maxLength":200,"nullable":true},"logoUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"iconUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"faviconUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"primaryColor":{"type":"string","pattern":"^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$","nullable":true},"accentColor":{"type":"string","pattern":"^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$","nullable":true},"supportEmail":{"type":"string","format":"email","nullable":true},"supportUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"termsUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"privacyUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"billingUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"senderName":{"type":"string","maxLength":200,"nullable":true},"senderEmail":{"type":"string","format":"email","nullable":true},"footerText":{"type":"string","maxLength":2000,"nullable":true},"fontFamily":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9 -]*$","nullable":true},"fontUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","submitted","in_review","approved","changes_requested","archived"]},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"supportEmail":{"type":"string","format":"email","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","format":"email","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"dkimPublicKey":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"submittedAt":{"type":"string","nullable":true},"approvedAt":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","status","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","dkimSelector","dkimPublicKey","footerText","fontFamily","fontUrl","decisionNote","submittedAt","approvedAt","publishedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/submit":{"post":{"tags":["whitelabel"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","submitted","in_review","approved","changes_requested","archived"]},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"supportEmail":{"type":"string","format":"email","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","format":"email","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"dkimPublicKey":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"submittedAt":{"type":"string","nullable":true},"approvedAt":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","status","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","dkimSelector","dkimPublicKey","footerText","fontFamily","fontUrl","decisionNote","submittedAt","approvedAt","publishedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/email-secret":{"get":{"tags":["whitelabel"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"hasSecret":{"type":"boolean"},"preview":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true}},"required":["orgId","hasSecret","preview","senderDomain","dkimSelector"],"additionalProperties":false}}}}}},"post":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"secret":{"type":"string","minLength":8,"maxLength":8000},"senderDomain":{"type":"string","minLength":1,"maxLength":253,"pattern":"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$","nullable":true},"dkimSelector":{"type":"string","maxLength":100,"nullable":true},"dkimPublicKey":{"type":"string","maxLength":8000,"nullable":true}},"required":["secret"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"hasSecret":{"type":"boolean"},"preview":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true}},"required":["orgId","hasSecret","preview","senderDomain","dkimSelector"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/domains":{"post":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","minLength":1,"maxLength":253,"pattern":"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true}},"required":["domain"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/domains/{id}/verify":{"post":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/domains/{id}/recheck":{"post":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/domains/{id}":{"patch":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true}},"required":["purpose"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin/{orgId}/domains/{id}":{"patch":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true}},"required":["purpose"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin/{orgId}/domains/{id}/verify":{"post":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin/{orgId}/domains/{id}/recheck":{"post":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/public/brand":{"get":{"tags":["whitelabel"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true}},"required":["orgId","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","fontFamily","fontUrl"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/tls-check":{"get":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"domain","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin":{"get":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","submitted","in_review","approved","changes_requested","archived"]},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"supportEmail":{"type":"string","format":"email","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","format":"email","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"dkimPublicKey":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"submittedAt":{"type":"string","nullable":true},"approvedAt":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","status","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","dkimSelector","dkimPublicKey","footerText","fontFamily","fontUrl","decisionNote","submittedAt","approvedAt","publishedAt","createdAt","updatedAt"],"additionalProperties":false},"completion":{"type":"object","properties":{"percent":{"type":"integer","minimum":0,"maximum":100},"missing":{"type":"array","items":{"type":"string"}},"ready":{"type":"boolean"}},"required":["percent","missing","ready"],"additionalProperties":false},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}},"hasEmailSecret":{"type":"boolean"},"live":{"type":"object","properties":{"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true}},"required":["brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","fontFamily","fontUrl","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","footerText"],"additionalProperties":false,"nullable":true},"pendingChanges":{"type":"array","items":{"type":"string"}}},"required":["orgId","orgName","profile","completion","domains","hasEmailSecret","live","pendingChanges"],"additionalProperties":false}}}}}}}},"/api/whitelabel/admin/{orgId}":{"get":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","submitted","in_review","approved","changes_requested","archived"]},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"supportEmail":{"type":"string","format":"email","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","format":"email","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"dkimPublicKey":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"submittedAt":{"type":"string","nullable":true},"approvedAt":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","status","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","dkimSelector","dkimPublicKey","footerText","fontFamily","fontUrl","decisionNote","submittedAt","approvedAt","publishedAt","createdAt","updatedAt"],"additionalProperties":false},"completion":{"type":"object","properties":{"percent":{"type":"integer","minimum":0,"maximum":100},"missing":{"type":"array","items":{"type":"string"}},"ready":{"type":"boolean"}},"required":["percent","missing","ready"],"additionalProperties":false},"domains":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"purpose":{"type":"string","enum":["portal","vendor_app"]},"vendorOrgId":{"type":"string","format":"uuid","nullable":true},"verifyToken":{"type":"string"},"verifiedAt":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"lastProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"ownership":{"type":"object","properties":{"checkedAt":{"type":"string"},"ok":{"type":"boolean"},"failures":{"type":"integer","minimum":0},"lapsedAt":{"type":"string","nullable":true}},"required":["checkedAt","ok","failures","lapsedAt"],"additionalProperties":false,"nullable":true},"cnameTarget":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","domain","purpose","vendorOrgId","verifyToken","verifiedAt","vendorChallenge","lastProbe","ownership","cnameTarget","createdAt","updatedAt"],"additionalProperties":false}},"hasEmailSecret":{"type":"boolean"},"live":{"type":"object","properties":{"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true}},"required":["brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","fontFamily","fontUrl","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","footerText"],"additionalProperties":false,"nullable":true},"pendingChanges":{"type":"array","items":{"type":"string"}}},"required":["orgId","orgName","profile","completion","domains","hasEmailSecret","live","pendingChanges"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin/{orgId}/advance":{"post":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["in_review","approved","changes_requested","archived"]},"decisionNote":{"type":"string","maxLength":5000,"nullable":true}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","submitted","in_review","approved","changes_requested","archived"]},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"supportEmail":{"type":"string","format":"email","nullable":true},"supportUrl":{"type":"string","nullable":true},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","format":"email","nullable":true},"senderDomain":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"dkimPublicKey":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"submittedAt":{"type":"string","nullable":true},"approvedAt":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","status","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","supportEmail","supportUrl","termsUrl","privacyUrl","billingUrl","senderName","senderEmail","senderDomain","dkimSelector","dkimPublicKey","footerText","fontFamily","fontUrl","decisionNote","submittedAt","approvedAt","publishedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin/{orgId}/eligibility":{"post":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"whitelabelEnabled":{"type":"boolean"}},"required":["orgId","whitelabelEnabled"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mail/send":{"post":{"tags":["mail"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid","nullable":true},"customerExternalId":{"type":"string","minLength":1,"maxLength":255,"nullable":true},"to":{"anyOf":[{"type":"string","format":"email","maxLength":254},{"type":"array","items":{"type":"string","format":"email","maxLength":254},"minItems":1,"maxItems":50}]},"subject":{"type":"string","minLength":1,"maxLength":998},"html":{"type":"string","maxLength":512000,"nullable":true},"text":{"type":"string","maxLength":256000,"nullable":true},"replyTo":{"type":"string","format":"email","maxLength":254,"nullable":true},"idempotencyKey":{"type":"string","minLength":1,"maxLength":255,"nullable":true},"category":{"type":"string","enum":["transactional","marketing"],"default":"transactional"},"headers":{"type":"object","additionalProperties":{"type":"string","maxLength":2000}},"tags":{}},"required":["to","subject"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","sent","failed"]},"branded":{"type":"boolean"},"from":{"type":"object","properties":{"name":{"type":"string","nullable":true},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"required":["id","status","branded","from"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/mail/send\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"partnerId\": \"00000000-0000-4000-8000-000000000010\",\n  \"to\": \"jane@customer.example.com\",\n  \"subject\": \"Your invoice for October\",\n  \"html\": \"<p>Hi Jane, your invoice is attached.</p>\",\n  \"text\": \"Hi Jane, your invoice is attached.\",\n  \"idempotencyKey\": \"invoice:inv_2026_10_123\",\n  \"category\": \"transactional\"\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/mail/send\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"partnerId\": \"00000000-0000-4000-8000-000000000010\",\n    \"to\": \"jane@customer.example.com\",\n    \"subject\": \"Your invoice for October\",\n    \"html\": \"<p>Hi Jane, your invoice is attached.</p>\",\n    \"text\": \"Hi Jane, your invoice is attached.\",\n    \"idempotencyKey\": \"invoice:inv_2026_10_123\",\n    \"category\": \"transactional\"\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/mail/send\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    json={\n      \"partnerId\": \"00000000-0000-4000-8000-000000000010\",\n      \"to\": \"jane@customer.example.com\",\n      \"subject\": \"Your invoice for October\",\n      \"html\": \"<p>Hi Jane, your invoice is attached.</p>\",\n      \"text\": \"Hi Jane, your invoice is attached.\",\n      \"idempotencyKey\": \"invoice:inv_2026_10_123\",\n      \"category\": \"transactional\"\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters; `idempotencyKey` in the body wins when both are sent. A repeat with the same key returns the original message (kept for at least 7 days; in practice we never purge them). The same key with a different message is `422 idempotency_key_mismatch`. A retryable failure (`503`) is sent again on the next call with the same key.","schema":{"type":"string","maxLength":255}}]}},"/api/mail/messages/{id}":{"get":{"tags":["mail"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["queued","sent","failed"]},"branded":{"type":"boolean"},"from":{"type":"object","properties":{"name":{"type":"string","nullable":true},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},"orgId":{"type":"string","format":"uuid"},"environment":{"type":"string","enum":["live","test"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"to":{"type":"array","items":{"type":"string"}},"subject":{"type":"string"},"category":{"type":"string","enum":["transactional","marketing"]},"idempotencyKey":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"attempts":{"type":"integer"},"sentAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","status","branded","from","orgId","environment","partnerId","customerId","to","subject","category","idempotencyKey","error","attempts","sentAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/mail-sender":{"get":{"tags":["whitelabel"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["managed","byo"],"nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","verified","failed"],"nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"lastError":{"type":"string","nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["dkim","spf","dmarc"]},"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"},"required":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unchecked"]},"note":{"type":"string","nullable":true}},"required":["purpose","type","host","value","required","state","note"],"additionalProperties":false}},"brandLive":{"type":"boolean"},"active":{"type":"boolean"},"inactiveReason":{"type":"string","nullable":true}},"required":["orgId","mode","senderName","senderEmail","senderDomain","replyTo","dkimSelector","status","lastCheckedAt","verifiedAt","lastError","records","brandLive","active","inactiveReason"],"additionalProperties":false}}}}}},"put":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"senderName":{"type":"string","minLength":1,"maxLength":120},"senderEmail":{"type":"string","format":"email","maxLength":254},"replyTo":{"type":"string","format":"email","maxLength":254,"nullable":true},"rotateKey":{"type":"boolean"}},"required":["senderName","senderEmail"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["managed","byo"],"nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","verified","failed"],"nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"lastError":{"type":"string","nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["dkim","spf","dmarc"]},"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"},"required":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unchecked"]},"note":{"type":"string","nullable":true}},"required":["purpose","type","host","value","required","state","note"],"additionalProperties":false}},"brandLive":{"type":"boolean"},"active":{"type":"boolean"},"inactiveReason":{"type":"string","nullable":true}},"required":["orgId","mode","senderName","senderEmail","senderDomain","replyTo","dkimSelector","status","lastCheckedAt","verifiedAt","lastError","records","brandLive","active","inactiveReason"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/mail-sender/verify":{"post":{"tags":["whitelabel"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["managed","byo"],"nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","verified","failed"],"nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"lastError":{"type":"string","nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["dkim","spf","dmarc"]},"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"},"required":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unchecked"]},"note":{"type":"string","nullable":true}},"required":["purpose","type","host","value","required","state","note"],"additionalProperties":false}},"brandLive":{"type":"boolean"},"active":{"type":"boolean"},"inactiveReason":{"type":"string","nullable":true}},"required":["orgId","mode","senderName","senderEmail","senderDomain","replyTo","dkimSelector","status","lastCheckedAt","verifiedAt","lastError","records","brandLive","active","inactiveReason"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin/mail-senders":{"get":{"tags":["whitelabel"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["managed","byo"],"nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","verified","failed"],"nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"lastError":{"type":"string","nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["dkim","spf","dmarc"]},"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"},"required":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unchecked"]},"note":{"type":"string","nullable":true}},"required":["purpose","type","host","value","required","state","note"],"additionalProperties":false}},"brandLive":{"type":"boolean"},"active":{"type":"boolean"},"inactiveReason":{"type":"string","nullable":true},"orgName":{"type":"string"}},"required":["orgId","mode","senderName","senderEmail","senderDomain","replyTo","dkimSelector","status","lastCheckedAt","verifiedAt","lastError","records","brandLive","active","inactiveReason","orgName"],"additionalProperties":false}}}}}}}},"/api/whitelabel/admin/{orgId}/mail-sender":{"get":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["managed","byo"],"nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","verified","failed"],"nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"lastError":{"type":"string","nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["dkim","spf","dmarc"]},"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"},"required":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unchecked"]},"note":{"type":"string","nullable":true}},"required":["purpose","type","host","value","required","state","note"],"additionalProperties":false}},"brandLive":{"type":"boolean"},"active":{"type":"boolean"},"inactiveReason":{"type":"string","nullable":true}},"required":["orgId","mode","senderName","senderEmail","senderDomain","replyTo","dkimSelector","status","lastCheckedAt","verifiedAt","lastError","records","brandLive","active","inactiveReason"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["whitelabel"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"senderName":{"type":"string","minLength":1,"maxLength":120},"senderEmail":{"type":"string","format":"email","maxLength":254},"replyTo":{"type":"string","format":"email","maxLength":254,"nullable":true},"rotateKey":{"type":"boolean"}},"required":["senderName","senderEmail"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["managed","byo"],"nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","verified","failed"],"nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"lastError":{"type":"string","nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["dkim","spf","dmarc"]},"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"},"required":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unchecked"]},"note":{"type":"string","nullable":true}},"required":["purpose","type","host","value","required","state","note"],"additionalProperties":false}},"brandLive":{"type":"boolean"},"active":{"type":"boolean"},"inactiveReason":{"type":"string","nullable":true}},"required":["orgId","mode","senderName","senderEmail","senderDomain","replyTo","dkimSelector","status","lastCheckedAt","verifiedAt","lastError","records","brandLive","active","inactiveReason"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/whitelabel/admin/{orgId}/mail-sender/verify":{"post":{"tags":["whitelabel"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"orgId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"mode":{"type":"string","enum":["managed","byo"],"nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true},"replyTo":{"type":"string","nullable":true},"dkimSelector":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","verified","failed"],"nullable":true},"lastCheckedAt":{"type":"string","format":"date-time","nullable":true},"verifiedAt":{"type":"string","format":"date-time","nullable":true},"lastError":{"type":"string","nullable":true},"records":{"type":"array","items":{"type":"object","properties":{"purpose":{"type":"string","enum":["dkim","spf","dmarc"]},"type":{"type":"string","enum":["TXT"]},"host":{"type":"string"},"value":{"type":"string"},"required":{"type":"boolean"},"state":{"type":"string","enum":["found","missing","mismatch","unchecked"]},"note":{"type":"string","nullable":true}},"required":["purpose","type","host","value","required","state","note"],"additionalProperties":false}},"brandLive":{"type":"boolean"},"active":{"type":"boolean"},"inactiveReason":{"type":"string","nullable":true}},"required":["orgId","mode","senderName","senderEmail","senderDomain","replyTo","dkimSelector","status","lastCheckedAt","verifiedAt","lastError","records","brandLive","active","inactiveReason"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/sheets/import":{"post":{"tags":["integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":2000},"target":{"type":"string","enum":["leads","partners"]},"dryRun":{"type":"boolean","default":false},"defaultPartnerType":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]}},"required":["url","target"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"target":{"type":"string","enum":["leads","partners"]},"dryRun":{"type":"boolean"},"columns":{"type":"array","items":{"type":"string"}},"rows":{"type":"integer"},"created":{"type":"integer"},"skipped":{"type":"integer"},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"message":{"type":"string"}},"required":["row","message"],"additionalProperties":false}},"sample":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}}}},"required":["target","dryRun","columns","rows","created","skipped","errors","sample"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/connections":{"get":{"tags":["integrations"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"provider","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["rest","generic_webhook","shopify","wordpress","stripe","chargebee","recurly","paddle","hubspot","salesforce","slack","gemini","pipedrive","microsoft_teams","google_chat","google_sheets","paypal","wise","ipqualityscore","maxmind","crossbeam"]},"kind":{"type":"string","enum":["api_key","oauth2"]},"label":{"type":"string"},"status":{"type":"string","enum":["active","error","revoked"]},"environment":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","additionalProperties":{}},"signed":{"type":"boolean","default":false},"signingSecretRotatedAt":{"type":"string","nullable":true,"default":null},"lastUsedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","productId","provider","kind","label","status","environment","scopes","metadata","lastUsedAt","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"provider":{"type":"string","enum":["rest","generic_webhook","shopify","wordpress","stripe","chargebee","recurly","paddle","hubspot","salesforce","slack","gemini","pipedrive","microsoft_teams","google_chat","google_sheets","paypal","wise","ipqualityscore","maxmind","crossbeam"]},"kind":{"type":"string","enum":["api_key","oauth2"]},"productId":{"type":"string","format":"uuid"},"environment":{"type":"string","enum":["live","test"]},"secret":{"type":"string","minLength":1,"maxLength":4000},"apiKey":{"type":"string","minLength":1,"maxLength":4000},"clientId":{"type":"string","minLength":1,"maxLength":400},"clientSecret":{"type":"string","minLength":1,"maxLength":4000},"accessToken":{"type":"string","minLength":1,"maxLength":4000},"refreshToken":{"type":"string","minLength":1,"maxLength":4000},"webhookSecret":{"type":"string","minLength":1,"maxLength":4000},"scopes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","additionalProperties":{}}},"required":["label","provider","kind"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["rest","generic_webhook","shopify","wordpress","stripe","chargebee","recurly","paddle","hubspot","salesforce","slack","gemini","pipedrive","microsoft_teams","google_chat","google_sheets","paypal","wise","ipqualityscore","maxmind","crossbeam"]},"kind":{"type":"string","enum":["api_key","oauth2"]},"label":{"type":"string"},"status":{"type":"string","enum":["active","error","revoked"]},"environment":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","additionalProperties":{}},"signed":{"type":"boolean","default":false},"signingSecretRotatedAt":{"type":"string","nullable":true,"default":null},"lastUsedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"signingSecret":{"type":"string","nullable":true}},"required":["id","orgId","productId","provider","kind","label","status","environment","scopes","metadata","lastUsedAt","createdAt","updatedAt","signingSecret"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/integrations/connections\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"label\": \"Staging provisioning\",\n  \"provider\": \"rest\",\n  \"kind\": \"api_key\",\n  \"environment\": \"test\",\n  \"productId\": \"00000000-0000-4000-8000-000000000001\",\n  \"secret\": \"token-your-endpoint-accepts\",\n  \"metadata\": {\n    \"url\": \"https://staging.example.com/partnerswatch/provision\"\n  }\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/integrations/connections\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"label\": \"Staging provisioning\",\n    \"provider\": \"rest\",\n    \"kind\": \"api_key\",\n    \"environment\": \"test\",\n    \"productId\": \"00000000-0000-4000-8000-000000000001\",\n    \"secret\": \"token-your-endpoint-accepts\",\n    \"metadata\": {\n      \"url\": \"https://staging.example.com/partnerswatch/provision\"\n    }\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/integrations/connections\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    json={\n      \"label\": \"Staging provisioning\",\n      \"provider\": \"rest\",\n      \"kind\": \"api_key\",\n      \"environment\": \"test\",\n      \"productId\": \"00000000-0000-4000-8000-000000000001\",\n      \"secret\": \"token-your-endpoint-accepts\",\n      \"metadata\": {\n        \"url\": \"https://staging.example.com/partnerswatch/provision\"\n      }\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/integrations/connections/{id}":{"get":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["rest","generic_webhook","shopify","wordpress","stripe","chargebee","recurly","paddle","hubspot","salesforce","slack","gemini","pipedrive","microsoft_teams","google_chat","google_sheets","paypal","wise","ipqualityscore","maxmind","crossbeam"]},"kind":{"type":"string","enum":["api_key","oauth2"]},"label":{"type":"string"},"status":{"type":"string","enum":["active","error","revoked"]},"environment":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","additionalProperties":{}},"signed":{"type":"boolean","default":false},"signingSecretRotatedAt":{"type":"string","nullable":true,"default":null},"lastUsedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","productId","provider","kind","label","status","environment","scopes","metadata","lastUsedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"status":{"type":"string","enum":["active","error","revoked"]},"productId":{"type":"string","format":"uuid","nullable":true},"secret":{"type":"string","minLength":1,"maxLength":4000},"apiKey":{"type":"string","minLength":1,"maxLength":4000},"clientId":{"type":"string","minLength":1,"maxLength":400},"clientSecret":{"type":"string","minLength":1,"maxLength":4000},"accessToken":{"type":"string","minLength":1,"maxLength":4000},"refreshToken":{"type":"string","minLength":1,"maxLength":4000},"webhookSecret":{"type":"string","minLength":1,"maxLength":4000},"scopes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","additionalProperties":{}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["rest","generic_webhook","shopify","wordpress","stripe","chargebee","recurly","paddle","hubspot","salesforce","slack","gemini","pipedrive","microsoft_teams","google_chat","google_sheets","paypal","wise","ipqualityscore","maxmind","crossbeam"]},"kind":{"type":"string","enum":["api_key","oauth2"]},"label":{"type":"string"},"status":{"type":"string","enum":["active","error","revoked"]},"environment":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","additionalProperties":{}},"signed":{"type":"boolean","default":false},"signingSecretRotatedAt":{"type":"string","nullable":true,"default":null},"lastUsedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","productId","provider","kind","label","status","environment","scopes","metadata","lastUsedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/connections/{id}/rotate-signing-secret":{"post":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string","format":"uuid"},"signingSecret":{"type":"string"},"previousStillValid":{"type":"boolean"},"rotatedAt":{"type":"string"}},"required":["connectionId","signingSecret","previousStillValid","rotatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/integrations/connections/{id}/rotate-signing-secret\" \\\n  -H \"Authorization: Bearer $PW_KEY\""},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/integrations/connections/{id}/rotate-signing-secret\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}` },\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/integrations/connections/{id}/rotate-signing-secret\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/integrations/connections/{id}/test":{"post":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string","enum":["active","error","revoked"]},"message":{"type":"string","nullable":true}},"required":["ok","status","message"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/stripe/connect":{"get":{"tags":["integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"},"redirectUri":{"type":"string"}},"required":["enabled","redirectUri"],"additionalProperties":false}}}}}}},"/api/integrations/stripe/connect/start":{"post":{"tags":["integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"productId":{"type":"string","format":"uuid"}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"string"}},"required":["url","expiresAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/stripe/connect/callback":{"get":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","maxLength":512},"in":"query","name":"code","required":false},{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{16,1024}\\.[A-Za-z0-9_-]{16,128}$"},"in":"query","name":"state","required":false},{"schema":{"type":"string","maxLength":256},"in":"query","name":"error","required":false},{"schema":{"type":"string","maxLength":2048},"in":"query","name":"error_description","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"scope","required":false}],"responses":{"200":{"description":"Default Response"}}}},"/api/integrations/stripe/connect/complete":{"post":{"tags":["integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":512},"state":{"type":"string","pattern":"^[A-Za-z0-9_-]{16,1024}\\.[A-Za-z0-9_-]{16,128}$"}},"required":["code","state"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"connection":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["rest","generic_webhook","shopify","wordpress","stripe","chargebee","recurly","paddle","hubspot","salesforce","slack","gemini","pipedrive","microsoft_teams","google_chat","google_sheets","paypal","wise","ipqualityscore","maxmind","crossbeam"]},"kind":{"type":"string","enum":["api_key","oauth2"]},"label":{"type":"string"},"status":{"type":"string","enum":["active","error","revoked"]},"environment":{"type":"string","enum":["live","test"]},"scopes":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","additionalProperties":{}},"signed":{"type":"boolean","default":false},"signingSecretRotatedAt":{"type":"string","nullable":true,"default":null},"lastUsedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","productId","provider","kind","label","status","environment","scopes","metadata","lastUsedAt","createdAt","updatedAt"],"additionalProperties":false},"stripeUserId":{"type":"string"},"webhookConfigured":{"type":"boolean"},"webhookError":{"type":"string","nullable":true},"reconnected":{"type":"boolean"}},"required":["connection","stripeUserId","webhookConfigured","webhookError","reconnected"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/stripe/connect/{id}/disconnect":{"post":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"deauthorized":{"type":"boolean"},"removed":{"type":"boolean"}},"required":["deauthorized","removed"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/links":{"get":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"connectionId","required":false},{"schema":{"type":"string"},"in":"query","name":"localType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"localId","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid"},"localType":{"type":"string"},"localId":{"type":"string","format":"uuid"},"externalType":{"type":"string"},"externalId":{"type":"string"},"syncCursor":{"type":"string","nullable":true},"lastSyncedAt":{"type":"string","nullable":true}},"required":["id","orgId","connectionId","localType","localId","externalType","externalId","syncCursor","lastSyncedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string","format":"uuid"},"localType":{"type":"string","minLength":1,"maxLength":60},"localId":{"type":"string","format":"uuid"},"externalType":{"type":"string","minLength":1,"maxLength":60},"externalId":{"type":"string","minLength":1,"maxLength":200},"syncCursor":{"type":"string","maxLength":400,"nullable":true}},"required":["connectionId","localType","localId","externalType","externalId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid"},"localType":{"type":"string"},"localId":{"type":"string","format":"uuid"},"externalType":{"type":"string"},"externalId":{"type":"string"},"syncCursor":{"type":"string","nullable":true},"lastSyncedAt":{"type":"string","nullable":true}},"required":["id","orgId","connectionId","localType","localId","externalType","externalId","syncCursor","lastSyncedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/links/bulk":{"post":{"tags":["integrations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"links":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string","format":"uuid"},"localType":{"type":"string","minLength":1,"maxLength":60},"localId":{"type":"string","format":"uuid"},"externalType":{"type":"string","minLength":1,"maxLength":60},"externalId":{"type":"string","minLength":1,"maxLength":200},"syncCursor":{"type":"string","maxLength":400,"nullable":true}},"required":["connectionId","localType","localId","externalType","externalId"],"additionalProperties":false},"minItems":1,"maxItems":500}},"required":["links"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"existing":{"type":"integer"},"conflicts":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"status":{"type":"string","enum":["created","exists","conflict","failed"]},"id":{"type":"string","format":"uuid","nullable":true},"error":{"type":"string","nullable":true}},"required":["index","status","id","error"],"additionalProperties":false}}},"required":["created","existing","conflicts","failed","results"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/links/{id}":{"delete":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/manifest":{"get":{"tags":["integrations"],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"name":{"type":"string"},"category":{"type":"string","enum":["crm","billing","payout","comms","support","intelligence","ipaas","commerce","ai"]},"auth":{"type":"string","enum":["api_key","oauth2","basic","webhook_secret","none"]},"capabilities":{"type":"array","items":{"type":"string","enum":["inbound","push","pull","notify","payout","enrich","revenue_tracking"]}},"objectTypes":{"type":"array","items":{"type":"string"}},"inboundEvents":{"type":"array","items":{"type":"string"},"default":[]},"setupSteps":{"type":"array","items":{"type":"string"}},"docsUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["native","preset","planned"]},"secretLabel":{"type":"string","nullable":true},"webhookSecretLabel":{"type":"string","nullable":true},"summary":{"type":"string"}},"required":["provider","name","category","auth","capabilities","objectTypes","setupSteps","docsUrl","status","secretLabel","webhookSecretLabel","summary"],"additionalProperties":false}}}}}}}},"/api/integrations/connections/{id}/events":{"get":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","enum":["received","processed","ignored","failed"]},"in":"query","name":"status","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid"},"provider":{"type":"string"},"externalId":{"type":"string"},"type":{"type":"string"},"status":{"type":"string","enum":["received","processed","ignored","failed"]},"outcome":{"type":"object","additionalProperties":{},"nullable":true},"error":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"]},"processedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","connectionId","provider","externalId","type","status","outcome","error","environment","processedAt","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/health":{"get":{"tags":["integrations"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"connectionId":{"type":"string","format":"uuid"},"total":{"type":"integer"},"failed":{"type":"integer"},"lastEventAt":{"type":"string","nullable":true},"lastSuccessAt":{"type":"string","nullable":true},"lastFailureAt":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true}},"required":["connectionId","total","failed","lastEventAt","lastSuccessAt","lastFailureAt","lastError"],"additionalProperties":false}}}}}}}},"/api/ingest/{connectionId}":{"post":{"tags":["ingest"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"connectionId","required":true}],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean","enum":[true]},"status":{"type":"string"}},"required":["accepted"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean","enum":[false]},"error":{"type":"string"}},"required":["accepted","error"],"additionalProperties":false}}}}}}},"/api/provisions":{"get":{"tags":["provisions"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","enum":["credits","units","plan","feature","custom"]},"in":"query","name":"kind","required":false},{"schema":{"type":"string","enum":["pending","delivering","delivered","failed"]},"in":"query","name":"status","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid","nullable":true},"walletId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["credits","units","plan","feature","custom"]},"quantity":{"type":"integer","nullable":true},"unit":{"type":"string","nullable":true},"attributes":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"attempts":{"type":"integer"},"environment":{"type":"string","enum":["live","test"]},"externalAccountId":{"type":"string"},"externalId":{"type":"string","nullable":true},"response":{"type":"object","additionalProperties":{},"nullable":true},"lastError":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"partnerName":{"type":"string","nullable":true},"customerName":{"type":"string","nullable":true},"productName":{"type":"string","nullable":true},"planName":{"type":"string","nullable":true}},"required":["id","partnerId","customerId","productId","connectionId","walletId","kind","quantity","unit","attributes","status","attempts","environment","externalAccountId","externalId","response","lastError","note","deliveredAt","createdAt","updatedAt","partnerName","customerName","productName"],"additionalProperties":false}}}}}}},"post":{"tags":["provisions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["credits","units","plan","feature","custom"],"default":"credits"},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000},"unit":{"type":"string","minLength":1,"maxLength":40},"attributes":{"type":"object","additionalProperties":{}},"externalAccountId":{"type":"string","minLength":1,"maxLength":200},"onboard":{"type":"object","properties":{"domain":{"type":"string","minLength":3,"maxLength":253},"ownerEmail":{"type":"string","format":"email","maxLength":200},"companyName":{"type":"string","minLength":1,"maxLength":200},"platform":{"type":"string","enum":["web","shopify","woocommerce","shopware"],"default":"web"},"location":{"type":"string","minLength":2,"maxLength":8},"domainVerified":{"type":"boolean","default":false}},"required":["domain","ownerEmail"],"additionalProperties":false},"note":{"type":"string","maxLength":500}},"required":["customerId","productId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid","nullable":true},"walletId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["credits","units","plan","feature","custom"]},"quantity":{"type":"integer","nullable":true},"unit":{"type":"string","nullable":true},"attributes":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"attempts":{"type":"integer"},"environment":{"type":"string","enum":["live","test"]},"externalAccountId":{"type":"string"},"externalId":{"type":"string","nullable":true},"response":{"type":"object","additionalProperties":{},"nullable":true},"lastError":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"partnerName":{"type":"string","nullable":true},"customerName":{"type":"string","nullable":true},"productName":{"type":"string","nullable":true},"planName":{"type":"string","nullable":true}},"required":["id","partnerId","customerId","productId","connectionId","walletId","kind","quantity","unit","attributes","status","attempts","environment","externalAccountId","externalId","response","lastError","note","deliveredAt","createdAt","updatedAt","partnerName","customerName","productName"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/provisions\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"customerId\": \"00000000-0000-4000-8000-000000000002\",\n  \"productId\": \"00000000-0000-4000-8000-000000000001\",\n  \"kind\": \"plan\",\n  \"attributes\": {\n    \"planId\": \"00000000-0000-4000-8000-000000000003\"\n  }\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/provisions\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"customerId\": \"00000000-0000-4000-8000-000000000002\",\n    \"productId\": \"00000000-0000-4000-8000-000000000001\",\n    \"kind\": \"plan\",\n    \"attributes\": {\n      \"planId\": \"00000000-0000-4000-8000-000000000003\"\n    }\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/provisions\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    json={\n      \"customerId\": \"00000000-0000-4000-8000-000000000002\",\n      \"productId\": \"00000000-0000-4000-8000-000000000001\",\n      \"kind\": \"plan\",\n      \"attributes\": {\n        \"planId\": \"00000000-0000-4000-8000-000000000003\"\n      }\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/provisions/{id}/retry":{"post":{"tags":["provisions"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid","nullable":true},"walletId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["credits","units","plan","feature","custom"]},"quantity":{"type":"integer","nullable":true},"unit":{"type":"string","nullable":true},"attributes":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"attempts":{"type":"integer"},"environment":{"type":"string","enum":["live","test"]},"externalAccountId":{"type":"string"},"externalId":{"type":"string","nullable":true},"response":{"type":"object","additionalProperties":{},"nullable":true},"lastError":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"partnerName":{"type":"string","nullable":true},"customerName":{"type":"string","nullable":true},"productName":{"type":"string","nullable":true},"planName":{"type":"string","nullable":true}},"required":["id","partnerId","customerId","productId","connectionId","walletId","kind","quantity","unit","attributes","status","attempts","environment","externalAccountId","externalId","response","lastError","note","deliveredAt","createdAt","updatedAt","partnerName","customerName","productName"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/products/{id}/provision-policy":{"get":{"tags":["products"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"policy":{"type":"object","properties":{"allowedKinds":{"type":"array","items":{"type":"string","enum":["credits","units","plan","feature","custom"]},"minItems":1,"nullable":true,"default":null},"maxQuantityPerProvision":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":10000000,"nullable":true,"default":null},"requirePlanId":{"type":"boolean","default":false}},"additionalProperties":false,"nullable":true}},"required":["productId","policy"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["products"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"policy":{"type":"object","properties":{"allowedKinds":{"type":"array","items":{"type":"string","enum":["credits","units","plan","feature","custom"]},"minItems":1,"nullable":true,"default":null},"maxQuantityPerProvision":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":10000000,"nullable":true,"default":null},"requirePlanId":{"type":"boolean","default":false}},"additionalProperties":false,"nullable":true}},"required":["policy"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"policy":{"type":"object","properties":{"allowedKinds":{"type":"array","items":{"type":"string","enum":["credits","units","plan","feature","custom"]},"minItems":1,"nullable":true,"default":null},"maxQuantityPerProvision":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":10000000,"nullable":true,"default":null},"requirePlanId":{"type":"boolean","default":false}},"additionalProperties":false,"nullable":true}},"required":["productId","policy"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/partners/{id}/vendor-status":{"get":{"tags":["partners"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"operatorOrgId":{"type":"string","format":"uuid"},"relationshipId":{"type":"string","format":"uuid","nullable":true},"resells":{"type":"boolean"},"relationship":{"type":"string","nullable":true},"billingMode":{"type":"string","nullable":true},"adminEmail":{"type":"string","nullable":true},"vendorDomain":{"type":"string","nullable":true},"vendorChallenge":{"type":"object","properties":{"cnameTarget":{"type":"string","nullable":true},"txtHost":{"type":"string","nullable":true},"txtValue":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"checkedAt":{"type":"string","nullable":true}},"required":["cnameTarget","txtHost","txtValue","status","reason","checkedAt"],"additionalProperties":false,"nullable":true},"vendorDomainProbe":{"type":"object","properties":{"ok":{"type":"boolean"},"state":{"type":"string","enum":["live","http_error","no_cert","no_dns","unreachable"]},"reason":{"type":"string","nullable":true},"httpStatus":{"type":"integer","nullable":true},"certExpiresAt":{"type":"string","nullable":true},"checkedAt":{"type":"string"}},"required":["ok","state","reason","httpStatus","certExpiresAt","checkedAt"],"additionalProperties":false,"nullable":true},"portalDomains":{"type":"array","items":{"type":"string"}},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string","nullable":true},"connectionId":{"type":"string","format":"uuid","nullable":true},"event":{"type":"string","enum":["partner.connected","partner.updated","partner.disconnected"]},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"environment":{"type":"string","enum":["live","test"]},"attempts":{"type":"integer"},"nextAttemptAt":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"response":{"type":"object","additionalProperties":{},"nullable":true},"lastError":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","productId","connectionId","event","status","environment","attempts","nextAttemptAt","externalId","response","lastError","deliveredAt","createdAt","updatedAt"],"additionalProperties":false}}},"required":["partnerId","operatorOrgId","relationshipId","resells","relationship","billingMode","adminEmail","vendorDomain","vendorChallenge","vendorDomainProbe","portalDomains","events"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/partners/{id}/vendor-connect":{"post":{"tags":["partners"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid"},"productName":{"type":"string","nullable":true},"connectionId":{"type":"string","format":"uuid","nullable":true},"event":{"type":"string","enum":["partner.connected","partner.updated","partner.disconnected"]},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"environment":{"type":"string","enum":["live","test"]},"attempts":{"type":"integer"},"nextAttemptAt":{"type":"string","nullable":true},"externalId":{"type":"string","nullable":true},"response":{"type":"object","additionalProperties":{},"nullable":true},"lastError":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","productId","connectionId","event","status","environment","attempts","nextAttemptAt","externalId","response","lastError","deliveredAt","createdAt","updatedAt"],"additionalProperties":false}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/quotes":{"get":{"tags":["quotes"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"currency":{"type":"string"},"status":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"subtotal":{"type":"integer","minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"discountAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"},"billingModel":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"usageEstimate":{"type":"integer","minimum":0,"nullable":true},"unitAmount":{"type":"integer","minimum":0},"includedUnits":{"type":"integer","minimum":0,"nullable":true},"overageAmount":{"type":"integer","minimum":0,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"lineTotal":{"type":"integer","minimum":0},"position":{"type":"integer","minimum":0}},"required":["id","quoteId","productId","planId","label","billingModel","quantity","usageEstimate","unitAmount","includedUnits","overageAmount","lineDiscountBps","lineTotal","position"],"additionalProperties":false}}},"required":["id","partnerId","customerId","ownerType","ownerId","currency","status","subtotal","discountBps","discountAmount","total","validUntil","notes","documentId","createdById","createdAt","updatedAt","lines"],"additionalProperties":false}}}}}}},"post":{"tags":["quotes"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"discountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"validUntil":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false},"default":[]}},"required":["customerId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"currency":{"type":"string"},"status":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"subtotal":{"type":"integer","minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"discountAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"},"billingModel":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"usageEstimate":{"type":"integer","minimum":0,"nullable":true},"unitAmount":{"type":"integer","minimum":0},"includedUnits":{"type":"integer","minimum":0,"nullable":true},"overageAmount":{"type":"integer","minimum":0,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"lineTotal":{"type":"integer","minimum":0},"position":{"type":"integer","minimum":0}},"required":["id","quoteId","productId","planId","label","billingModel","quantity","usageEstimate","unitAmount","includedUnits","overageAmount","lineDiscountBps","lineTotal","position"],"additionalProperties":false}}},"required":["id","partnerId","customerId","ownerType","ownerId","currency","status","subtotal","discountBps","discountAmount","total","validUntil","notes","documentId","createdById","createdAt","updatedAt","lines"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/quotes/{id}":{"get":{"tags":["quotes"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"currency":{"type":"string"},"status":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"subtotal":{"type":"integer","minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"discountAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"},"billingModel":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"usageEstimate":{"type":"integer","minimum":0,"nullable":true},"unitAmount":{"type":"integer","minimum":0},"includedUnits":{"type":"integer","minimum":0,"nullable":true},"overageAmount":{"type":"integer","minimum":0,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"lineTotal":{"type":"integer","minimum":0},"position":{"type":"integer","minimum":0}},"required":["id","quoteId","productId","planId","label","billingModel","quantity","usageEstimate","unitAmount","includedUnits","overageAmount","lineDiscountBps","lineTotal","position"],"additionalProperties":false}}},"required":["id","partnerId","customerId","ownerType","ownerId","currency","status","subtotal","discountBps","discountAmount","total","validUntil","notes","documentId","createdById","createdAt","updatedAt","lines"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["quotes"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currency":{"type":"string","minLength":3,"maxLength":3},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"validUntil":{"type":"string","format":"date-time","nullable":true},"notes":{"type":"string","maxLength":2000,"nullable":true},"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"currency":{"type":"string"},"status":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"subtotal":{"type":"integer","minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"discountAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"},"billingModel":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"usageEstimate":{"type":"integer","minimum":0,"nullable":true},"unitAmount":{"type":"integer","minimum":0},"includedUnits":{"type":"integer","minimum":0,"nullable":true},"overageAmount":{"type":"integer","minimum":0,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"lineTotal":{"type":"integer","minimum":0},"position":{"type":"integer","minimum":0}},"required":["id","quoteId","productId","planId","label","billingModel","quantity","usageEstimate","unitAmount","includedUnits","overageAmount","lineDiscountBps","lineTotal","position"],"additionalProperties":false}}},"required":["id","partnerId","customerId","ownerType","ownerId","currency","status","subtotal","discountBps","discountAmount","total","validUntil","notes","documentId","createdById","createdAt","updatedAt","lines"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["quotes"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/quotes/{id}/send":{"post":{"tags":["quotes"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"currency":{"type":"string"},"status":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"subtotal":{"type":"integer","minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"discountAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"},"billingModel":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"usageEstimate":{"type":"integer","minimum":0,"nullable":true},"unitAmount":{"type":"integer","minimum":0},"includedUnits":{"type":"integer","minimum":0,"nullable":true},"overageAmount":{"type":"integer","minimum":0,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"lineTotal":{"type":"integer","minimum":0},"position":{"type":"integer","minimum":0}},"required":["id","quoteId","productId","planId","label","billingModel","quantity","usageEstimate","unitAmount","includedUnits","overageAmount","lineDiscountBps","lineTotal","position"],"additionalProperties":false}}},"required":["id","partnerId","customerId","ownerType","ownerId","currency","status","subtotal","discountBps","discountAmount","total","validUntil","notes","documentId","createdById","createdAt","updatedAt","lines"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/quotes/{id}/accept":{"post":{"tags":["quotes"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"quote":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"currency":{"type":"string"},"status":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"subtotal":{"type":"integer","minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"discountAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"},"billingModel":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"usageEstimate":{"type":"integer","minimum":0,"nullable":true},"unitAmount":{"type":"integer","minimum":0},"includedUnits":{"type":"integer","minimum":0,"nullable":true},"overageAmount":{"type":"integer","minimum":0,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"lineTotal":{"type":"integer","minimum":0},"position":{"type":"integer","minimum":0}},"required":["id","quoteId","productId","planId","label","billingModel","quantity","usageEstimate","unitAmount","includedUnits","overageAmount","lineDiscountBps","lineTotal","position"],"additionalProperties":false}}},"required":["id","partnerId","customerId","ownerType","ownerId","currency","status","subtotal","discountBps","discountAmount","total","validUntil","notes","documentId","createdById","createdAt","updatedAt","lines"],"additionalProperties":false},"provisions":{"type":"array","items":{"type":"object","properties":{"line":{"type":"string"},"provisionId":{"type":"string","format":"uuid"},"error":{"type":"string"}},"required":["line"],"additionalProperties":false}}},"required":["quote","provisions"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/quotes/{id}/decline":{"post":{"tags":["quotes"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"currency":{"type":"string"},"status":{"type":"string","enum":["draft","sent","accepted","declined","expired"]},"subtotal":{"type":"integer","minimum":0},"discountBps":{"type":"integer","minimum":0,"maximum":10000},"discountAmount":{"type":"integer","minimum":0},"total":{"type":"integer","minimum":0},"validUntil":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"quoteId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string"},"billingModel":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"usageEstimate":{"type":"integer","minimum":0,"nullable":true},"unitAmount":{"type":"integer","minimum":0},"includedUnits":{"type":"integer","minimum":0,"nullable":true},"overageAmount":{"type":"integer","minimum":0,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"lineTotal":{"type":"integer","minimum":0},"position":{"type":"integer","minimum":0}},"required":["id","quoteId","productId","planId","label","billingModel","quantity","usageEstimate","unitAmount","includedUnits","overageAmount","lineDiscountBps","lineTotal","position"],"additionalProperties":false}}},"required":["id","partnerId","customerId","ownerType","ownerId","currency","status","subtotal","discountBps","discountAmount","total","validUntil","notes","documentId","createdById","createdAt","updatedAt","lines"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/journeys":{"get":{"tags":["journeys"],"parameters":[{"schema":{"type":"string","enum":["draft","active","archived"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"config":{"type":"object","properties":{"cadence":{"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":5000},"delayDays":{"type":"integer","minimum":0,"maximum":365,"default":0}},"required":["subject","body"],"additionalProperties":false},"maxItems":20,"default":[]},"advanceOnCadenceEnd":{"type":"boolean","default":true},"welcomeSubject":{"type":"string","maxLength":200,"nullable":true},"welcomeBody":{"type":"string","maxLength":5000,"nullable":true},"autoCompleteOnboard":{"type":"boolean","default":true},"offerStrategy":{"type":"string","enum":["template","ai","manual"],"default":"template"},"offer":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false},"default":[]},"discountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"validDays":{"type":"integer","minimum":1,"maximum":365,"default":30},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false,"default":{}},"aiPrompt":{"type":"string","maxLength":2000,"nullable":true},"nudgeEveryDays":{"type":"integer","minimum":1,"maximum":60,"default":3},"maxNudges":{"type":"integer","minimum":0,"maximum":20,"default":4}},"additionalProperties":false},"enrolledCount":{"type":"integer","minimum":0},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","name","description","status","config","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["journeys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"config":{"type":"object","properties":{"cadence":{"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":5000},"delayDays":{"type":"integer","minimum":0,"maximum":365,"default":0}},"required":["subject","body"],"additionalProperties":false},"maxItems":20,"default":[]},"advanceOnCadenceEnd":{"type":"boolean","default":true},"welcomeSubject":{"type":"string","maxLength":200,"nullable":true},"welcomeBody":{"type":"string","maxLength":5000,"nullable":true},"autoCompleteOnboard":{"type":"boolean","default":true},"offerStrategy":{"type":"string","enum":["template","ai","manual"],"default":"template"},"offer":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false},"default":[]},"discountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"validDays":{"type":"integer","minimum":1,"maximum":365,"default":30},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false,"default":{}},"aiPrompt":{"type":"string","maxLength":2000,"nullable":true},"nudgeEveryDays":{"type":"integer","minimum":1,"maximum":60,"default":3},"maxNudges":{"type":"integer","minimum":0,"maximum":20,"default":4}},"additionalProperties":false}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"config":{"type":"object","properties":{"cadence":{"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":5000},"delayDays":{"type":"integer","minimum":0,"maximum":365,"default":0}},"required":["subject","body"],"additionalProperties":false},"maxItems":20,"default":[]},"advanceOnCadenceEnd":{"type":"boolean","default":true},"welcomeSubject":{"type":"string","maxLength":200,"nullable":true},"welcomeBody":{"type":"string","maxLength":5000,"nullable":true},"autoCompleteOnboard":{"type":"boolean","default":true},"offerStrategy":{"type":"string","enum":["template","ai","manual"],"default":"template"},"offer":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false},"default":[]},"discountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"validDays":{"type":"integer","minimum":1,"maximum":365,"default":30},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false,"default":{}},"aiPrompt":{"type":"string","maxLength":2000,"nullable":true},"nudgeEveryDays":{"type":"integer","minimum":1,"maximum":60,"default":3},"maxNudges":{"type":"integer","minimum":0,"maximum":20,"default":4}},"additionalProperties":false},"enrolledCount":{"type":"integer","minimum":0},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","name","description","status","config","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/journeys/{id}":{"get":{"tags":["journeys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"config":{"type":"object","properties":{"cadence":{"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":5000},"delayDays":{"type":"integer","minimum":0,"maximum":365,"default":0}},"required":["subject","body"],"additionalProperties":false},"maxItems":20,"default":[]},"advanceOnCadenceEnd":{"type":"boolean","default":true},"welcomeSubject":{"type":"string","maxLength":200,"nullable":true},"welcomeBody":{"type":"string","maxLength":5000,"nullable":true},"autoCompleteOnboard":{"type":"boolean","default":true},"offerStrategy":{"type":"string","enum":["template","ai","manual"],"default":"template"},"offer":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false},"default":[]},"discountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"validDays":{"type":"integer","minimum":1,"maximum":365,"default":30},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false,"default":{}},"aiPrompt":{"type":"string","maxLength":2000,"nullable":true},"nudgeEveryDays":{"type":"integer","minimum":1,"maximum":60,"default":3},"maxNudges":{"type":"integer","minimum":0,"maximum":20,"default":4}},"additionalProperties":false},"enrolledCount":{"type":"integer","minimum":0},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","name","description","status","config","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["journeys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"config":{"type":"object","properties":{"cadence":{"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":5000},"delayDays":{"type":"integer","minimum":0,"maximum":365,"default":0}},"required":["subject","body"],"additionalProperties":false},"maxItems":20,"default":[]},"advanceOnCadenceEnd":{"type":"boolean","default":true},"welcomeSubject":{"type":"string","maxLength":200,"nullable":true},"welcomeBody":{"type":"string","maxLength":5000,"nullable":true},"autoCompleteOnboard":{"type":"boolean","default":true},"offerStrategy":{"type":"string","enum":["template","ai","manual"],"default":"template"},"offer":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false},"default":[]},"discountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"validDays":{"type":"integer","minimum":1,"maximum":365,"default":30},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false,"default":{}},"aiPrompt":{"type":"string","maxLength":2000,"nullable":true},"nudgeEveryDays":{"type":"integer","minimum":1,"maximum":60,"default":3},"maxNudges":{"type":"integer","minimum":0,"maximum":20,"default":4}},"additionalProperties":false}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"config":{"type":"object","properties":{"cadence":{"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":5000},"delayDays":{"type":"integer","minimum":0,"maximum":365,"default":0}},"required":["subject","body"],"additionalProperties":false},"maxItems":20,"default":[]},"advanceOnCadenceEnd":{"type":"boolean","default":true},"welcomeSubject":{"type":"string","maxLength":200,"nullable":true},"welcomeBody":{"type":"string","maxLength":5000,"nullable":true},"autoCompleteOnboard":{"type":"boolean","default":true},"offerStrategy":{"type":"string","enum":["template","ai","manual"],"default":"template"},"offer":{"type":"object","properties":{"lines":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string","format":"uuid","nullable":true},"planId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":200},"quantity":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1000000,"default":1},"usageEstimate":{"type":"integer","minimum":0,"maximum":1000000000,"nullable":true},"lineDiscountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0}},"additionalProperties":false},"default":[]},"discountBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"validDays":{"type":"integer","minimum":1,"maximum":365,"default":30},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false,"default":{}},"aiPrompt":{"type":"string","maxLength":2000,"nullable":true},"nudgeEveryDays":{"type":"integer","minimum":1,"maximum":60,"default":3},"maxNudges":{"type":"integer","minimum":0,"maximum":20,"default":4}},"additionalProperties":false},"enrolledCount":{"type":"integer","minimum":0},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","name","description","status","config","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["journeys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/journeys/{id}/board":{"get":{"tags":["journeys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"journeyId":{"type":"string","format":"uuid"},"counts":{"type":"object","required":["reach_out","onboard","offer","sign","provision","won","lost"],"properties":{"reach_out":{"type":"integer","minimum":0},"onboard":{"type":"integer","minimum":0},"offer":{"type":"integer","minimum":0},"sign":{"type":"integer","minimum":0},"provision":{"type":"integer","minimum":0},"won":{"type":"integer","minimum":0},"lost":{"type":"integer","minimum":0}},"additionalProperties":false},"enrollments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"journeyId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"stage":{"type":"string","enum":["reach_out","onboard","offer","sign","provision","won","lost"]},"status":{"type":"string","enum":["active","completed","exited","failed"]},"cadenceStep":{"type":"integer","minimum":0},"nudgeCount":{"type":"integer","minimum":0},"quoteId":{"type":"string","format":"uuid","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"nextActionAt":{"type":"string","nullable":true},"stageEnteredAt":{"type":"string"},"timeline":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"stage":{"type":"string","enum":["reach_out","onboard","offer","sign","provision","won","lost"]},"kind":{"type":"string"},"detail":{"type":"string","nullable":true}},"required":["at","stage","kind"],"additionalProperties":false}},"lastError":{"type":"string","nullable":true},"customerName":{"type":"string","nullable":true},"customerEmail":{"type":"string","nullable":true},"journeyName":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","journeyId","partnerId","customerId","stage","status","cadenceStep","nudgeCount","quoteId","documentId","nextActionAt","stageEnteredAt","timeline","lastError","createdAt","updatedAt"],"additionalProperties":false}}},"required":["journeyId","counts","enrollments"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/journeys/{id}/enroll":{"post":{"tags":["journeys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":500}},"required":["customerIds"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"enrolled":{"type":"integer"},"skipped":{"type":"integer"}},"required":["enrolled","skipped"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/journey-enrollments":{"get":{"tags":["journey-enrollments"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"journeyId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","enum":["reach_out","onboard","offer","sign","provision","won","lost"]},"in":"query","name":"stage","required":false},{"schema":{"type":"string","enum":["active","completed","exited","failed"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"journeyId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"stage":{"type":"string","enum":["reach_out","onboard","offer","sign","provision","won","lost"]},"status":{"type":"string","enum":["active","completed","exited","failed"]},"cadenceStep":{"type":"integer","minimum":0},"nudgeCount":{"type":"integer","minimum":0},"quoteId":{"type":"string","format":"uuid","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"nextActionAt":{"type":"string","nullable":true},"stageEnteredAt":{"type":"string"},"timeline":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"stage":{"type":"string","enum":["reach_out","onboard","offer","sign","provision","won","lost"]},"kind":{"type":"string"},"detail":{"type":"string","nullable":true}},"required":["at","stage","kind"],"additionalProperties":false}},"lastError":{"type":"string","nullable":true},"customerName":{"type":"string","nullable":true},"customerEmail":{"type":"string","nullable":true},"journeyName":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","journeyId","partnerId","customerId","stage","status","cadenceStep","nudgeCount","quoteId","documentId","nextActionAt","stageEnteredAt","timeline","lastError","createdAt","updatedAt"],"additionalProperties":false}}}}}}}},"/api/journey-enrollments/{id}/unenroll":{"post":{"tags":["journey-enrollments"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"journeyId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"stage":{"type":"string","enum":["reach_out","onboard","offer","sign","provision","won","lost"]},"status":{"type":"string","enum":["active","completed","exited","failed"]},"cadenceStep":{"type":"integer","minimum":0},"nudgeCount":{"type":"integer","minimum":0},"quoteId":{"type":"string","format":"uuid","nullable":true},"documentId":{"type":"string","format":"uuid","nullable":true},"nextActionAt":{"type":"string","nullable":true},"stageEnteredAt":{"type":"string"},"timeline":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"stage":{"type":"string","enum":["reach_out","onboard","offer","sign","provision","won","lost"]},"kind":{"type":"string"},"detail":{"type":"string","nullable":true}},"required":["at","stage","kind"],"additionalProperties":false}},"lastError":{"type":"string","nullable":true},"customerName":{"type":"string","nullable":true},"customerEmail":{"type":"string","nullable":true},"journeyName":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","journeyId","partnerId","customerId","stage","status","cadenceStep","nudgeCount","quoteId","documentId","nextActionAt","stageEnteredAt","timeline","lastError","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/endpoints":{"get":{"tags":["webhooks"],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]}},"status":{"type":"string","enum":["active","disabled"]},"hasSecret":{"type":"boolean"},"secretPreview":{"type":"string","nullable":true},"source":{"type":"string"},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","url","eventTypes","status","hasSecret","secretPreview","createdAt"],"additionalProperties":false}}}}}}},"post":{"tags":["webhooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]},"minItems":1},"active":{"type":"boolean"}},"required":["url","eventTypes"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]}},"status":{"type":"string","enum":["active","disabled"]},"hasSecret":{"type":"boolean"},"secretPreview":{"type":"string","nullable":true},"source":{"type":"string"},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"secret":{"type":"string"}},"required":["id","orgId","url","eventTypes","status","hasSecret","secretPreview","createdAt","secret"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/webhooks/endpoints\" \\\n  -H \"Authorization: Bearer $PW_SESSION\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"url\": \"https://hooks.example.com/partnerswatch\",\n  \"eventTypes\": [\n    \"conversion.recorded\",\n    \"lead.created\"\n  ]\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/webhooks/endpoints\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_SESSION}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"url\": \"https://hooks.example.com/partnerswatch\",\n    \"eventTypes\": [\n      \"conversion.recorded\",\n      \"lead.created\"\n    ]\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/webhooks/endpoints\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_SESSION']}\"},\n    json={\n      \"url\": \"https://hooks.example.com/partnerswatch\",\n      \"eventTypes\": [\n        \"conversion.recorded\",\n        \"lead.created\"\n      ]\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/webhooks/endpoints/{id}":{"patch":{"tags":["webhooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]},"minItems":1},"active":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]}},"status":{"type":"string","enum":["active","disabled"]},"hasSecret":{"type":"boolean"},"secretPreview":{"type":"string","nullable":true},"source":{"type":"string"},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","url","eventTypes","status","hasSecret","secretPreview","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"get":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]}},"status":{"type":"string","enum":["active","disabled"]},"hasSecret":{"type":"boolean"},"secretPreview":{"type":"string","nullable":true},"source":{"type":"string"},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","url","eventTypes","status","hasSecret","secretPreview","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/endpoints/{id}/rotate-secret":{"post":{"tags":["webhooks"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"not":{}},{"type":"object","properties":{"graceSeconds":{"type":"integer","minimum":0,"maximum":604800}},"additionalProperties":false}]}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"url":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]}},"status":{"type":"string","enum":["active","disabled"]},"hasSecret":{"type":"boolean"},"secretPreview":{"type":"string","nullable":true},"source":{"type":"string"},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"secret":{"type":"string"}},"required":["id","orgId","url","eventTypes","status","hasSecret","secretPreview","createdAt","secret"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/webhooks/endpoints/{id}/rotate-secret\" \\\n  -H \"Authorization: Bearer $PW_SESSION\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"graceSeconds\": 86400\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/webhooks/endpoints/{id}/rotate-secret\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_SESSION}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"graceSeconds\": 86400\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/webhooks/endpoints/{id}/rotate-secret\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_SESSION']}\"},\n    json={\n      \"graceSeconds\": 86400\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/webhooks/endpoints/{id}/deliveries":{"get":{"tags":["webhooks"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"endpointId":{"type":"string","format":"uuid"},"eventId":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"attempts":{"type":"integer"},"responseStatus":{"type":"integer","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"deliveredAt":{"type":"string","nullable":true}},"required":["id","endpointId","eventId","eventType","status","attempts","responseStatus","error","createdAt","deliveredAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/deliveries/{id}/replay":{"post":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"endpointId":{"type":"string","format":"uuid"},"eventId":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"attempts":{"type":"integer"},"responseStatus":{"type":"integer","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"deliveredAt":{"type":"string","nullable":true}},"required":["id","endpointId","eventId","eventType","status","attempts","responseStatus","error","createdAt","deliveredAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/endpoints/{id}/test":{"post":{"tags":["webhooks"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"endpointId":{"type":"string","format":"uuid"},"eventId":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"status":{"type":"string","enum":["pending","delivering","delivered","failed"]},"attempts":{"type":"integer"},"responseStatus":{"type":"integer","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"deliveredAt":{"type":"string","nullable":true}},"required":["id","endpointId","eventId","eventType","status","attempts","responseStatus","error","createdAt","deliveredAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/partners/{id}/readiness":{"get":{"tags":["partners"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"kind":{"type":"string","enum":["partner","integration"]},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"context":{"type":"string","nullable":true}},"required":["kind","id","name","context"],"additionalProperties":false},"ready":{"type":"boolean"},"percent":{"type":"integer","minimum":0,"maximum":100},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","skipped"]},"detail":{"type":"string"},"fix":{"type":"string","nullable":true},"blocking":{"type":"boolean"}},"required":["key","label","status","detail","fix","blocking"],"additionalProperties":false}},"blockers":{"type":"array","items":{"type":"string"}},"nextStep":{"type":"string","nullable":true},"generatedAt":{"type":"string"}},"required":["subject","ready","percent","checks","blockers","nextStep","generatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/integrations/readiness":{"get":{"tags":["integrations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":true},{"schema":{"type":"string","enum":["live","test"],"default":"live"},"in":"query","name":"environment","required":false},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}],"default":false},"in":"query","name":"probe","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"kind":{"type":"string","enum":["partner","integration"]},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"context":{"type":"string","nullable":true}},"required":["kind","id","name","context"],"additionalProperties":false},"ready":{"type":"boolean"},"percent":{"type":"integer","minimum":0,"maximum":100},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","skipped"]},"detail":{"type":"string"},"fix":{"type":"string","nullable":true},"blocking":{"type":"boolean"}},"required":["key","label","status","detail","fix","blocking"],"additionalProperties":false}},"blockers":{"type":"array","items":{"type":"string"}},"nextStep":{"type":"string","nullable":true},"generatedAt":{"type":"string"}},"required":["subject","ready","percent","checks","blockers","nextStep","generatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/apikeys":{"get":{"tags":["apikeys"],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"label":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]}},"environment":{"type":"string","enum":["live","test"]},"lastUsedAt":{"type":"string","nullable":true},"expiresAt":{"type":"string","nullable":true},"rotatedFromId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","label","prefix","scopes","environment","lastUsedAt","expiresAt","rotatedFromId","createdAt"],"additionalProperties":false}}}}}}},"post":{"tags":["apikeys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]},"minItems":1},"environment":{"type":"string","enum":["live","test"]},"expiresAt":{"type":"string","format":"date-time"}},"required":["label","scopes"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"label":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]}},"environment":{"type":"string","enum":["live","test"]},"lastUsedAt":{"type":"string","nullable":true},"expiresAt":{"type":"string","nullable":true},"rotatedFromId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"token":{"type":"string"}},"required":["id","orgId","label","prefix","scopes","environment","lastUsedAt","expiresAt","rotatedFromId","createdAt","token"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/apikeys\" \\\n  -H \"Authorization: Bearer $PW_SESSION\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"label\": \"Billing sync\",\n  \"scopes\": [\n    \"usage:ingest\",\n    \"subscription:ingest\"\n  ],\n  \"environment\": \"test\"\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/apikeys\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_SESSION}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"label\": \"Billing sync\",\n    \"scopes\": [\n      \"usage:ingest\",\n      \"subscription:ingest\"\n    ],\n    \"environment\": \"test\"\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/apikeys\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_SESSION']}\"},\n    json={\n      \"label\": \"Billing sync\",\n      \"scopes\": [\n        \"usage:ingest\",\n        \"subscription:ingest\"\n      ],\n      \"environment\": \"test\"\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/apikeys/{id}":{"delete":{"tags":["apikeys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/apikeys/{id}/rotate":{"post":{"tags":["apikeys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"not":{}},{"type":"object","properties":{"graceSeconds":{"type":"integer","minimum":0,"maximum":604800}},"additionalProperties":false}]}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"label":{"type":"string"},"prefix":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]}},"environment":{"type":"string","enum":["live","test"]},"lastUsedAt":{"type":"string","nullable":true},"expiresAt":{"type":"string","nullable":true},"rotatedFromId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"token":{"type":"string"},"previousKeyExpiresAt":{"type":"string"}},"required":["id","orgId","label","prefix","scopes","environment","lastUsedAt","expiresAt","rotatedFromId","createdAt","token","previousKeyExpiresAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/apikeys/{id}/rotate\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"graceSeconds\": 3600\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/apikeys/{id}/rotate\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"graceSeconds\": 3600\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/apikeys/{id}/rotate\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    json={\n      \"graceSeconds\": 3600\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/oauth/clients":{"get":{"tags":["oauth"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"clientId":{"type":"string"},"label":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]}},"environment":{"type":"string","enum":["live","test"]},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","clientId","label","scopes","environment","previousSecretExpiresAt","createdAt"],"additionalProperties":false}}}}}}},"post":{"tags":["oauth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]},"minItems":1},"environment":{"type":"string","enum":["live","test"],"default":"live"}},"required":["label","scopes"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"clientId":{"type":"string"},"label":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]}},"environment":{"type":"string","enum":["live","test"]},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"clientSecret":{"type":"string"}},"required":["id","orgId","clientId","label","scopes","environment","previousSecretExpiresAt","createdAt","clientSecret"],"additionalProperties":false}}}}}}},"/api/oauth/clients/{id}":{"delete":{"tags":["oauth"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/oauth/clients/{id}/rotate-secret":{"post":{"tags":["oauth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"not":{}},{"type":"object","properties":{"graceSeconds":{"type":"integer","minimum":0,"maximum":604800}},"additionalProperties":false}]}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"clientId":{"type":"string"},"label":{"type":"string"},"scopes":{"type":"array","items":{"type":"string","enum":["organization:read","organization:write","organization:delete","relationship:read","relationship:write","relationship:delete","partner:read","partner:write","partner:delete","onboarding:read","onboarding:write","deal:read","deal:write","deal:delete","customer:read","customer:write","customer:delete","commission:read","commission:write","payout:read","payout:write","payout:request","payout:approve","tax:read","tax:write","link:read","link:write","coupon:write","attribution:read","attribution:write","material:read","material:write","folder:read","folder:write","invoice:read","invoice:write","agreement:read","agreement:write","automation:manage","activity:read","activity:write","playbook:adopt","user:manage","analytics:read","document:read","document:write","document:sign","document:manage","commerce:read","commerce:manage","credit:purchase","credit:allocate","pricebook:manage","quote:read","quote:write","journey:read","journey:write","plan:read","plan:write","product:read","product:write","provider:manage","compliance:read","compliance:manage","whitelabel:read","whitelabel:write","whitelabel:manage","integration:read","integration:manage","webhook:manage","apikey:manage","copilot:use","agent:use","agent:manage","profile:read","profile:write","profile:moderate","course:read","course:write","course:publish","course:enroll","group:read","group:write","tag:read","tag:write","report:read","report:write","report:schedule","crm:read","crm:sync","lead:read","lead:write","lead:capture","match:read","mcp:use","sso:manage","audit:read","program:read","program:manage","ticket:read","ticket:write","ticket:assign","survey:read","survey:write","health:read","health:write","event:read","event:write","event:ingest","metric:read","metric:write","dashboard:read","dashboard:write","engagement:read","engagement:manage","mentorship:read","mentorship:manage","booking:read","booking:write","booking:manage","usage:read","usage:ingest","subscription:read","subscription:ingest","mail:send","domain:read","domain:manage","location:read","location:write","location:delete","territory:read","territory:manage","royalty:read","royalty:manage","sales_report:read","sales_report:submit","inspection:read","inspection:write","inspection:manage","inspection:respond","request:read","request:manage","request:approve","campaign:read","campaign:manage","feedback:read","feedback:manage","statement:read","exchange:read","exchange:list","exchange:apply","referral:read","referral:manage","cosell:read","cosell:manage","skill:read","skill:run","skill:manage","import:manage","coach:read","recruit:read","recruit:manage","kit:generate","kit:request","challenge:read","challenge:manage","challenge:enter","mdf:read","mdf:manage","mdf:approve","mdf:claim","risk:read","risk:manage","insight:read","insight:manage","brief:read","community:read","community:manage","community:participate","privacy:self","privacy:erase"]}},"environment":{"type":"string","enum":["live","test"]},"previousSecretExpiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"clientSecret":{"type":"string"}},"required":["id","orgId","clientId","label","scopes","environment","previousSecretExpiresAt","createdAt","clientSecret"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/oauth/token":{"post":{"tags":["oauth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","enum":["client_credentials"]},"grantType":{"type":"string","enum":["client_credentials"]},"client_id":{"type":"string","minLength":1},"clientId":{"type":"string","minLength":1},"client_secret":{"type":"string","minLength":1},"clientSecret":{"type":"string","minLength":1}},"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"type":"string","enum":["Bearer"]},"expires_in":{"type":"integer"},"scope":{"type":"string"}},"required":["access_token","token_type","expires_in","scope"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/oauth/token\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"grant_type\": \"client_credentials\",\n  \"client_id\": \"cid_live_…\",\n  \"client_secret\": \"csec_…\"\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/oauth/token\", {\n  method: \"POST\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"grant_type\": \"client_credentials\",\n    \"client_id\": \"cid_live_…\",\n    \"client_secret\": \"csec_…\"\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/oauth/token\",\n    json={\n      \"grant_type\": \"client_credentials\",\n      \"client_id\": \"cid_live_…\",\n      \"client_secret\": \"csec_…\"\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/v1/status":{"get":{"tags":["v1"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"service":{"type":"string","enum":["partneros-api"]},"time":{"type":"string"}},"required":["ok","service","time"],"additionalProperties":false}}}}}}},"/api/v1/ping":{"get":{"tags":["v1"],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"auth":{"type":"string","enum":["api_key","oauth"]},"org":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true}},"required":["id","name"],"additionalProperties":false},"scopes":{"type":"array","items":{"type":"string"}},"time":{"type":"string"}},"required":["ok","auth","org","scopes","time"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://partners.naridon.com/api/v1/ping\" \\\n  -H \"Authorization: Bearer $PW_KEY\""},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/v1/ping\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}` },\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.get(\n    \"https://partners.naridon.com/api/v1/ping\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/v1/deals":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"stage","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"commissionAmount":{"type":"integer","minimum":0},"expectedCloseDate":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"],"default":"live"},"quantity":{"type":"integer","nullable":true,"default":null},"isRenewal":{"type":"boolean","default":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","productId","pipelineId","name","stage","amount","currency","commissionBps","commissionAmount","expectedCloseDate","closedAt","createdById","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"},"nextCursor":{"type":"string","nullable":true}},"required":["data","page","pageSize","total","totalPages","nextCursor"],"additionalProperties":false}}}}}},"post":{"tags":["v1"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"expectedCloseDate":{"type":"string","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"partnerId":{"type":"string","format":"uuid"},"quantity":{"type":"integer","minimum":1,"nullable":true},"isRenewal":{"type":"boolean"}},"required":["name"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"stage":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"commissionAmount":{"type":"integer","minimum":0},"expectedCloseDate":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"],"default":"live"},"quantity":{"type":"integer","nullable":true,"default":null},"isRenewal":{"type":"boolean","default":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","productId","pipelineId","name","stage","amount","currency","commissionBps","commissionAmount","expectedCloseDate","closedAt","createdById","notes","createdAt","updatedAt"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/v1/deals\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Idempotency-Key: 4f1c9a52-2b0e-4f7e-9d0a-6f2b7c1e8a33\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"name\": \"Acme expansion\",\n  \"amount\": 120000\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/v1/deals\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Idempotency-Key\": \"4f1c9a52-2b0e-4f7e-9d0a-6f2b7c1e8a33\", \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"name\": \"Acme expansion\",\n    \"amount\": 120000\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/v1/deals\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\", \"Idempotency-Key\": \"4f1c9a52-2b0e-4f7e-9d0a-6f2b7c1e8a33\"},\n    json={\n      \"name\": \"Acme expansion\",\n      \"amount\": 120000\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/v1/customers":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"company":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","name","company","email","phone","pipelineId","status","mrr","currency","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"},"nextCursor":{"type":"string","nullable":true}},"required":["data","page","pageSize","total","totalPages","nextCursor"],"additionalProperties":false}}}}}},"post":{"tags":["v1"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"company":{"type":"string","maxLength":200,"nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","maxLength":50,"nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0,"default":0},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"notes":{"type":"string","maxLength":5000,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"company":{"type":"string","nullable":true},"email":{"type":"string","format":"email","nullable":true},"phone":{"type":"string","nullable":true},"pipelineId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","name","company","email","phone","pipelineId","status","mrr","currency","notes","createdAt","updatedAt"],"additionalProperties":false}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/v1/plans":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"ownerType","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"ownerId","required":false},{"schema":{"type":"string"},"in":"query","name":"model","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"model":{"type":"string","enum":["credit","seat","usage","flat","wholesale"]},"currency":{"type":"string"},"config":{"type":"object","properties":{"unitAmount":{"type":"integer","minimum":0},"interval":{"type":"string","enum":["one_time","month","year"],"default":"month"},"includedUnits":{"type":"integer","minimum":0},"overageAmount":{"type":"integer","minimum":0},"creditUnit":{"type":"string"},"minQuantity":{"type":"integer","exclusiveMinimum":true,"minimum":0},"wholesaleDiscountBps":{"type":"integer","minimum":0,"maximum":10000},"features":{"type":"array","items":{"type":"string"}},"externalPlanCode":{"type":"string"}},"additionalProperties":false},"isPublic":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","ownerType","ownerId","productId","name","description","model","currency","config","isPublic","status","createdAt","updatedAt"],"additionalProperties":false}}}}}}}},"/api/v1/documents":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string"},"in":"query","name":"level","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"vendorId","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"},"nextCursor":{"type":"string","nullable":true}},"required":["data","page","pageSize","total","totalPages","nextCursor"],"additionalProperties":false}}}}}},"post":{"tags":["v1"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1,"maxLength":200},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"]},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"counterpartyName":{"type":"string","maxLength":200,"nullable":true},"governingLaw":{"type":"string","nullable":true},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"default":{}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":600,"nullable":true},"noticePeriodDays":{"type":"integer","minimum":0,"maximum":3650},"signingProvider":{"type":"string","enum":["builtin","docusign"]}},"required":["templateId"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/v1/partners/{id}/brand":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true},"fontUrl":{"type":"string","nullable":true}},"required":["orgId","brandName","logoUrl","iconUrl","faviconUrl","primaryColor","accentColor","fontFamily","fontUrl"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X GET \"https://partners.naridon.com/api/v1/partners/{id}/brand\" \\\n  -H \"Authorization: Bearer $PW_KEY\""},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/v1/partners/{id}/brand\", {\n  method: \"GET\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}` },\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.get(\n    \"https://partners.naridon.com/api/v1/partners/{id}/brand\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}]}},"/api/v1/me":{"get":{"tags":["v1"],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"auth":{"type":"string","enum":["api_key","oauth"]},"org":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true}},"required":["id","name"],"additionalProperties":false},"scopes":{"type":"array","items":{"type":"string"}},"environment":{"type":"string","enum":["live","test"]}},"required":["ok","auth","org","scopes","environment"],"additionalProperties":false}}}}}}},"/api/v1/hooks/events":{"get":{"tags":["v1"],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"event":{"type":"string"},"scope":{"type":"string"},"allowed":{"type":"boolean"}},"required":["event","scope","allowed"],"additionalProperties":false}}}}}}}},"/api/v1/hooks":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["manual","zapier","make","n8n"]},"url":{"type":"string"},"event":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","source","url","event","events","status","createdAt"],"additionalProperties":false}}}}}}},"post":{"tags":["v1"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":2000},"event":{"type":"string","enum":["application.submitted","application.stage_changed","application.approved","partner.activated","deal.created","deal.stage_changed","deal.won","deal.lost","customer.created","customer.status_changed","customer.churned","customer.trial_started","customer.trial_converted","customer.trial_expired","customer.trial_ended","document.signed","document.expiring","document.expired","document.renewed","document.terminated","document.amended","subprocessor.changed","compliance.changed","whitelabel.submitted","whitelabel.approved","whitelabel.withdrawn","partner.listed","partner.tagged","course.enrolled","course.completed","link.clicked","conversion.recorded","conversion.reversed","commission.accrued","commission.clawed_back","lead.created","lead.accepted","lead.rejected","lead.converted","crm.synced","report.generated","ticket.created","ticket.assigned","ticket.status_changed","ticket.sla_breached","survey.sent","survey.responded","health.changed","customer.event_recorded","quote.created","quote.sent","quote.accepted","quote.declined","provision.created","provision.delivered","provision.failed","location.created","location.opened","location.status_changed","location.closed","territory.assigned","territory.released","sales_report.submitted","royalty.charged","royalty.invoiced","audit.scheduled","audit.completed","corrective_action.created","corrective_action.resolved","corrective_action.overdue","corrective_action.escalated","location.manager_assigned","partner.property_changed","deal.property_changed","customer.property_changed","application.property_changed","document.property_changed","subprocessor.property_changed","compliance.property_changed","whitelabel.property_changed","incentive.granted","kyc.status_changed","mail.sent","mail.failed"]},"source":{"type":"string","enum":["zapier","make","n8n"]}},"required":["url","event"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["manual","zapier","make","n8n"]},"url":{"type":"string"},"event":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"createdAt":{"type":"string"},"secret":{"type":"string"}},"required":["id","source","url","event","events","status","createdAt","secret"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/v1/hooks/{id}":{"delete":{"tags":["v1"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}],"security":[{"machineAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/hooks/samples/{event}":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"string","minLength":3,"maxLength":80},"in":"path","name":"event","required":true}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"subjectType":{"type":"string"},"subjectId":{"type":"string"},"orgId":{"type":"string","nullable":true},"actorId":{"type":"string","nullable":true},"payload":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"}},"required":["id","type","subjectType","subjectId","orgId","actorId","payload","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/leads":{"post":{"tags":["v1"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"email":{"type":"string","format":"email"},"company":{"type":"string","maxLength":160},"title":{"type":"string","maxLength":160},"message":{"type":"string","maxLength":2000},"fields":{"type":"object","additionalProperties":{}}},"required":["name"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]},"get":{"tags":["v1"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"},"nextCursor":{"type":"string","nullable":true}},"required":["data","page","pageSize","total","totalPages","nextCursor"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/partners":{"post":{"tags":["v1"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"],"default":"registered"},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"],"default":"prospect"},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","maxLength":100,"nullable":true},"contactName":{"type":"string","maxLength":200,"nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000,"default":1000},"notes":{"type":"string","maxLength":5000,"nullable":true}},"required":["name","type"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"]},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","type","tier","status","website","country","contactName","contactEmail","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]},"get":{"tags":["v1"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"status":{"type":"string","enum":["prospect","applied","onboarding","active","suspended","churned"]},"website":{"type":"string","format":"uri","nullable":true},"country":{"type":"string","nullable":true},"contactName":{"type":"string","nullable":true},"contactEmail":{"type":"string","format":"email","nullable":true},"ownerUserId":{"type":"string","format":"uuid","nullable":true},"commissionBps":{"type":"integer","minimum":0,"maximum":10000},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","type","tier","status","website","country","contactName","contactEmail","ownerUserId","commissionBps","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"},"nextCursor":{"type":"string","nullable":true}},"required":["data","page","pageSize","total","totalPages","nextCursor"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/referrals":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"widgetId","required":false},{"schema":{"type":"string","enum":["invited","signed_up","converted","rewarded","void"]},"in":"query","name":"status","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"widgetId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"referrerEmail":{"type":"string"},"referrerCustomerId":{"type":"string","format":"uuid","nullable":true},"referrerPartnerId":{"type":"string","format":"uuid","nullable":true},"referredEmail":{"type":"string","nullable":true},"referredCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["invited","signed_up","converted","rewarded","void"]},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","widgetId","code","referrerEmail","referrerCustomerId","referrerPartnerId","referredEmail","referredCustomerId","status","rewardRef","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"},"nextCursor":{"type":"string","nullable":true}},"required":["data","page","pageSize","total","totalPages","nextCursor"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/referral-widgets":{"get":{"tags":["v1"],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"config":{"type":"object","properties":{"headline":{"type":"string","maxLength":140},"body":{"type":"string","maxLength":600},"buttonLabel":{"type":"string","maxLength":40},"landingUrl":{"type":"string","format":"uri","maxLength":500},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"partnerId":{"type":"string","format":"uuid","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true}},"additionalProperties":false},"reward":{"type":"object","properties":{"kind":{"type":"string","enum":["none","credit","wallet","coupon"],"default":"none"},"amount":{"type":"integer","minimum":0,"maximum":10000000},"currency":{"type":"string","minLength":3,"maxLength":3},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000},"trigger":{"type":"string","enum":["signup","conversion"],"default":"conversion"}},"additionalProperties":false},"status":{"type":"string","enum":["active","paused"]},"stats":{"type":"object","properties":{"invited":{"type":"integer"},"signedUp":{"type":"integer"},"converted":{"type":"integer"},"rewarded":{"type":"integer"}},"required":["invited","signedUp","converted","rewarded"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","config","reward","status","stats","createdAt","updatedAt"],"additionalProperties":false}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/cosell/overlaps":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["open","actioned","dismissed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"shared","required":false},{"schema":{"type":"integer","minimum":0,"maximum":100},"in":"query","name":"minScore","required":false},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":200},"in":"query","name":"limit","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"accountDomain":{"type":"string"},"accountName":{"type":"string","nullable":true},"ourStatus":{"type":"string","nullable":true},"partnerStatus":{"type":"string","nullable":true},"source":{"type":"string"},"score":{"type":"integer"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"shared":{"type":"boolean"},"suggestion":{"type":"object","properties":{"source":{"type":"string","enum":["rules","ai"]},"nextStep":{"type":"string"},"introEmail":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"}},"required":["subject","body"],"additionalProperties":false},"rationale":{"type":"string","nullable":true},"sharedWithPartner":{"type":"boolean","default":false},"generatedAt":{"type":"string","nullable":true}},"required":["source","nextStep","introEmail"],"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","partnerName","accountDomain","accountName","ourStatus","partnerStatus","source","score","status","shared","suggestion","createdAt","updatedAt"],"additionalProperties":false}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/v1/skills":{"get":{"tags":["v1"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false}],"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string"},"system":{"type":"string","nullable":true},"prompt":{"type":"string"},"inputSchema":{"type":"object","additionalProperties":{},"nullable":true},"outputSchema":{"type":"object","additionalProperties":{},"nullable":true},"audience":{"type":"string","enum":["operator","partner","both"]},"status":{"type":"string","enum":["published","draft"]},"isDefault":{"type":"boolean"},"overridesDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","description","category","system","prompt","inputSchema","outputSchema","audience","status","isDefault","overridesDefault","createdAt","updatedAt"],"additionalProperties":false}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/copilot/conversations":{"get":{"tags":["copilot"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"title":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","userId","title","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["copilot"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"title":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","userId","title","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/copilot/conversations/{id}/messages":{"get":{"tags":["copilot"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["user","assistant","tool"]},"content":{"type":"string"},"toolCalls":{"type":"array","items":{"type":"object","additionalProperties":{}},"nullable":true},"proposal":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"toolName":{"type":"string"},"args":{"type":"object","additionalProperties":{}},"effect":{"type":"string","enum":["read","write","external","destructive"]},"summary":{"type":"string"},"status":{"type":"string","enum":["pending","approved","cancelled"]}},"required":["id","toolName","args","effect","summary","status"],"additionalProperties":false},"createdAt":{"type":"string"}},"required":["id","conversationId","role","content","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/copilot/proposals/{id}/approve":{"post":{"tags":["copilot"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"toolName":{"type":"string"},"args":{"type":"object","additionalProperties":{}},"effect":{"type":"string","enum":["read","write","external","destructive"]},"summary":{"type":"string"},"status":{"type":"string","enum":["pending","approved","cancelled"]}},"required":["id","toolName","args","effect","summary","status"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/copilot/messages":{"post":{"tags":["copilot"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string","format":"uuid"},"message":{"type":"string","minLength":1}},"required":["message"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/agents/conversations":{"get":{"tags":["agents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"teamId":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","userId","teamId","title","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"not":{}},{"type":"object","properties":{"teamId":{"type":"string","format":"uuid"}},"additionalProperties":false}]}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid"},"teamId":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","userId","teamId","title","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/agents/conversations/{id}/messages":{"get":{"tags":["agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"runId":{"type":"string","format":"uuid","nullable":true},"role":{"type":"string","enum":["user","assistant"]},"content":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","conversationId","runId","role","content","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/agents/runs/{id}":{"get":{"tags":["agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid","nullable":true},"teamId":{"type":"string","format":"uuid","nullable":true},"goal":{"type":"string"},"status":{"type":"string","enum":["queued","running","waiting_approval","succeeded","failed","cancelled"]},"context":{"type":"object","additionalProperties":{}},"createdById":{"type":"string","format":"uuid","nullable":true},"nextActionAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"steps":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"runId":{"type":"string","format":"uuid"},"seq":{"type":"integer","minimum":0},"agentKey":{"type":"string"},"kind":{"type":"string","enum":["plan","delegate","delegate_result","tool_call","tool_result","approval_request","approval_resolved","message","final","error"]},"title":{"type":"string"},"detail":{"type":"string","nullable":true},"toolName":{"type":"string","nullable":true},"toolArgs":{"type":"object","additionalProperties":{},"nullable":true},"toolResult":{},"effect":{"type":"string","enum":["read","write","external","destructive"],"nullable":true},"proposalId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","runId","seq","agentKey","kind","title","status","createdAt"],"additionalProperties":false}}},"required":["id","orgId","conversationId","teamId","goal","status","context","createdById","nextActionAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/agents/runs":{"post":{"tags":["agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"teamId":{"type":"string","format":"uuid"},"goal":{"type":"string","minLength":1},"runAt":{"type":"string","format":"date-time"}},"required":["goal"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"runId":{"type":"string","format":"uuid"}},"required":["runId"],"additionalProperties":false}}}}}}},"/api/agents/messages":{"post":{"tags":["agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"conversationId":{"type":"string","format":"uuid"},"teamId":{"type":"string","format":"uuid"},"message":{"type":"string","minLength":1}},"required":["message"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/agents/steps/{id}/approve":{"post":{"tags":["agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/agents/tools":{"get":{"tags":["agents"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"effect":{"type":"string","enum":["read","write","external","destructive"]},"module":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}}},"required":["name","description","effect","module"],"additionalProperties":false}}}}}}}},"/api/agents/teams":{"get":{"tags":["agents"],"parameters":[{"schema":{"type":"string","enum":["draft","active","archived"]},"in":"query","name":"status","required":false},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}]},"in":"query","name":"templates","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"config":{"type":"object","properties":{"managerInstructions":{"type":"string","maxLength":8000,"default":""},"roles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"instructions":{"type":"string","maxLength":8000,"default":""},"toolNames":{"type":"array","items":{"type":"string"},"maxItems":300,"default":[]}},"required":["key","name"],"additionalProperties":false},"maxItems":16,"default":[]},"approvalPolicy":{"type":"string","enum":["outward","destructive_only","none"],"default":"outward"},"maxSteps":{"type":"integer","minimum":1,"maximum":200,"default":48},"maxDelegations":{"type":"integer","minimum":0,"maximum":60,"default":16}},"additionalProperties":false},"isTemplate":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","ownerOrgId","name","description","config","isTemplate","status","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"config":{"type":"object","properties":{"managerInstructions":{"type":"string","maxLength":8000,"default":""},"roles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"instructions":{"type":"string","maxLength":8000,"default":""},"toolNames":{"type":"array","items":{"type":"string"},"maxItems":300,"default":[]}},"required":["key","name"],"additionalProperties":false},"maxItems":16,"default":[]},"approvalPolicy":{"type":"string","enum":["outward","destructive_only","none"],"default":"outward"},"maxSteps":{"type":"integer","minimum":1,"maximum":200,"default":48},"maxDelegations":{"type":"integer","minimum":0,"maximum":60,"default":16}},"additionalProperties":false},"cloneFromId":{"type":"string","format":"uuid"}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"config":{"type":"object","properties":{"managerInstructions":{"type":"string","maxLength":8000,"default":""},"roles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"instructions":{"type":"string","maxLength":8000,"default":""},"toolNames":{"type":"array","items":{"type":"string"},"maxItems":300,"default":[]}},"required":["key","name"],"additionalProperties":false},"maxItems":16,"default":[]},"approvalPolicy":{"type":"string","enum":["outward","destructive_only","none"],"default":"outward"},"maxSteps":{"type":"integer","minimum":1,"maximum":200,"default":48},"maxDelegations":{"type":"integer","minimum":0,"maximum":60,"default":16}},"additionalProperties":false},"isTemplate":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","ownerOrgId","name","description","config","isTemplate","status","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/agents/teams/{id}":{"get":{"tags":["agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"config":{"type":"object","properties":{"managerInstructions":{"type":"string","maxLength":8000,"default":""},"roles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"instructions":{"type":"string","maxLength":8000,"default":""},"toolNames":{"type":"array","items":{"type":"string"},"maxItems":300,"default":[]}},"required":["key","name"],"additionalProperties":false},"maxItems":16,"default":[]},"approvalPolicy":{"type":"string","enum":["outward","destructive_only","none"],"default":"outward"},"maxSteps":{"type":"integer","minimum":1,"maximum":200,"default":48},"maxDelegations":{"type":"integer","minimum":0,"maximum":60,"default":16}},"additionalProperties":false},"isTemplate":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","ownerOrgId","name","description","config","isTemplate","status","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["agents"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"status":{"type":"string","enum":["draft","active","archived"]},"config":{"type":"object","properties":{"managerInstructions":{"type":"string","maxLength":8000,"default":""},"roles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"instructions":{"type":"string","maxLength":8000,"default":""},"toolNames":{"type":"array","items":{"type":"string"},"maxItems":300,"default":[]}},"required":["key","name"],"additionalProperties":false},"maxItems":16,"default":[]},"approvalPolicy":{"type":"string","enum":["outward","destructive_only","none"],"default":"outward"},"maxSteps":{"type":"integer","minimum":1,"maximum":200,"default":48},"maxDelegations":{"type":"integer","minimum":0,"maximum":60,"default":16}},"additionalProperties":false}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"ownerOrgId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"config":{"type":"object","properties":{"managerInstructions":{"type":"string","maxLength":8000,"default":""},"roles":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":50,"pattern":"^[a-z0-9_]+$"},"name":{"type":"string","minLength":1,"maxLength":100},"instructions":{"type":"string","maxLength":8000,"default":""},"toolNames":{"type":"array","items":{"type":"string"},"maxItems":300,"default":[]}},"required":["key","name"],"additionalProperties":false},"maxItems":16,"default":[]},"approvalPolicy":{"type":"string","enum":["outward","destructive_only","none"],"default":"outward"},"maxSteps":{"type":"integer","minimum":1,"maximum":200,"default":48},"maxDelegations":{"type":"integer","minimum":0,"maximum":60,"default":16}},"additionalProperties":false},"isTemplate":{"type":"boolean"},"status":{"type":"string","enum":["draft","active","archived"]},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","ownerOrgId","name","description","config","isTemplate","status","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["agents"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/links":{"get":{"tags":["tracking"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string"},"in":"query","name":"kind","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"destinationUrl":{"type":"string","format":"uri"},"label":{"type":"string","nullable":true},"kind":{"type":"string","enum":["referral","affiliate","deeplink"]},"url":{"type":"string"},"programId":{"type":"string","format":"uuid","nullable":true,"default":null},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true,"default":null},"clickCount":{"type":"integer"},"conversionCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","productId","code","destinationUrl","label","kind","url","clickCount","conversionCount","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["tracking"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{3,39}$"},"destinationUrl":{"type":"string","format":"uri"},"label":{"type":"string","minLength":1,"maxLength":160},"kind":{"type":"string","enum":["referral","affiliate","deeplink"],"default":"referral"},"productId":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"}},"required":["destinationUrl"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"destinationUrl":{"type":"string","format":"uri"},"label":{"type":"string","nullable":true},"kind":{"type":"string","enum":["referral","affiliate","deeplink"]},"url":{"type":"string"},"programId":{"type":"string","format":"uuid","nullable":true,"default":null},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true,"default":null},"clickCount":{"type":"integer"},"conversionCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","productId","code","destinationUrl","label","kind","url","clickCount","conversionCount","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/links/{id}":{"get":{"tags":["tracking"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"destinationUrl":{"type":"string","format":"uri"},"label":{"type":"string","nullable":true},"kind":{"type":"string","enum":["referral","affiliate","deeplink"]},"url":{"type":"string"},"programId":{"type":"string","format":"uuid","nullable":true,"default":null},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true,"default":null},"clickCount":{"type":"integer"},"conversionCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","productId","code","destinationUrl","label","kind","url","clickCount","conversionCount","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["tracking"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":160,"nullable":true},"destinationUrl":{"type":"string","format":"uri"},"kind":{"type":"string","enum":["referral","affiliate","deeplink"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"destinationUrl":{"type":"string","format":"uri"},"label":{"type":"string","nullable":true},"kind":{"type":"string","enum":["referral","affiliate","deeplink"]},"url":{"type":"string"},"programId":{"type":"string","format":"uuid","nullable":true,"default":null},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true,"default":null},"clickCount":{"type":"integer"},"conversionCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","productId","code","destinationUrl","label","kind","url","clickCount","conversionCount","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["tracking"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/links/{id}/stats":{"get":{"tags":["tracking"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"linkId":{"type":"string","format":"uuid"},"clicks":{"type":"integer"},"conversions":{"type":"integer"},"conversionRate":{"type":"number"}},"required":["linkId","clicks","conversions","conversionRate"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/coupons":{"get":{"tags":["tracking"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"linkId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"code":{"type":"string"},"linkId":{"type":"string","format":"uuid","nullable":true},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0},"active":{"type":"boolean"},"redemptions":{"type":"integer"},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","code","linkId","discountType","discountValue","active","redemptions","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["tracking"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":3,"maxLength":40},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0},"linkId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"}},"required":["discountType","discountValue"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"code":{"type":"string"},"linkId":{"type":"string","format":"uuid","nullable":true},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0},"active":{"type":"boolean"},"redemptions":{"type":"integer"},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","code","linkId","discountType","discountValue","active","redemptions","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/coupons/bulk":{"post":{"tags":["tracking"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"coupons":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"code":{"type":"string","minLength":3,"maxLength":40},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0},"linkId":{"type":"string","format":"uuid"}},"required":["code","discountType","discountValue"],"additionalProperties":false},"minItems":1,"maxItems":500}},"required":["coupons"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"existing":{"type":"integer"},"conflicts":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"status":{"type":"string","enum":["created","exists","conflict","failed"]},"id":{"type":"string","format":"uuid","nullable":true},"error":{"type":"string","nullable":true}},"required":["index","status","id","error"],"additionalProperties":false}}},"required":["created","existing","conflicts","failed","results"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/coupons/{id}":{"delete":{"tags":["tracking"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/attributions":{"get":{"tags":["tracking"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"linkId","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["live","test"],"default":"live"},"in":"query","name":"environment","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"linkId":{"type":"string","format":"uuid","nullable":true},"couponId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"visitorId":{"type":"string","nullable":true},"model":{"type":"string","enum":["last_click","first_click"]},"status":{"type":"string","enum":["pending","converted","expired","rejected","reversed"]},"environment":{"type":"string","enum":["live","test"]},"expiresAt":{"type":"string"},"convertedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","linkId","couponId","customerId","visitorId","model","status","environment","expiresAt","convertedAt","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/track/conversion":{"post":{"tags":["track"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"conversionKey":{"type":"string","minLength":1},"visitorId":{"type":"string"},"couponCode":{"type":"string"},"customerEmail":{"type":"string","format":"email"},"customerName":{"type":"string"},"customerKey":{"type":"string","minLength":1,"maxLength":200},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","pattern":"^[A-Za-z]{3}$"},"externalCustomerId":{"type":"string","maxLength":200}},"required":["conversionKey"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"linkId":{"type":"string","format":"uuid","nullable":true},"couponId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"visitorId":{"type":"string","nullable":true},"model":{"type":"string","enum":["last_click","first_click"]},"status":{"type":"string","enum":["pending","converted","expired","rejected","reversed"]},"environment":{"type":"string","enum":["live","test"]},"expiresAt":{"type":"string"},"convertedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","linkId","couponId","customerId","visitorId","model","status","environment","expiresAt","convertedAt","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/track/conversion\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"conversionKey\": \"order_789\",\n  \"visitorId\": \"3f9c1e2d4b5a69788796a5b4c3d2e1f0\",\n  \"customerKey\": \"acct_123\",\n  \"customerEmail\": \"jane@customer.example.com\",\n  \"amount\": 4900,\n  \"currency\": \"USD\",\n  \"externalCustomerId\": \"acct_123\"\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/track/conversion\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"conversionKey\": \"order_789\",\n    \"visitorId\": \"3f9c1e2d4b5a69788796a5b4c3d2e1f0\",\n    \"customerKey\": \"acct_123\",\n    \"customerEmail\": \"jane@customer.example.com\",\n    \"amount\": 4900,\n    \"currency\": \"USD\",\n    \"externalCustomerId\": \"acct_123\"\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/track/conversion\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    json={\n      \"conversionKey\": \"order_789\",\n      \"visitorId\": \"3f9c1e2d4b5a69788796a5b4c3d2e1f0\",\n      \"customerKey\": \"acct_123\",\n      \"customerEmail\": \"jane@customer.example.com\",\n      \"amount\": 4900,\n      \"currency\": \"USD\",\n      \"externalCustomerId\": \"acct_123\"\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/track/conversion/reverse":{"post":{"tags":["track"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"conversionKey":{"type":"string","minLength":1},"attributionId":{"type":"string","format":"uuid"},"reason":{"type":"string","enum":["refund","chargeback","fraud","cancelled"]}},"required":["reason"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"attribution":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"linkId":{"type":"string","format":"uuid","nullable":true},"couponId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"visitorId":{"type":"string","nullable":true},"model":{"type":"string","enum":["last_click","first_click"]},"status":{"type":"string","enum":["pending","converted","expired","rejected","reversed"]},"environment":{"type":"string","enum":["live","test"]},"expiresAt":{"type":"string"},"convertedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","linkId","couponId","customerId","visitorId","model","status","environment","expiresAt","convertedAt","createdAt"],"additionalProperties":false},"reversed":{"type":"boolean"},"reason":{"type":"string","enum":["refund","chargeback","fraud","cancelled"]},"clawedBack":{"type":"integer"},"deals":{"type":"array","items":{"type":"object","properties":{"dealId":{"type":"string","format":"uuid"},"action":{"type":"string"},"amount":{"type":"integer"}},"required":["dealId","action","amount"],"additionalProperties":false}}},"required":["attribution","reversed","reason","clawedBack","deals"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/setup":{"get":{"tags":["tracking"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"publishableKeys":{"type":"object","properties":{"live":{"type":"string"},"test":{"type":"string"}},"required":["live","test"],"additionalProperties":false},"scriptUrl":{"type":"string"},"param":{"type":"string"},"cookieDays":{"type":"integer"},"snippet":{"type":"string"}},"required":["publishableKeys","scriptUrl","param","cookieDays","snippet"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/publishable-keys":{"get":{"tags":["tracking"],"parameters":[{"schema":{"type":"string","enum":["live","test"]},"in":"query","name":"environment","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"environment":{"type":"string","enum":["live","test"]},"key":{"type":"string"},"label":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"lastUsedAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"createdAt":{"type":"string","nullable":true}},"required":["id","environment","key","label","isDefault","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["tracking"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"environment":{"type":"string","enum":["live","test"]}},"required":["label"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"environment":{"type":"string","enum":["live","test"]},"key":{"type":"string"},"label":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"lastUsedAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"createdAt":{"type":"string","nullable":true}},"required":["id","environment","key","label","isDefault","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tracking/publishable-keys/{id}":{"delete":{"tags":["tracking"],"parameters":[{"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"string","enum":["default_live","default_test"]}]},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"environment":{"type":"string","enum":["live","test"]},"key":{"type":"string"},"label":{"type":"string","nullable":true},"isDefault":{"type":"boolean"},"lastUsedAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"createdAt":{"type":"string","nullable":true}},"required":["id","environment","key","label","isDefault","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/pw/signup":{"post":{"tags":["pw"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"k":{"type":"string","minLength":10,"maxLength":200},"v":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"customerKey":{"type":"string","minLength":1,"maxLength":200},"email":{"type":"string","format":"email","maxLength":320}},"required":["k","v","customerKey"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"attributed":{"type":"boolean"},"reason":{"type":"string","nullable":true},"incentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true}},"required":["accepted","attributed","reason"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/pw/visit":{"get":{"tags":["pw"],"parameters":[{"schema":{"type":"string","minLength":10,"maxLength":200},"in":"query","name":"k","required":true},{"schema":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"in":"query","name":"v","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"attributed":{"type":"boolean"},"cookieDays":{"type":"integer"},"incentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true}},"required":["attributed","cookieDays","incentive"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/pw/conversion":{"post":{"tags":["pw"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"k":{"type":"string","minLength":10,"maxLength":200},"v":{"type":"string","minLength":8,"maxLength":128,"pattern":"^[A-Za-z0-9_-]+$"},"externalId":{"type":"string","minLength":1,"maxLength":200},"customerKey":{"type":"string","minLength":1,"maxLength":200},"amount":{"type":"integer","minimum":0,"maximum":1000000000},"currency":{"type":"string","minLength":3,"maxLength":3}},"required":["k","v","externalId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"attributed":{"type":"boolean"},"reason":{"type":"string","nullable":true},"incentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true}},"required":["accepted","attributed","reason"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/balance":{"get":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","minLength":3,"maxLength":3},"in":"query","name":"currency","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"currency":{"type":"string"},"available":{"type":"integer","minimum":0},"pending":{"type":"integer","minimum":0}},"required":["partnerId","currency","available","pending"],"additionalProperties":false}}}}}}},"/api/payouts/balances":{"get":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"balances":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"currency":{"type":"string"},"available":{"type":"integer","minimum":0},"pending":{"type":"integer","minimum":0}},"required":["partnerId","currency","available","pending"],"additionalProperties":false}}},"required":["partnerId","balances"],"additionalProperties":false}}}}}}},"/api/payouts/ledger":{"get":{"tags":["payouts"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","minLength":3,"maxLength":3},"in":"query","name":"currency","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"walletId":{"type":"string","format":"uuid"},"delta":{"type":"integer"},"reason":{"type":"string"},"balanceAfter":{"type":"integer"},"refType":{"type":"string","nullable":true},"refId":{"type":"string","format":"uuid","nullable":true},"note":{"type":"string","nullable":true},"ruleId":{"type":"string","format":"uuid","nullable":true,"default":null},"dealId":{"type":"string","format":"uuid","nullable":true,"default":null},"provenance":{"type":"object","additionalProperties":{},"nullable":true,"default":null},"createdAt":{"type":"string"}},"required":["id","walletId","delta","reason","balanceAfter","refType","refId","note","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/payouts/methods":{"get":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","disabled"]},"isDefault":{"type":"boolean"},"accountRef":{"type":"string","nullable":true},"bank":{"type":"object","properties":{"scheme":{"type":"string","enum":["iban","ach","swift","check"]},"accountHolder":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"masked":{"type":"string"}},"required":["scheme","accountHolder","country","currency","masked"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","provider","label","status","isDefault","accountRef","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["payouts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"label":{"type":"string","maxLength":160},"isDefault":{"type":"boolean"},"stripeAccountId":{"type":"string"},"paypalEmail":{"type":"string","format":"email"},"wiseRecipientId":{"type":"string"},"secret":{"type":"string"},"bank":{"type":"object","properties":{"scheme":{"type":"string","enum":["iban","ach","swift","check"]},"accountHolder":{"type":"string","minLength":1,"maxLength":140},"country":{"type":"string","minLength":2,"maxLength":2},"currency":{"type":"string","minLength":3,"maxLength":3},"iban":{"type":"string","maxLength":42},"bic":{"type":"string","maxLength":11},"accountNumber":{"type":"string","maxLength":34},"routingNumber":{"type":"string","maxLength":12},"swiftCode":{"type":"string","maxLength":11},"bankName":{"type":"string","maxLength":140},"addressLine1":{"type":"string","maxLength":200},"addressLine2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"region":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20}},"required":["scheme","accountHolder"],"additionalProperties":false},"partnerId":{"type":"string","format":"uuid"}},"required":["provider"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","disabled"]},"isDefault":{"type":"boolean"},"accountRef":{"type":"string","nullable":true},"bank":{"type":"object","properties":{"scheme":{"type":"string","enum":["iban","ach","swift","check"]},"accountHolder":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"masked":{"type":"string"}},"required":["scheme","accountHolder","country","currency","masked"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","provider","label","status","isDefault","accountRef","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/methods/{id}":{"get":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","disabled"]},"isDefault":{"type":"boolean"},"accountRef":{"type":"string","nullable":true},"bank":{"type":"object","properties":{"scheme":{"type":"string","enum":["iban","ach","swift","check"]},"accountHolder":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"masked":{"type":"string"}},"required":["scheme","accountHolder","country","currency","masked"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","provider","label","status","isDefault","accountRef","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["payouts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","disabled"]},"isDefault":{"type":"boolean"},"stripeAccountId":{"type":"string"},"paypalEmail":{"type":"string","format":"email"},"wiseRecipientId":{"type":"string"},"secret":{"type":"string"},"bank":{"type":"object","properties":{"scheme":{"type":"string","enum":["iban","ach","swift","check"]},"accountHolder":{"type":"string","minLength":1,"maxLength":140},"country":{"type":"string","minLength":2,"maxLength":2},"currency":{"type":"string","minLength":3,"maxLength":3},"iban":{"type":"string","maxLength":42},"bic":{"type":"string","maxLength":11},"accountNumber":{"type":"string","maxLength":34},"routingNumber":{"type":"string","maxLength":12},"swiftCode":{"type":"string","maxLength":11},"bankName":{"type":"string","maxLength":140},"addressLine1":{"type":"string","maxLength":200},"addressLine2":{"type":"string","maxLength":200},"city":{"type":"string","maxLength":100},"region":{"type":"string","maxLength":100},"postalCode":{"type":"string","maxLength":20}},"required":["scheme","accountHolder"],"additionalProperties":false}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","disabled"]},"isDefault":{"type":"boolean"},"accountRef":{"type":"string","nullable":true},"bank":{"type":"object","properties":{"scheme":{"type":"string","enum":["iban","ach","swift","check"]},"accountHolder":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"masked":{"type":"string"}},"required":["scheme","accountHolder","country","currency","masked"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","provider","label","status","isDefault","accountRef","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/methods/{id}/default":{"post":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"label":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","disabled"]},"isDefault":{"type":"boolean"},"accountRef":{"type":"string","nullable":true},"bank":{"type":"object","properties":{"scheme":{"type":"string","enum":["iban","ach","swift","check"]},"accountHolder":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"currency":{"type":"string","nullable":true},"masked":{"type":"string"}},"required":["scheme","accountHolder","country","currency","masked"],"additionalProperties":false,"nullable":true,"default":null},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","provider","label","status","isDefault","accountRef","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/withdrawals":{"get":{"tags":["payouts"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"payoutMethodId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string","enum":["requested","approved","paid","failed","canceled","rejected"]},"externalId":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true,"default":null},"environment":{"type":"string","enum":["live","test"],"default":"live"},"partnerName":{"type":"string","nullable":true},"ledgerEntryId":{"type":"string","format":"uuid","nullable":true},"requestedById":{"type":"string","format":"uuid","nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"attempts":{"type":"integer"},"paidAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","payoutMethodId","provider","amount","currency","status","externalId","failureReason","ledgerEntryId","requestedById","approvedById","attempts","paidAt","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["payouts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amount":{"type":"integer","minimum":0},"payoutMethodId":{"type":"string","format":"uuid"},"note":{"type":"string","maxLength":500},"currency":{"type":"string","minLength":3,"maxLength":3},"partnerId":{"type":"string","format":"uuid"}},"required":["amount"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"payoutMethodId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string","enum":["requested","approved","paid","failed","canceled","rejected"]},"externalId":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true,"default":null},"environment":{"type":"string","enum":["live","test"],"default":"live"},"partnerName":{"type":"string","nullable":true},"ledgerEntryId":{"type":"string","format":"uuid","nullable":true},"requestedById":{"type":"string","format":"uuid","nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"attempts":{"type":"integer"},"paidAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","payoutMethodId","provider","amount","currency","status","externalId","failureReason","ledgerEntryId","requestedById","approvedById","attempts","paidAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/withdrawals/{id}/approve":{"post":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"payoutMethodId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string","enum":["requested","approved","paid","failed","canceled","rejected"]},"externalId":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true,"default":null},"environment":{"type":"string","enum":["live","test"],"default":"live"},"partnerName":{"type":"string","nullable":true},"ledgerEntryId":{"type":"string","format":"uuid","nullable":true},"requestedById":{"type":"string","format":"uuid","nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"attempts":{"type":"integer"},"paidAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","payoutMethodId","provider","amount","currency","status","externalId","failureReason","ledgerEntryId","requestedById","approvedById","attempts","paidAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/withdrawals/{id}/reject":{"post":{"tags":["payouts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":1000}},"required":["reason"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"payoutMethodId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string","enum":["requested","approved","paid","failed","canceled","rejected"]},"externalId":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true,"default":null},"environment":{"type":"string","enum":["live","test"],"default":"live"},"partnerName":{"type":"string","nullable":true},"ledgerEntryId":{"type":"string","format":"uuid","nullable":true},"requestedById":{"type":"string","format":"uuid","nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"attempts":{"type":"integer"},"paidAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","payoutMethodId","provider","amount","currency","status","externalId","failureReason","ledgerEntryId","requestedById","approvedById","attempts","paidAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/providers":{"get":{"tags":["payouts"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"configured":{"type":"boolean"},"message":{"type":"string","nullable":true}},"required":["provider","configured","message"],"additionalProperties":false}}}}}}}},"/api/payouts/withdrawals/{id}/cancel":{"post":{"tags":["payouts"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"payoutMethodId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string","enum":["requested","approved","paid","failed","canceled","rejected"]},"externalId":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true,"default":null},"environment":{"type":"string","enum":["live","test"],"default":"live"},"partnerName":{"type":"string","nullable":true},"ledgerEntryId":{"type":"string","format":"uuid","nullable":true},"requestedById":{"type":"string","format":"uuid","nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"attempts":{"type":"integer"},"paidAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","payoutMethodId","provider","amount","currency","status","externalId","failureReason","ledgerEntryId","requestedById","approvedById","attempts","paidAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/withdrawals/{id}/mark-paid":{"post":{"tags":["payouts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string","maxLength":140}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"payoutMethodId":{"type":"string","format":"uuid","nullable":true},"provider":{"type":"string","enum":["manual","stripe_connect","paypal","wise","bank_transfer","check"]},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string","enum":["requested","approved","paid","failed","canceled","rejected"]},"externalId":{"type":"string","nullable":true},"failureReason":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true,"default":null},"environment":{"type":"string","enum":["live","test"],"default":"live"},"partnerName":{"type":"string","nullable":true},"ledgerEntryId":{"type":"string","format":"uuid","nullable":true},"requestedById":{"type":"string","format":"uuid","nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"attempts":{"type":"integer"},"paidAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","payoutMethodId","provider","amount","currency","status","externalId","failureReason","ledgerEntryId","requestedById","approvedById","attempts","paidAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/bank-export":{"post":{"tags":["payouts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["csv","sepa"],"default":"csv"},"currency":{"type":"string","minLength":3,"maxLength":3},"withdrawalIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":500}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string"},"contentType":{"type":"string"},"content":{"type":"string"},"count":{"type":"integer"},"total":{"type":"integer"},"currency":{"type":"string","nullable":true},"withdrawalIds":{"type":"array","items":{"type":"string","format":"uuid"}},"skipped":{"type":"array","items":{"type":"object","properties":{"withdrawalId":{"type":"string","format":"uuid"},"reason":{"type":"string"}},"required":["withdrawalId","reason"],"additionalProperties":false}}},"required":["filename","contentType","content","count","total","currency","withdrawalIds","skipped"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payouts/settings":{"get":{"tags":["payouts"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"requireKyc":{"type":"boolean"},"sepaDebtorName":{"type":"string","nullable":true},"sepaDebtorIban":{"type":"string","nullable":true},"sepaDebtorBic":{"type":"string","nullable":true}},"required":["requireKyc","sepaDebtorName","sepaDebtorIban","sepaDebtorBic"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["payouts"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"requireKyc":{"type":"boolean"},"sepaDebtorName":{"type":"string","maxLength":70,"nullable":true},"sepaDebtorIban":{"type":"string","maxLength":42,"nullable":true},"sepaDebtorBic":{"type":"string","maxLength":11,"nullable":true}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"requireKyc":{"type":"boolean"},"sepaDebtorName":{"type":"string","nullable":true},"sepaDebtorIban":{"type":"string","nullable":true},"sepaDebtorBic":{"type":"string","nullable":true}},"required":["requireKyc","sepaDebtorName","sepaDebtorIban","sepaDebtorBic"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payout-batches":{"get":{"tags":["payout-batches"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string"},"totalCents":{"type":"integer"},"payoutCount":{"type":"integer"},"status":{"type":"string","enum":["draft","invoiced","funded","released","void"]},"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"invoicedAt":{"type":"string","nullable":true},"fundedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","currency","totalCents","payoutCount","status","invoiceRef","externalInvoiceId","invoicedAt","fundedAt","releasedAt","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["payout-batches"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"}},"required":["periodStart","periodEnd"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string"},"totalCents":{"type":"integer"},"payoutCount":{"type":"integer"},"status":{"type":"string","enum":["draft","invoiced","funded","released","void"]},"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"invoicedAt":{"type":"string","nullable":true},"fundedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"payouts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string"},"reference":{"type":"string","nullable":true},"note":{"type":"string","nullable":true}},"required":["id","partnerId","partnerName","periodStart","periodEnd","amount","currency","status","reference","note"],"additionalProperties":false}}},"required":["id","orgId","periodStart","periodEnd","currency","totalCents","payoutCount","status","invoiceRef","externalInvoiceId","invoicedAt","fundedAt","releasedAt","createdAt","updatedAt","payouts"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payout-batches/{id}":{"get":{"tags":["payout-batches"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string"},"totalCents":{"type":"integer"},"payoutCount":{"type":"integer"},"status":{"type":"string","enum":["draft","invoiced","funded","released","void"]},"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"invoicedAt":{"type":"string","nullable":true},"fundedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"payouts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"status":{"type":"string"},"reference":{"type":"string","nullable":true},"note":{"type":"string","nullable":true}},"required":["id","partnerId","partnerName","periodStart","periodEnd","amount","currency","status","reference","note"],"additionalProperties":false}}},"required":["id","orgId","periodStart","periodEnd","currency","totalCents","payoutCount","status","invoiceRef","externalInvoiceId","invoicedAt","fundedAt","releasedAt","createdAt","updatedAt","payouts"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payout-batches/{id}/invoice":{"get":{"tags":["payout-batches"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"hostedInvoiceUrl":{"type":"string","nullable":true},"html":{"type":"string"}},"required":["invoiceRef","externalInvoiceId","hostedInvoiceUrl","html"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["payout-batches"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string"},"totalCents":{"type":"integer"},"payoutCount":{"type":"integer"},"status":{"type":"string","enum":["draft","invoiced","funded","released","void"]},"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"invoicedAt":{"type":"string","nullable":true},"fundedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","currency","totalCents","payoutCount","status","invoiceRef","externalInvoiceId","invoicedAt","fundedAt","releasedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payout-batches/{id}/funded":{"post":{"tags":["payout-batches"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string"},"totalCents":{"type":"integer"},"payoutCount":{"type":"integer"},"status":{"type":"string","enum":["draft","invoiced","funded","released","void"]},"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"invoicedAt":{"type":"string","nullable":true},"fundedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","currency","totalCents","payoutCount","status","invoiceRef","externalInvoiceId","invoicedAt","fundedAt","releasedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payout-batches/{id}/release":{"post":{"tags":["payout-batches"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"batch":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string"},"totalCents":{"type":"integer"},"payoutCount":{"type":"integer"},"status":{"type":"string","enum":["draft","invoiced","funded","released","void"]},"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"invoicedAt":{"type":"string","nullable":true},"fundedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","currency","totalCents","payoutCount","status","invoiceRef","externalInvoiceId","invoicedAt","fundedAt","releasedAt","createdAt","updatedAt"],"additionalProperties":false},"results":{"type":"array","items":{"type":"object","properties":{"payoutId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"amount":{"type":"integer"},"outcome":{"type":"string","enum":["withdrawal","skipped"]},"withdrawalId":{"type":"string","format":"uuid","nullable":true},"reason":{"type":"string","nullable":true}},"required":["payoutId","partnerId","amount","outcome","withdrawalId","reason"],"additionalProperties":false}}},"required":["batch","results"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/payout-batches/{id}/void":{"post":{"tags":["payout-batches"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"currency":{"type":"string"},"totalCents":{"type":"integer"},"payoutCount":{"type":"integer"},"status":{"type":"string","enum":["draft","invoiced","funded","released","void"]},"invoiceRef":{"type":"string","nullable":true},"externalInvoiceId":{"type":"string","nullable":true},"invoicedAt":{"type":"string","nullable":true},"fundedAt":{"type":"string","nullable":true},"releasedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","currency","totalCents","payoutCount","status","invoiceRef","externalInvoiceId","invoicedAt","fundedAt","releasedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tax/forms":{"get":{"tags":["tax"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["w9","w8_ben"]},"in":"query","name":"type","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["tax"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["w9","w8_ben"]},"fields":{"type":"object","additionalProperties":{}},"partnerId":{"type":"string","format":"uuid"}},"required":["type","fields"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tax/1099":{"get":{"tags":["tax"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"integer","minimum":2000,"maximum":2100},"in":"query","name":"year","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}}},"/api/tax/1099/generate":{"post":{"tags":["tax"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"year":{"type":"integer","minimum":2000,"maximum":2100}},"required":["partnerId","year"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["mnda","nda","loi","partner_agreement","reseller_agreement","referral_agreement","msa","order_form","sow","quote","dpa","scc","baa","subprocessor_policy","toms","sla","aup","tos","privacy_policy","eula","amendment","w9","w8_ben","form_1099","training_certificate"]},"level":{"type":"string","enum":["vendor_partner","partner_customer","vendor_customer","mutual","policy"]},"category":{"type":"string","enum":["agreement","commercial","data_protection","security","service","policy","tax","enablement"]},"title":{"type":"string","minLength":1},"description":{"type":"string","nullable":true},"ownerType":{"type":"string","enum":["vendor","partner"]},"ownerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"selfOrgId":{"type":"string","format":"uuid","nullable":true},"counterpartyOrgId":{"type":"string","format":"uuid","nullable":true},"relationshipId":{"type":"string","format":"uuid","nullable":true},"direction":{"type":"string","enum":["downstream","upstream","mutual","policy"],"nullable":true},"counterpartyName":{"type":"string","nullable":true},"governingLaw":{"type":"string","nullable":true},"version":{"type":"string"},"status":{"type":"string","enum":["draft","in_review","sent","viewed","signed","countersigned","active","expired","terminated","superseded"]},"letterhead":{"type":"object","properties":{"brandName":{"type":"string"},"logoUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"footerText":{"type":"string","nullable":true},"supportEmail":{"type":"string","nullable":true}},"required":["brandName","logoUrl","primaryColor","legalName","address","footerText","supportEmail"],"additionalProperties":false,"nullable":true},"sections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"heading":{"type":"string"},"body":{"type":"string"},"order":{"type":"integer"}},"required":["id","heading","body","order"],"additionalProperties":false}},"variables":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z0-9_.]+$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","textarea","date","number","email","currency","select","multiselect","address","boolean"],"default":"text"},"source":{"type":"string","enum":["manual","org","partner","customer","deal","computed"],"default":"manual"},"required":{"type":"boolean","default":false},"placeholder":{"type":"string","nullable":true},"help":{"type":"string","nullable":true},"defaultValue":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]},"options":{"type":"array","items":{"type":"string"}}},"required":["key","label"],"additionalProperties":false}},"variableValues":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"parties":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["vendor","partner","customer","controller","processor","subprocessor","joint_controller","disclosing","receiving"]},"name":{"type":"string"},"legalName":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"signatory":{"type":"string","nullable":true},"signatoryTitle":{"type":"string","nullable":true}},"required":["role","name"],"additionalProperties":false}},"signatures":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"type":"string","format":"email","nullable":true},"role":{"type":"string","enum":["vendor","partner","customer"]},"title":{"type":"string","nullable":true},"signedAt":{"type":"string"},"ip":{"type":"string","nullable":true}},"required":["name","email","role","signedAt","ip"],"additionalProperties":false}},"effectiveDate":{"type":"string","nullable":true},"expiryDate":{"type":"string","nullable":true},"termMonths":{"type":"integer","nullable":true},"autoRenew":{"type":"boolean"},"renewalTermMonths":{"type":"integer","nullable":true},"noticePeriodDays":{"type":"integer"},"expiringNotifiedAt":{"type":"string","nullable":true},"terminatedAt":{"type":"string","nullable":true},"terminationReason":{"type":"string","nullable":true},"revision":{"type":"integer"},"supersedesId":{"type":"string","format":"uuid","nullable":true},"parentDocumentId":{"type":"string","format":"uuid","nullable":true},"bundleId":{"type":"string","format":"uuid","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"signingProvider":{"type":"string","enum":["builtin","docusign"]},"signingStatus":{"type":"string","enum":["none","pending","completed","declined","voided"]},"envelopeId":{"type":"string","nullable":true},"envelopeMeta":{"type":"object","additionalProperties":{},"nullable":true},"sentAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","templateId","type","level","category","title","description","ownerType","ownerId","partnerId","customerId","productId","selfOrgId","counterpartyOrgId","relationshipId","direction","counterpartyName","governingLaw","version","status","sections","variables","variableValues","parties","signatures","effectiveDate","expiryDate","termMonths","autoRenew","renewalTermMonths","noticePeriodDays","expiringNotifiedAt","terminatedAt","terminationReason","revision","supersedesId","parentDocumentId","bundleId","folderId","signingProvider","signingStatus","envelopeId","envelopeMeta","sentAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/directory":{"get":{"tags":["directory"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"partnerName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}}},"required":["slug","partnerName","headline","bio","description","categories","logoUrl","coverUrl","website","socials"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/directory/{slug}":{"get":{"tags":["directory"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"slug","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string"},"partnerName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}}},"required":["slug","partnerName","headline","bio","description","categories","logoUrl","coverUrl","website","socials"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/profile":{"get":{"tags":["profile"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"slug":{"type":"string","nullable":true},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["draft","submitted","listed","rejected"]},"listedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","slug","headline","bio","description","categories","logoUrl","coverUrl","website","socials","status","listedAt","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["profile"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string","minLength":3,"maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"headline":{"type":"string","maxLength":140},"bio":{"type":"string","maxLength":600},"description":{"type":"string","maxLength":4000},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string"},"coverUrl":{"type":"string"},"website":{"type":"string"},"socials":{"type":"object","additionalProperties":{"type":"string"}}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"slug":{"type":"string","nullable":true},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["draft","submitted","listed","rejected"]},"listedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","slug","headline","bio","description","categories","logoUrl","coverUrl","website","socials","status","listedAt","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/profile/submit":{"post":{"tags":["profile"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"slug":{"type":"string","nullable":true},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["draft","submitted","listed","rejected"]},"listedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","slug","headline","bio","description","categories","logoUrl","coverUrl","website","socials","status","listedAt","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/profiles":{"get":{"tags":["profiles"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"slug":{"type":"string","nullable":true},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["draft","submitted","listed","rejected"]},"listedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","slug","headline","bio","description","categories","logoUrl","coverUrl","website","socials","status","listedAt","decisionNote","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/profiles/{id}/list":{"post":{"tags":["profiles"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"slug":{"type":"string","nullable":true},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["draft","submitted","listed","rejected"]},"listedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","slug","headline","bio","description","categories","logoUrl","coverUrl","website","socials","status","listedAt","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/profiles/{id}/reject":{"post":{"tags":["profiles"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","maxLength":500}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"slug":{"type":"string","nullable":true},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"categories":{"type":"array","items":{"type":"string"}},"logoUrl":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"socials":{"type":"object","additionalProperties":{"type":"string"}},"status":{"type":"string","enum":["draft","submitted","listed","rejected"]},"listedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","slug","headline","bio","description","categories","logoUrl","coverUrl","website","socials","status","listedAt","decisionNote","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses":{"get":{"tags":["courses"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string","enum":["beginner","intermediate","advanced"]},"in":"query","name":"level","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string","nullable":true},"summary":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"level":{"type":"string","enum":["beginner","intermediate","advanced"]},"coverUrl":{"type":"string","nullable":true},"lessonCount":{"type":"integer"},"status":{"type":"string","enum":["draft","published","archived"]},"updatedAt":{"type":"string"}},"required":["id","title","slug","summary","category","level","coverUrl","lessonCount","status","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["courses"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"summary":{"type":"string"},"category":{"type":"string"},"level":{"type":"string","enum":["beginner","intermediate","advanced"],"default":"beginner"},"coverUrl":{"type":"string"},"productId":{"type":"string","format":"uuid"}},"required":["title"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string","nullable":true},"summary":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"level":{"type":"string","enum":["beginner","intermediate","advanced"]},"coverUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","published","archived"]},"productId":{"type":"string","format":"uuid","nullable":true},"position":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","title","slug","summary","category","level","coverUrl","status","productId","position","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/courses/{id}":{"get":{"tags":["courses"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string","nullable":true},"summary":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"level":{"type":"string","enum":["beginner","intermediate","advanced"]},"coverUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","published","archived"]},"productId":{"type":"string","format":"uuid","nullable":true},"position":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lessons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"courseId":{"type":"string","format":"uuid"},"title":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"position":{"type":"integer"},"durationMinutes":{"type":"integer","nullable":true},"quiz":{"anyOf":[{"type":"object","properties":{"passPct":{"type":"integer","minimum":0,"maximum":100,"default":70},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"prompt":{"type":"string","minLength":1,"maxLength":2000},"kind":{"type":"string","enum":["single","multi","text"]},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":500}},"required":["id","label"],"additionalProperties":false},"maxItems":12,"default":[]},"answer":{"type":"array","items":{"type":"string"}},"accepted":{"type":"array","items":{"type":"string","maxLength":500}}},"required":["id","prompt","kind"],"additionalProperties":false},"maxItems":50}},"required":["questions"],"additionalProperties":false},{"type":"object","properties":{"passPct":{"type":"integer"},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"prompt":{"type":"string"},"kind":{"type":"string","enum":["single","multi","text"]},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":500}},"required":["id","label"],"additionalProperties":false}}},"required":["id","prompt","kind","options"],"additionalProperties":false}}},"required":["passPct","questions"],"additionalProperties":false}],"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","courseId","title","blocks","position","durationMinutes","createdAt","updatedAt"],"additionalProperties":false}}},"required":["id","orgId","title","slug","summary","category","level","coverUrl","status","productId","position","createdAt","updatedAt","lessons"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["courses"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"summary":{"type":"string"},"category":{"type":"string"},"level":{"type":"string","enum":["beginner","intermediate","advanced"]},"coverUrl":{"type":"string"},"productId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","published","archived"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string","nullable":true},"summary":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"level":{"type":"string","enum":["beginner","intermediate","advanced"]},"coverUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","published","archived"]},"productId":{"type":"string","format":"uuid","nullable":true},"position":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","title","slug","summary","category","level","coverUrl","status","productId","position","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses/{id}/publish":{"post":{"tags":["courses"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"slug":{"type":"string","nullable":true},"summary":{"type":"string","nullable":true},"category":{"type":"string","nullable":true},"level":{"type":"string","enum":["beginner","intermediate","advanced"]},"coverUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","published","archived"]},"productId":{"type":"string","format":"uuid","nullable":true},"position":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","title","slug","summary","category","level","coverUrl","status","productId","position","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses/{id}/lessons":{"post":{"tags":["courses"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string","minLength":1,"maxLength":160},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"position":{"type":"integer"},"durationMinutes":{"type":"integer"},"quiz":{"type":"object","properties":{"passPct":{"type":"integer","minimum":0,"maximum":100,"default":70},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"prompt":{"type":"string","minLength":1,"maxLength":2000},"kind":{"type":"string","enum":["single","multi","text"]},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":500}},"required":["id","label"],"additionalProperties":false},"maxItems":12,"default":[]},"answer":{"type":"array","items":{"type":"string"}},"accepted":{"type":"array","items":{"type":"string","maxLength":500}}},"required":["id","prompt","kind"],"additionalProperties":false},"maxItems":50}},"required":["questions"],"additionalProperties":false,"nullable":true}},"required":["title","blocks"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"courseId":{"type":"string","format":"uuid"},"title":{"type":"string"},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"position":{"type":"integer"},"durationMinutes":{"type":"integer","nullable":true},"quiz":{"anyOf":[{"type":"object","properties":{"passPct":{"type":"integer","minimum":0,"maximum":100,"default":70},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"prompt":{"type":"string","minLength":1,"maxLength":2000},"kind":{"type":"string","enum":["single","multi","text"]},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":500}},"required":["id","label"],"additionalProperties":false},"maxItems":12,"default":[]},"answer":{"type":"array","items":{"type":"string"}},"accepted":{"type":"array","items":{"type":"string","maxLength":500}}},"required":["id","prompt","kind"],"additionalProperties":false},"maxItems":50}},"required":["questions"],"additionalProperties":false},{"type":"object","properties":{"passPct":{"type":"integer"},"questions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"prompt":{"type":"string"},"kind":{"type":"string","enum":["single","multi","text"]},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":500}},"required":["id","label"],"additionalProperties":false}}},"required":["id","prompt","kind","options"],"additionalProperties":false}}},"required":["passPct","questions"],"additionalProperties":false}],"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","courseId","title","blocks","position","durationMinutes","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses/{id}/lessons/{lessonId}":{"delete":{"tags":["courses"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"lessonId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses/{id}/enroll":{"post":{"tags":["courses"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"courseId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","completed"]},"progressPct":{"type":"integer","minimum":0,"maximum":100},"completedAt":{"type":"string","nullable":true},"certificateDocId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","courseId","partnerId","status","progressPct","completedAt","certificateDocId","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses/{id}/lessons/{lessonId}/complete":{"post":{"tags":["courses"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"lessonId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"courseId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","completed"]},"progressPct":{"type":"integer","minimum":0,"maximum":100},"completedAt":{"type":"string","nullable":true},"certificateDocId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"completedLessonIds":{"type":"array","items":{"type":"string","format":"uuid"}},"quizProgress":{"type":"array","items":{"type":"object","properties":{"lessonId":{"type":"string","format":"uuid"},"score":{"type":"integer","nullable":true},"attempts":{"type":"integer"},"passed":{"type":"boolean"}},"required":["lessonId","score","attempts","passed"],"additionalProperties":false}}},"required":["id","orgId","courseId","partnerId","status","progressPct","completedAt","certificateDocId","createdAt","updatedAt","completedLessonIds"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses/{id}/lessons/{lessonId}/quiz":{"post":{"tags":["courses"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"answers":{"type":"object","additionalProperties":{"anyOf":[{"type":"string","maxLength":2000},{"type":"array","items":{"type":"string","maxLength":40},"maxItems":12}]}}},"required":["answers"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"lessonId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"lessonId":{"type":"string","format":"uuid"},"score":{"type":"integer","minimum":0,"maximum":100},"passPct":{"type":"integer"},"passed":{"type":"boolean"},"attempts":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"questionId":{"type":"string"},"correct":{"type":"boolean"}},"required":["questionId","correct"],"additionalProperties":false}},"enrollment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"courseId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","completed"]},"progressPct":{"type":"integer","minimum":0,"maximum":100},"completedAt":{"type":"string","nullable":true},"certificateDocId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"completedLessonIds":{"type":"array","items":{"type":"string","format":"uuid"}},"quizProgress":{"type":"array","items":{"type":"object","properties":{"lessonId":{"type":"string","format":"uuid"},"score":{"type":"integer","nullable":true},"attempts":{"type":"integer"},"passed":{"type":"boolean"}},"required":["lessonId","score","attempts","passed"],"additionalProperties":false}}},"required":["id","orgId","courseId","partnerId","status","progressPct","completedAt","certificateDocId","createdAt","updatedAt","completedLessonIds"],"additionalProperties":false}},"required":["lessonId","score","passPct","passed","attempts","results","enrollment"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/courses/{id}/enrollment":{"get":{"tags":["courses"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"courseId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","completed"]},"progressPct":{"type":"integer","minimum":0,"maximum":100},"completedAt":{"type":"string","nullable":true},"certificateDocId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"completedLessonIds":{"type":"array","items":{"type":"string","format":"uuid"}},"quizProgress":{"type":"array","items":{"type":"object","properties":{"lessonId":{"type":"string","format":"uuid"},"score":{"type":"integer","nullable":true},"attempts":{"type":"integer"},"passed":{"type":"boolean"}},"required":["lessonId","score","attempts","passed"],"additionalProperties":false}}},"required":["id","orgId","courseId","partnerId","status","progressPct","completedAt","certificateDocId","createdAt","updatedAt","completedLessonIds"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/groups":{"get":{"tags":["groups"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["static","dynamic"]},"filter":{"type":"object","properties":{"match":{"type":"string","enum":["any","all"],"default":"any"},"tags":{"type":"array","items":{"type":"string"}},"tiers":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"nullable":true},"utmDefaults":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","kind","filter","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["groups"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string"},"kind":{"type":"string","enum":["static","dynamic"],"default":"static"},"filter":{"type":"object","properties":{"match":{"type":"string","enum":["any","all"],"default":"any"},"tags":{"type":"array","items":{"type":"string"}},"tiers":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"type":"string"}}},"additionalProperties":false},"utmDefaults":{"type":"object","additionalProperties":{"type":"string","maxLength":200}}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["static","dynamic"]},"filter":{"type":"object","properties":{"match":{"type":"string","enum":["any","all"],"default":"any"},"tags":{"type":"array","items":{"type":"string"}},"tiers":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"nullable":true},"utmDefaults":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","kind","filter","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/groups/{id}":{"patch":{"tags":["groups"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string"},"kind":{"type":"string","enum":["static","dynamic"]},"filter":{"type":"object","properties":{"match":{"type":"string","enum":["any","all"],"default":"any"},"tags":{"type":"array","items":{"type":"string"}},"tiers":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"type":"string"}}},"additionalProperties":false},"utmDefaults":{"type":"object","additionalProperties":{"type":"string","maxLength":200}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["static","dynamic"]},"filter":{"type":"object","properties":{"match":{"type":"string","enum":["any","all"],"default":"any"},"tags":{"type":"array","items":{"type":"string"}},"tiers":{"type":"array","items":{"type":"string"}},"types":{"type":"array","items":{"type":"string"}},"countries":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"nullable":true},"utmDefaults":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","kind","filter","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["groups"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/groups/{id}/members":{"get":{"tags":["groups"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"groupId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","groupId","partnerId","partnerName","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["groups"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"}},"required":["partnerId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"groupId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","groupId","partnerId","partnerName","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/groups/{id}/members/{partnerId}":{"delete":{"tags":["groups"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"partnerId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/partners/{partnerId}/tags":{"get":{"tags":["partners"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"partnerId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"tag":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","tag","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["partners"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40}}},"required":["tags"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"partnerId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"tag":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","tag","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tags":{"get":{"tags":["tags"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"tag":{"type":"string"},"count":{"type":"integer"}},"required":["tag","count"],"additionalProperties":false}}}}}}}},"/api/reports/funnel":{"get":{"tags":["reports"],"parameters":[{"schema":{"type":"string","enum":["deal_pipeline","affiliate"],"default":"deal_pipeline"},"in":"query","name":"source","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"pipelineId","required":false},{"schema":{"type":"string"},"in":"query","name":"from","required":false},{"schema":{"type":"string"},"in":"query","name":"to","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string"},"steps":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"count":{"type":"integer"}},"required":["key","label","count"],"additionalProperties":false}},"total":{"type":"integer"}},"required":["source","steps","total"],"additionalProperties":false}}}}}}},"/api/reports/leaderboard":{"get":{"tags":["reports"],"parameters":[{"schema":{"type":"string","enum":["commission","conversions","deals_won","pipeline_value"],"default":"commission"},"in":"query","name":"metric","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"in":"query","name":"limit","required":false},{"schema":{"type":"string"},"in":"query","name":"from","required":false},{"schema":{"type":"string"},"in":"query","name":"to","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"metric":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"rank":{"type":"integer"}},"required":["partnerId","partnerName","value","rank"],"additionalProperties":false}}},"required":["metric","rows"],"additionalProperties":false}}}}}}},"/api/reports/breakdown":{"post":{"tags":["reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"metric":{"type":"string","enum":["deals","pipeline_value","won_deals","won_value","commission","leads","customers","mrr","conversions","clicks","partners"]},"groupBy":{"type":"string","enum":["none","partner","partner_tier","partner_type","partner_country","deal_stage","lead_status","lead_source","customer_status","day","week","month"],"default":"none"},"filters":{"type":"object","properties":{"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+Z?)?$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}(T[\\d:.]+Z?)?$"},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":20},"tiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"partnerTypes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"countries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"stages":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"leadStatuses":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"customerStatuses":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"groupId":{"type":"string","format":"uuid"},"tag":{"type":"string","minLength":1,"maxLength":60}},"additionalProperties":false,"default":{}},"sort":{"type":"string","enum":["value_desc","value_asc","key_asc"],"default":"value_desc"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":20},"chart":{"type":"string","enum":["bar","line","number","table"]}},"required":["metric"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["breakdown"]},"spec":{"type":"object","additionalProperties":{}},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"format":{"type":"string","enum":["text","count","money","date"]}},"required":["key","label","format"],"additionalProperties":false}},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"enum":["null"],"nullable":true}]}}},"total":{"type":"number","nullable":true},"totals":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"value":{"type":"number"}},"required":["currency","value"],"additionalProperties":false},"default":[]},"chart":{"type":"object","properties":{"type":{"type":"string","enum":["bar","line","number","table"]},"x":{"type":"string","nullable":true},"y":{"type":"string"}},"required":["type","x","y"],"additionalProperties":false},"currency":{"type":"string","nullable":true}},"required":["kind","spec","columns","rows","total","chart","currency"],"additionalProperties":false}}}}}}},"/api/ai/ask":{"post":{"tags":["ai"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string","minLength":3,"maxLength":500}},"required":["question"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string"},"title":{"type":"string"},"answer":{"type":"string"},"spec":{"type":"object","additionalProperties":{},"nullable":true},"result":{"type":"object","properties":{"kind":{"type":"string","enum":["breakdown"]},"spec":{"type":"object","additionalProperties":{}},"columns":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"format":{"type":"string","enum":["text","count","money","date"]}},"required":["key","label","format"],"additionalProperties":false}},"rows":{"type":"array","items":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"enum":["null"],"nullable":true}]}}},"total":{"type":"number","nullable":true},"totals":{"type":"array","items":{"type":"object","properties":{"currency":{"type":"string"},"value":{"type":"number"}},"required":["currency","value"],"additionalProperties":false},"default":[]},"chart":{"type":"object","properties":{"type":{"type":"string","enum":["bar","line","number","table"]},"x":{"type":"string","nullable":true},"y":{"type":"string"}},"required":["type","x","y"],"additionalProperties":false},"currency":{"type":"string","nullable":true}},"required":["kind","spec","columns","rows","total","chart","currency"],"additionalProperties":false,"nullable":true}},"required":["question","title","answer","spec","result"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/reports/schedules":{"get":{"tags":["reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"reportId":{"type":"string","format":"uuid"},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"recipients":{"type":"array","items":{"type":"string"}},"format":{"type":"string","enum":["json","csv"]},"status":{"type":"string","enum":["active","paused"]},"nextRunAt":{"type":"string","nullable":true},"lastRunAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","reportId","cadence","recipients","format","status","nextRunAt","lastRunAt","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reportId":{"type":"string","format":"uuid"},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"recipients":{"type":"array","items":{"type":"string"},"default":[]},"format":{"type":"string","enum":["json","csv"],"default":"json"}},"required":["reportId","cadence"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"reportId":{"type":"string","format":"uuid"},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"recipients":{"type":"array","items":{"type":"string"}},"format":{"type":"string","enum":["json","csv"]},"status":{"type":"string","enum":["active","paused"]},"nextRunAt":{"type":"string","nullable":true},"lastRunAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","reportId","cadence","recipients","format","status","nextRunAt","lastRunAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/reports/schedules/{id}":{"patch":{"tags":["reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"recipients":{"type":"array","items":{"anyOf":[{"type":"string","format":"email"},{"type":"string","pattern":"^sheet:[0-9a-f-]{36}$"}]}},"format":{"type":"string","enum":["json","csv"]},"status":{"type":"string","enum":["active","paused"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"reportId":{"type":"string","format":"uuid"},"cadence":{"type":"string","enum":["daily","weekly","monthly"]},"recipients":{"type":"array","items":{"type":"string"}},"format":{"type":"string","enum":["json","csv"]},"status":{"type":"string","enum":["active","paused"]},"nextRunAt":{"type":"string","nullable":true},"lastRunAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","reportId","cadence","recipients","format","status","nextRunAt","lastRunAt","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["reports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/reports/schedules/{id}/run":{"post":{"tags":["reports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"reportId":{"type":"string","format":"uuid"},"scheduleId":{"type":"string","nullable":true},"kind":{"type":"string","enum":["funnel","leaderboard","custom","breakdown"]},"status":{"type":"string"},"result":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"}},"required":["id","orgId","reportId","scheduleId","kind","status","result","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/reports":{"get":{"tags":["reports"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"kind":{"type":"string","enum":["funnel","leaderboard","custom","breakdown"]},"spec":{"type":"object","additionalProperties":{}},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","kind","spec","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"kind":{"type":"string","enum":["funnel","leaderboard","custom","breakdown"]},"spec":{"type":"object","additionalProperties":{},"default":{}}},"required":["name","kind"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"kind":{"type":"string","enum":["funnel","leaderboard","custom","breakdown"]},"spec":{"type":"object","additionalProperties":{}},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","kind","spec","createdById","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"/api/reports/{id}":{"get":{"tags":["reports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"kind":{"type":"string","enum":["funnel","leaderboard","custom","breakdown"]},"spec":{"type":"object","additionalProperties":{}},"createdById":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","kind","spec","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["reports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/reports/{id}/run":{"post":{"tags":["reports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"reportId":{"type":"string","format":"uuid"},"scheduleId":{"type":"string","nullable":true},"kind":{"type":"string","enum":["funnel","leaderboard","custom","breakdown"]},"status":{"type":"string"},"result":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"}},"required":["id","orgId","reportId","scheduleId","kind","status","result","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/reports/{id}/runs":{"get":{"tags":["reports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"reportId":{"type":"string","format":"uuid"},"scheduleId":{"type":"string","nullable":true},"kind":{"type":"string","enum":["funnel","leaderboard","custom","breakdown"]},"status":{"type":"string"},"result":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"}},"required":["id","orgId","reportId","scheduleId","kind","status","result","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/crm/import":{"post":{"tags":["crm"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string","minLength":1},"objectType":{"type":"string","enum":["lead","deal","contact","account"]},"externalId":{"type":"string","minLength":1},"fields":{"type":"object","additionalProperties":{},"default":{}}},"required":["provider","objectType","externalId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","nullable":true},"provider":{"type":"string"},"objectType":{"type":"string","enum":["lead","deal","contact","account"]},"externalId":{"type":"string"},"internalType":{"type":"string","nullable":true},"internalId":{"type":"string","nullable":true},"direction":{"type":"string","enum":["inbound","outbound"]},"status":{"type":"string","enum":["synced","pending","error"]},"hash":{"type":"string","nullable":true},"lastSyncedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","connectionId","provider","objectType","externalId","internalType","internalId","direction","status","hash","lastSyncedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/crm/export/deal/{dealId}":{"post":{"tags":["crm"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"dealId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","nullable":true},"provider":{"type":"string"},"objectType":{"type":"string","enum":["lead","deal","contact","account"]},"externalId":{"type":"string"},"internalType":{"type":"string","nullable":true},"internalId":{"type":"string","nullable":true},"direction":{"type":"string","enum":["inbound","outbound"]},"status":{"type":"string","enum":["synced","pending","error"]},"hash":{"type":"string","nullable":true},"lastSyncedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","connectionId","provider","objectType","externalId","internalType","internalId","direction","status","hash","lastSyncedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/crm/sync":{"get":{"tags":["crm"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"objectType","required":false},{"schema":{"type":"string"},"in":"query","name":"direction","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","nullable":true},"provider":{"type":"string"},"objectType":{"type":"string","enum":["lead","deal","contact","account"]},"externalId":{"type":"string"},"internalType":{"type":"string","nullable":true},"internalId":{"type":"string","nullable":true},"direction":{"type":"string","enum":["inbound","outbound"]},"status":{"type":"string","enum":["synced","pending","error"]},"hash":{"type":"string","nullable":true},"lastSyncedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","connectionId","provider","objectType","externalId","internalType","internalId","direction","status","hash","lastSyncedAt","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/crm/pipedrive/pull":{"post":{"tags":["crm"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer","minimum":1,"maximum":500,"default":50}},"additionalProperties":false,"default":{}}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"imported":{"type":"object","additionalProperties":{"type":"number"}},"errors":{"type":"array","items":{"type":"string"}}},"required":["imported","errors"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cosell/{partnerId}/leads":{"post":{"tags":["cosell"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"email":{"type":"string","format":"email"},"company":{"type":"string","maxLength":160},"title":{"type":"string","maxLength":160},"message":{"type":"string","maxLength":2000},"fields":{"type":"object","additionalProperties":{}}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"partnerId","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/leads":{"post":{"tags":["leads"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"email":{"type":"string","format":"email"},"company":{"type":"string","maxLength":160},"title":{"type":"string","maxLength":160},"message":{"type":"string","maxLength":2000},"fields":{"type":"object","additionalProperties":{}}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"get":{"tags":["leads"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/leads/{id}":{"get":{"tags":["leads"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/leads/{id}/accept":{"post":{"tags":["leads"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/leads/{id}/reject":{"post":{"tags":["leads"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/leads/{id}/convert":{"post":{"tags":["leads"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string"},"productId":{"type":"string","format":"uuid"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"source":{"type":"string","enum":["cosell","crm","manual","api","referral","email","slack","form"]},"name":{"type":"string"},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"fields":{"type":"object","additionalProperties":{}},"status":{"type":"string","enum":["new","accepted","rejected","converted"]},"dealId":{"type":"string","nullable":true},"assignedToId":{"type":"string","nullable":true},"rejectionReason":{"type":"string","nullable":true},"captureId":{"type":"string","nullable":true},"routedByRuleId":{"type":"string","nullable":true},"sharedWithPartnerAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","source","name","email","company","title","message","fields","status","dealId","assignedToId","rejectionReason","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/lead-routing/rules":{"get":{"tags":["lead-routing"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"priority":{"type":"integer"},"conditions":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["source"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["country"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["region"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["company_size"]},"min":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["field"]},"field":{"type":"string","minLength":1,"maxLength":80},"op":{"type":"string","enum":["equals","not_equals","contains","exists"]},"value":{"type":"string","maxLength":200}},"required":["type","field","op"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["partner_group"]},"groupId":{"type":"string","format":"uuid"}},"required":["type","groupId"],"additionalProperties":false}]},"maxItems":20,"default":[]}},"additionalProperties":false},"actions":{"type":"object","properties":{"assignToId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"share":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10}},"additionalProperties":false},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","priority","conditions","actions","active","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["lead-routing"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"priority":{"type":"integer","minimum":0,"maximum":100000,"default":100},"conditions":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["source"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["country"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["region"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["company_size"]},"min":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["field"]},"field":{"type":"string","minLength":1,"maxLength":80},"op":{"type":"string","enum":["equals","not_equals","contains","exists"]},"value":{"type":"string","maxLength":200}},"required":["type","field","op"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["partner_group"]},"groupId":{"type":"string","format":"uuid"}},"required":["type","groupId"],"additionalProperties":false}]},"maxItems":20,"default":[]}},"additionalProperties":false},"actions":{"type":"object","properties":{"assignToId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"share":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10}},"additionalProperties":false},"active":{"type":"boolean","default":true}},"required":["name","conditions","actions"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"priority":{"type":"integer"},"conditions":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["source"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["country"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["region"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["company_size"]},"min":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["field"]},"field":{"type":"string","minLength":1,"maxLength":80},"op":{"type":"string","enum":["equals","not_equals","contains","exists"]},"value":{"type":"string","maxLength":200}},"required":["type","field","op"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["partner_group"]},"groupId":{"type":"string","format":"uuid"}},"required":["type","groupId"],"additionalProperties":false}]},"maxItems":20,"default":[]}},"additionalProperties":false},"actions":{"type":"object","properties":{"assignToId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"share":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10}},"additionalProperties":false},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","priority","conditions","actions","active","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/lead-routing/rules/{id}":{"patch":{"tags":["lead-routing"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"priority":{"type":"integer","minimum":0,"maximum":100000,"default":100},"conditions":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["source"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["country"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["region"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["company_size"]},"min":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["field"]},"field":{"type":"string","minLength":1,"maxLength":80},"op":{"type":"string","enum":["equals","not_equals","contains","exists"]},"value":{"type":"string","maxLength":200}},"required":["type","field","op"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["partner_group"]},"groupId":{"type":"string","format":"uuid"}},"required":["type","groupId"],"additionalProperties":false}]},"maxItems":20,"default":[]}},"additionalProperties":false},"actions":{"type":"object","properties":{"assignToId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"share":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10}},"additionalProperties":false},"active":{"type":"boolean","default":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"priority":{"type":"integer"},"conditions":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["source"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["country"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["region"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["company_size"]},"min":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["field"]},"field":{"type":"string","minLength":1,"maxLength":80},"op":{"type":"string","enum":["equals","not_equals","contains","exists"]},"value":{"type":"string","maxLength":200}},"required":["type","field","op"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["partner_group"]},"groupId":{"type":"string","format":"uuid"}},"required":["type","groupId"],"additionalProperties":false}]},"maxItems":20,"default":[]}},"additionalProperties":false},"actions":{"type":"object","properties":{"assignToId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"share":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10}},"additionalProperties":false},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","priority","conditions","actions","active","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["lead-routing"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/lead-routing/test":{"post":{"tags":["lead-routing"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lead":{"type":"object","properties":{"source":{"type":"string","default":"manual"},"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{},"default":{}}},"additionalProperties":false},"rule":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"priority":{"type":"integer","minimum":0,"maximum":100000,"default":100},"conditions":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["source"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["country"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["region"]},"in":{"type":"array","items":{"type":"string"},"minItems":1}},"required":["type","in"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["company_size"]},"min":{"type":"integer","minimum":0},"max":{"type":"integer","minimum":0}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["field"]},"field":{"type":"string","minLength":1,"maxLength":80},"op":{"type":"string","enum":["equals","not_equals","contains","exists"]},"value":{"type":"string","maxLength":200}},"required":["type","field","op"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["partner_group"]},"groupId":{"type":"string","format":"uuid"}},"required":["type","groupId"],"additionalProperties":false}]},"maxItems":20,"default":[]}},"additionalProperties":false},"actions":{"type":"object","properties":{"assignToId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"share":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10}},"additionalProperties":false},"active":{"type":"boolean","default":true}},"required":["name","conditions","actions"],"additionalProperties":false}},"required":["lead"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"matchedRuleId":{"type":"string","nullable":true},"matchedRuleName":{"type":"string","nullable":true},"actions":{"type":"object","properties":{"assignToId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"share":{"type":"boolean"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":10}},"additionalProperties":false,"nullable":true},"trace":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string","nullable":true},"name":{"type":"string"},"matched":{"type":"boolean"},"checks":{"type":"array","items":{"type":"object","properties":{"condition":{"type":"string"},"passed":{"type":"boolean"}},"required":["condition","passed"],"additionalProperties":false}}},"required":["ruleId","name","matched","checks"],"additionalProperties":false}}},"required":["matchedRuleId","matchedRuleName","actions","trace"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/matching/partners":{"post":{"tags":["matching"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"need":{"type":"string","minLength":1,"maxLength":2000},"categories":{"type":"array","items":{"type":"string"}},"country":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"limit":{"type":"integer","minimum":1,"maximum":50}},"required":["need"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"slug":{"type":"string","nullable":true},"score":{"type":"integer","minimum":0,"maximum":100},"reasons":{"type":"array","items":{"type":"string"}},"source":{"type":"string","enum":["ai","heuristic"]}},"required":["partnerId","partnerName","slug","score","reasons","source"],"additionalProperties":false}}}}}}}},"/api/mcp":{"post":{"tags":["mcp"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"anyOf":[{"type":"string"},{"type":"number"},{"enum":["null"],"nullable":true}]},"method":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["method"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"202":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}},"get":{"tags":["mcp"],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["mcp"],"responses":{"200":{"description":"Default Response"}}}},"/api/mcp/integration":{"post":{"tags":["mcp"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"anyOf":[{"type":"string"},{"type":"number"},{"enum":["null"],"nullable":true}]},"method":{"type":"string"},"params":{"type":"object","additionalProperties":{}}},"required":["method"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"202":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}}}},"get":{"tags":["mcp"],"responses":{"200":{"description":"Default Response"}}},"delete":{"tags":["mcp"],"responses":{"200":{"description":"Default Response"}}}},"/api/sso/connections":{"get":{"tags":["sso"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["saml","oidc"]},"status":{"type":"string","enum":["active","disabled"]},"label":{"type":"string"},"emailDomain":{"type":"string"},"idpEntityId":{"type":"string","nullable":true},"idpSsoUrl":{"type":"string","nullable":true},"idpCertificate":{"type":"string","nullable":true},"spEntityId":{"type":"string","nullable":true},"acsUrl":{"type":"string","nullable":true},"spPrivateKeyPreview":{"type":"string","nullable":true},"oidcIssuer":{"type":"string","nullable":true},"oidcClientId":{"type":"string","nullable":true},"oidcClientSecretSet":{"type":"boolean"},"oidcRedirectUri":{"type":"string","nullable":true},"defaultRole":{"type":"string"},"attributeMapping":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","type","status","label","emailDomain","idpEntityId","idpSsoUrl","idpCertificate","spEntityId","acsUrl","spPrivateKeyPreview","oidcIssuer","oidcClientId","oidcClientSecretSet","oidcRedirectUri","defaultRole","attributeMapping","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["sso"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["saml"]},"label":{"type":"string","minLength":1,"maxLength":120},"emailDomain":{"type":"string","minLength":1},"defaultRole":{"type":"string"},"attributeMapping":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"idpEntityId":{"type":"string","minLength":1},"idpSsoUrl":{"type":"string","format":"uri"},"idpCertificate":{"type":"string","minLength":1},"spPrivateKey":{"type":"string"}},"required":["type","label","emailDomain","idpEntityId","idpSsoUrl","idpCertificate"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["oidc"]},"label":{"type":"string","minLength":1,"maxLength":120},"emailDomain":{"type":"string","minLength":1},"defaultRole":{"type":"string"},"attributeMapping":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"oidcIssuer":{"type":"string","format":"uri"},"oidcClientId":{"type":"string","minLength":1},"oidcClientSecret":{"type":"string","minLength":1}},"required":["type","label","emailDomain","oidcIssuer","oidcClientId","oidcClientSecret"],"additionalProperties":false}]}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["saml","oidc"]},"status":{"type":"string","enum":["active","disabled"]},"label":{"type":"string"},"emailDomain":{"type":"string"},"idpEntityId":{"type":"string","nullable":true},"idpSsoUrl":{"type":"string","nullable":true},"idpCertificate":{"type":"string","nullable":true},"spEntityId":{"type":"string","nullable":true},"acsUrl":{"type":"string","nullable":true},"spPrivateKeyPreview":{"type":"string","nullable":true},"oidcIssuer":{"type":"string","nullable":true},"oidcClientId":{"type":"string","nullable":true},"oidcClientSecretSet":{"type":"boolean"},"oidcRedirectUri":{"type":"string","nullable":true},"defaultRole":{"type":"string"},"attributeMapping":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","type","status","label","emailDomain","idpEntityId","idpSsoUrl","idpCertificate","spEntityId","acsUrl","spPrivateKeyPreview","oidcIssuer","oidcClientId","oidcClientSecretSet","oidcRedirectUri","defaultRole","attributeMapping","createdAt","updatedAt"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sso/connections/{id}":{"patch":{"tags":["sso"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"emailDomain":{"type":"string","minLength":1},"defaultRole":{"type":"string"},"attributeMapping":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"idpEntityId":{"type":"string","minLength":1},"idpSsoUrl":{"type":"string","format":"uri"},"idpCertificate":{"type":"string","minLength":1},"spPrivateKey":{"type":"string"},"type":{"type":"string","enum":["saml"]},"status":{"type":"string","enum":["active","disabled"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"emailDomain":{"type":"string","minLength":1},"defaultRole":{"type":"string"},"attributeMapping":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"oidcIssuer":{"type":"string","format":"uri"},"oidcClientId":{"type":"string","minLength":1},"oidcClientSecret":{"type":"string","minLength":1},"type":{"type":"string","enum":["oidc"]},"status":{"type":"string","enum":["active","disabled"]}},"required":["type"],"additionalProperties":false}]}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["saml","oidc"]},"status":{"type":"string","enum":["active","disabled"]},"label":{"type":"string"},"emailDomain":{"type":"string"},"idpEntityId":{"type":"string","nullable":true},"idpSsoUrl":{"type":"string","nullable":true},"idpCertificate":{"type":"string","nullable":true},"spEntityId":{"type":"string","nullable":true},"acsUrl":{"type":"string","nullable":true},"spPrivateKeyPreview":{"type":"string","nullable":true},"oidcIssuer":{"type":"string","nullable":true},"oidcClientId":{"type":"string","nullable":true},"oidcClientSecretSet":{"type":"boolean"},"oidcRedirectUri":{"type":"string","nullable":true},"defaultRole":{"type":"string"},"attributeMapping":{"type":"object","additionalProperties":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","type","status","label","emailDomain","idpEntityId","idpSsoUrl","idpCertificate","spEntityId","acsUrl","spPrivateKeyPreview","oidcIssuer","oidcClientId","oidcClientSecretSet","oidcRedirectUri","defaultRole","attributeMapping","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["sso"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sso/scim":{"get":{"tags":["sso"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"baseUrl":{"type":"string"},"tokens":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"label":{"type":"string"},"prefix":{"type":"string"},"defaultRole":{"type":"string"},"lastUsedAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","label","prefix","defaultRole","lastUsedAt","revokedAt","createdAt"],"additionalProperties":false}}},"required":["baseUrl","tokens"],"additionalProperties":false}}}}}}},"/api/sso/scim/tokens":{"post":{"tags":["sso"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"defaultRole":{"type":"string"}},"required":["label"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"label":{"type":"string"},"prefix":{"type":"string"},"defaultRole":{"type":"string"},"lastUsedAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"token":{"type":"string"}},"required":["id","orgId","label","prefix","defaultRole","lastUsedAt","revokedAt","createdAt","token"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sso/scim/tokens/{id}":{"delete":{"tags":["sso"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/sso/resolve":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"query","name":"email","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string","format":"uuid"},"loginUrl":{"type":"string"}},"required":["connectionId","loginUrl"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/saml/{id}/metadata":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/auth/sso/availability":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","enum":["admin","portal"]},"in":"query","name":"app","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":false}}}}}}},"/api/auth/saml/{id}/login":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","enum":["admin","portal"],"default":"admin"},"in":"query","name":"app","required":false},{"schema":{"type":"string","maxLength":2048},"in":"query","name":"returnTo","required":false},{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/auth/sso/exchange":{"post":{"tags":["auth"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":16,"maxLength":128}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"isActive":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"orgKind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]}},"required":["orgId","orgName","orgKind","role","accountType"],"additionalProperties":false}},"activeOrgId":{"type":"string","format":"uuid"},"role":{"type":"string","enum":["admin","partner_manager","finance","viewer","partner_admin","partner_user","location_manager"]},"accountType":{"type":"string","enum":["operator","partner"]},"permissions":{"type":"array","items":{"type":"string"}},"customRole":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false,"nullable":true},"emailVerified":{"type":"boolean"}},"required":["token","user","memberships","activeOrgId","role","accountType"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/auth/saml/{id}/acs":{"post":{"tags":["auth"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/auth/oidc/{id}/login":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","enum":["admin","portal"],"default":"admin"},"in":"query","name":"app","required":false},{"schema":{"type":"string","maxLength":2048},"in":"query","name":"returnTo","required":false},{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/auth/oidc/{id}/callback":{"get":{"tags":["auth"],"parameters":[{"schema":{"type":"string","maxLength":4096},"in":"query","name":"code","required":false},{"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{1,256}$"},"in":"query","name":"state","required":false},{"schema":{"type":"string","maxLength":256},"in":"query","name":"error","required":false},{"schema":{"type":"string","maxLength":2048},"in":"query","name":"error_description","required":false},{"schema":{"type":"string","minLength":1},"in":"path","name":"id","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/ServiceProviderConfig":{"get":{"summary":"Service provider configuration","tags":["scim"],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/ResourceTypes":{"get":{"summary":"Resource types","tags":["scim"],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/ResourceTypes/{id}":{"get":{"summary":"One resource type","tags":["scim"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":256},"in":"path","name":"id","required":true}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/Schemas":{"get":{"summary":"Schemas","tags":["scim"],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/Schemas/{id}":{"get":{"summary":"One schema","tags":["scim"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":256},"in":"path","name":"id","required":true}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/Users":{"get":{"summary":"List users","tags":["scim"],"parameters":[{"schema":{"type":"string","maxLength":1024},"in":"query","name":"filter","required":false,"description":"`userName eq \"…\"` or `externalId eq \"…\"`"},{"schema":{"type":"integer","minimum":1},"in":"query","name":"startIndex","required":false},{"schema":{"type":"integer","minimum":0},"in":"query","name":"count","required":false}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Create a user","tags":["scim"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"schemas":{"type":"array","items":{"type":"string"}},"userName":{"type":"string","description":"The login; an email address (Okta login / Entra UPN)."},"externalId":{"type":"string","description":"The IdP's id for the user."},"active":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"displayName":{"type":"string"},"name":{"type":"object","properties":{"formatted":{"type":"string"},"givenName":{"type":"string"},"familyName":{"type":"string"}},"additionalProperties":true},"emails":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"type":{"type":"string"},"primary":{"anyOf":[{"type":"boolean"},{"type":"string"}]}},"required":["value"],"additionalProperties":true}}},"required":["userName"],"additionalProperties":true}}}},"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/Users/{id}":{"get":{"summary":"Get a user","tags":["scim"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":256},"in":"path","name":"id","required":true}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"put":{"summary":"Replace a user","tags":["scim"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"schemas":{"type":"array","items":{"type":"string"}},"userName":{"type":"string","description":"The login; an email address (Okta login / Entra UPN)."},"externalId":{"type":"string","description":"The IdP's id for the user."},"active":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"displayName":{"type":"string"},"name":{"type":"object","properties":{"formatted":{"type":"string"},"givenName":{"type":"string"},"familyName":{"type":"string"}},"additionalProperties":true},"emails":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"type":{"type":"string"},"primary":{"anyOf":[{"type":"boolean"},{"type":"string"}]}},"required":["value"],"additionalProperties":true}}},"required":["userName"],"additionalProperties":true}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":256},"in":"path","name":"id","required":true}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"patch":{"summary":"Patch a user","tags":["scim"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"schemas":{"type":"array","items":{"type":"string"}},"Operations":{"type":"array","items":{"type":"object","properties":{"op":{"type":"string","description":"add | replace | remove (case-insensitive)"},"path":{"type":"string"},"value":{}},"required":["op"],"additionalProperties":true}}},"required":["Operations"],"additionalProperties":true}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":256},"in":"path","name":"id","required":true}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"delete":{"summary":"Deprovision a user from this organization","tags":["scim"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":256},"in":"path","name":"id","required":true}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/Groups":{"get":{"summary":"List groups (always empty)","tags":["scim"],"parameters":[{"schema":{"type":"string","maxLength":1024},"in":"query","name":"filter","required":false,"description":"`userName eq \"…\"` or `externalId eq \"…\"`"},{"schema":{"type":"integer","minimum":1},"in":"query","name":"startIndex","required":false},{"schema":{"type":"integer","minimum":0},"in":"query","name":"count","required":false}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}},"post":{"summary":"Create a group (not supported)","tags":["scim"],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/scim/v2/Groups/{id}":{"get":{"summary":"Get a group (never found)","tags":["scim"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":256},"in":"path","name":"id","required":true}],"security":[{"scimAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/programs":{"get":{"tags":["programs"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","archived"]},"visibility":{"type":"string","enum":["public","invite_only"],"default":"public"},"attributionWindowDays":{"type":"integer","nullable":true,"default":null},"attributionModel":{"type":"string","enum":["last_click","first_click"],"nullable":true,"default":null},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true,"default":null},"requireKyc":{"type":"boolean","default":false},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","slug","description","status","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["programs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":2000},"visibility":{"type":"string","enum":["public","invite_only"]},"attributionWindowDays":{"type":"integer","minimum":1,"maximum":730,"nullable":true},"attributionModel":{"type":"string","enum":["last_click","first_click"],"nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true},"requireKyc":{"type":"boolean"}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","archived"]},"visibility":{"type":"string","enum":["public","invite_only"],"default":"public"},"attributionWindowDays":{"type":"integer","nullable":true,"default":null},"attributionModel":{"type":"string","enum":["last_click","first_click"],"nullable":true,"default":null},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true,"default":null},"requireKyc":{"type":"boolean","default":false},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","slug","description","status","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/{id}":{"patch":{"tags":["programs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":2000},"visibility":{"type":"string","enum":["public","invite_only"]},"attributionWindowDays":{"type":"integer","minimum":1,"maximum":730,"nullable":true},"attributionModel":{"type":"string","enum":["last_click","first_click"],"nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true},"requireKyc":{"type":"boolean"},"status":{"type":"string","enum":["active","archived"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","archived"]},"visibility":{"type":"string","enum":["public","invite_only"],"default":"public"},"attributionWindowDays":{"type":"integer","nullable":true,"default":null},"attributionModel":{"type":"string","enum":["last_click","first_click"],"nullable":true,"default":null},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true,"default":null},"requireKyc":{"type":"boolean","default":false},"memberCount":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","slug","description","status","memberCount","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["programs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/{id}/members":{"get":{"tags":["programs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","suspended"]},"joinedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","programId","partnerId","partnerName","status","joinedAt","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["programs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"}},"required":["partnerId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","suspended"]},"joinedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","programId","partnerId","partnerName","status","joinedAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/{id}/members/{partnerId}":{"delete":{"tags":["programs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"partnerId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/{id}/credit":{"post":{"tags":["programs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"amount":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","default":"usd"},"note":{"type":"string","maxLength":280}},"required":["partnerId","amount"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"currency":{"type":"string"},"total":{"type":"integer"},"available":{"type":"integer"},"pending":{"type":"integer"},"byProgram":{"type":"array","items":{"type":"object","properties":{"programId":{"type":"string","format":"uuid","nullable":true},"programName":{"type":"string","nullable":true},"earned":{"type":"integer"}},"required":["programId","programName","earned"],"additionalProperties":false}}},"required":["partnerId","currency","total","available","pending","byProgram"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/balance/unified":{"get":{"tags":["balance"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string"},"in":"query","name":"currency","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"currency":{"type":"string"},"total":{"type":"integer"},"available":{"type":"integer"},"pending":{"type":"integer"},"byProgram":{"type":"array","items":{"type":"object","properties":{"programId":{"type":"string","format":"uuid","nullable":true},"programName":{"type":"string","nullable":true},"earned":{"type":"integer"}},"required":["programId","programName","earned"],"additionalProperties":false}}},"required":["partnerId","currency","total","available","pending","byProgram"],"additionalProperties":false}}}}}}},"/api/programs/available":{"get":{"tags":["programs"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"slug":{"type":"string"},"description":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","invite_only"]},"attributionWindowDays":{"type":"integer","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true},"joined":{"type":"boolean"}},"required":["id","name","slug","description","visibility","attributionWindowDays","referredIncentive","joined"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/{id}/join":{"post":{"tags":["programs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","suspended"]},"joinedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","programId","partnerId","partnerName","status","joinedAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/{id}/invites":{"get":{"tags":["programs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"label":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"maxUses":{"type":"integer","nullable":true},"uses":{"type":"integer"},"expiresAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"state":{"type":"string","enum":["active","revoked","expired","exhausted"]},"createdAt":{"type":"string"}},"required":["id","programId","label","email","maxUses","uses","expiresAt","revokedAt","state","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["programs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","maxLength":160},"email":{"type":"string","format":"email"},"maxUses":{"type":"integer","minimum":1,"maximum":10000},"expiresInDays":{"type":"integer","minimum":1,"maximum":365}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"label":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"maxUses":{"type":"integer","nullable":true},"uses":{"type":"integer"},"expiresAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"state":{"type":"string","enum":["active","revoked","expired","exhausted"]},"createdAt":{"type":"string"},"token":{"type":"string"},"url":{"type":"string"}},"required":["id","programId","label","email","maxUses","uses","expiresAt","revokedAt","state","createdAt","token","url"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/{id}/invites/{inviteId}":{"delete":{"tags":["programs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"inviteId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"label":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"maxUses":{"type":"integer","nullable":true},"uses":{"type":"integer"},"expiresAt":{"type":"string","nullable":true},"revokedAt":{"type":"string","nullable":true},"state":{"type":"string","enum":["active","revoked","expired","exhausted"]},"createdAt":{"type":"string"}},"required":["id","programId","label","email","maxUses","uses","expiresAt","revokedAt","state","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/program-invites/{token}":{"get":{"tags":["public"],"parameters":[{"schema":{"type":"string","minLength":8,"maxLength":200},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"programId":{"type":"string","format":"uuid"},"programName":{"type":"string"},"description":{"type":"string","nullable":true},"operatorName":{"type":"string","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true},"valid":{"type":"boolean"},"reason":{"type":"string","nullable":true}},"required":["programId","programName","description","operatorName","referredIncentive","valid","reason"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/programs/invites/{token}/accept":{"post":{"tags":["programs"],"parameters":[{"schema":{"type":"string","minLength":8,"maxLength":200},"in":"path","name":"token","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","suspended"]},"joinedAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","programId","partnerId","partnerName","status","joinedAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/audit":{"get":{"tags":["audit"],"parameters":[{"schema":{"type":"integer"},"in":"query","name":"page","required":false},{"schema":{"type":"integer"},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string"},"in":"query","name":"actorId","required":false},{"schema":{"type":"string"},"in":"query","name":"action","required":false},{"schema":{"type":"string"},"in":"query","name":"resourceType","required":false},{"schema":{"type":"string"},"in":"query","name":"from","required":false},{"schema":{"type":"string"},"in":"query","name":"to","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"seq":{"type":"integer"},"actorId":{"type":"string","nullable":true},"actorType":{"type":"string","nullable":true},"actorLabel":{"type":"string","nullable":true},"action":{"type":"string"},"method":{"type":"string","nullable":true},"path":{"type":"string","nullable":true},"resourceType":{"type":"string","nullable":true},"resourceId":{"type":"string","nullable":true},"statusCode":{"type":"integer","nullable":true},"ip":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{}},"prevHash":{"type":"string","nullable":true},"hash":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","orgId","seq","actorId","actorType","action","method","path","resourceType","resourceId","statusCode","ip","metadata","prevHash","hash","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/audit/verify":{"get":{"tags":["audit"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"checked":{"type":"integer"},"brokenAtSeq":{"type":"integer","nullable":true},"message":{"type":"string"}},"required":["ok","checked","brokenAtSeq","message"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/audit/{id}":{"get":{"tags":["audit"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"seq":{"type":"integer"},"actorId":{"type":"string","nullable":true},"actorType":{"type":"string","nullable":true},"actorLabel":{"type":"string","nullable":true},"action":{"type":"string"},"method":{"type":"string","nullable":true},"path":{"type":"string","nullable":true},"resourceType":{"type":"string","nullable":true},"resourceId":{"type":"string","nullable":true},"statusCode":{"type":"integer","nullable":true},"ip":{"type":"string","nullable":true},"metadata":{"type":"object","additionalProperties":{}},"prevHash":{"type":"string","nullable":true},"hash":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","orgId","seq","actorId","actorType","action","method","path","resourceType","resourceId","statusCode","ip","metadata","prevHash","hash","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/privacy/me/export":{"get":{"tags":["privacy"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"format":{"type":"string","enum":["partnerswatch.personal-data.v1"]},"exportedAt":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string"},"fullName":{"type":"string"},"isActive":{"type":"boolean"},"emailVerifiedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","email","fullName","isActive","emailVerifiedAt","createdAt","updatedAt"],"additionalProperties":false},"memberships":{"type":"array","items":{"type":"object","additionalProperties":{}}},"partnerRecords":{"type":"array","items":{"type":"object","additionalProperties":{}}},"consents":{"type":"object","properties":{"exchangeInquiries":{"type":"array","items":{"type":"object","additionalProperties":{}}},"communityMemberships":{"type":"array","items":{"type":"object","additionalProperties":{}}},"signingEvents":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["exchangeInquiries","communityMemberships","signingEvents"],"additionalProperties":false},"activity":{"type":"object","properties":{"activities":{"type":"array","items":{"type":"object","additionalProperties":{}}},"deals":{"type":"array","items":{"type":"object","additionalProperties":{}}},"leads":{"type":"array","items":{"type":"object","additionalProperties":{}}},"tickets":{"type":"array","items":{"type":"object","additionalProperties":{}}},"ticketMessages":{"type":"array","items":{"type":"object","additionalProperties":{}}},"copilotConversations":{"type":"array","items":{"type":"object","additionalProperties":{}}},"auditLog":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["activities","deals","leads","tickets","ticketMessages","copilotConversations","auditLog"],"additionalProperties":false}},"required":["format","exportedAt","profile","memberships","partnerRecords","consents","activity"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/privacy/me/erase":{"post":{"tags":["privacy"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"confirmEmail":{"type":"string","minLength":3,"maxLength":320}},"required":["confirmEmail"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","customer","partner_contact"]},"subjectId":{"type":"string","format":"uuid"},"erasedAt":{"type":"string"},"cleared":{"type":"array","items":{"type":"string"}},"retained":{"type":"array","items":{"type":"string"}}},"required":["subjectType","subjectId","erasedAt","cleared","retained"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/privacy/customers/{id}/erase":{"post":{"tags":["privacy"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","customer","partner_contact"]},"subjectId":{"type":"string","format":"uuid"},"erasedAt":{"type":"string"},"cleared":{"type":"array","items":{"type":"string"}},"retained":{"type":"array","items":{"type":"string"}}},"required":["subjectType","subjectId","erasedAt","cleared","retained"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/privacy/partners/{id}/erase":{"post":{"tags":["privacy"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subjectType":{"type":"string","enum":["user","customer","partner_contact"]},"subjectId":{"type":"string","format":"uuid"},"erasedAt":{"type":"string"},"cleared":{"type":"array","items":{"type":"string"}},"retained":{"type":"array","items":{"type":"string"}}},"required":["subjectType","subjectId","erasedAt","cleared","retained"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tickets":{"get":{"tags":["tickets"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","enum":["open","pending","resolved","closed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["low","normal","high","urgent"]},"in":"query","name":"priority","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"assigneeId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["requests","tickets"]},"in":"query","name":"kind","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"requestTypeId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string","enum":["pending","approved","rejected"]},"in":"query","name":"approvalStatus","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"subject":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","pending","resolved","closed"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"channel":{"type":"string","enum":["manual","email","api","request","feedback"]},"slaDueAt":{"type":"string","nullable":true},"firstRespondedAt":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"escalatedAt":{"type":"string","nullable":true},"reopenCount":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"requestTypeId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{}},"approvalStatus":{"type":"string","enum":["pending","approved","rejected"],"nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"approvedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","subject","description","status","priority","assigneeId","channel","slaDueAt","firstRespondedAt","resolvedAt","closedAt","escalatedAt","reopenCount","createdById","requestTypeId","locationId","fields","approvalStatus","approvedById","approvedAt","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}},"post":{"tags":["tickets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":300},"description":{"type":"string","maxLength":5000,"nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid"},"priority":{"type":"string","enum":["low","normal","high","urgent"],"default":"normal"},"channel":{"type":"string","enum":["manual","email","api","request","feedback"],"default":"manual"},"slaMinutes":{"type":"integer","exclusiveMinimum":true,"minimum":0},"assigneeId":{"type":"string","format":"uuid","nullable":true},"requestTypeId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{}}},"required":["subject"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"subject":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","pending","resolved","closed"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"channel":{"type":"string","enum":["manual","email","api","request","feedback"]},"slaDueAt":{"type":"string","nullable":true},"firstRespondedAt":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"escalatedAt":{"type":"string","nullable":true},"reopenCount":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"requestTypeId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{}},"approvalStatus":{"type":"string","enum":["pending","approved","rejected"],"nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"approvedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","subject","description","status","priority","assigneeId","channel","slaDueAt","firstRespondedAt","resolvedAt","closedAt","escalatedAt","reopenCount","createdById","requestTypeId","locationId","fields","approvalStatus","approvedById","approvedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tickets/{id}":{"get":{"tags":["tickets"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"subject":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","pending","resolved","closed"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"channel":{"type":"string","enum":["manual","email","api","request","feedback"]},"slaDueAt":{"type":"string","nullable":true},"firstRespondedAt":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"escalatedAt":{"type":"string","nullable":true},"reopenCount":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"requestTypeId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{}},"approvalStatus":{"type":"string","enum":["pending","approved","rejected"],"nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"approvedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","subject","description","status","priority","assigneeId","channel","slaDueAt","firstRespondedAt","resolvedAt","closedAt","escalatedAt","reopenCount","createdById","requestTypeId","locationId","fields","approvalStatus","approvedById","approvedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["tickets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":300},"description":{"type":"string","maxLength":5000,"nullable":true},"status":{"type":"string","enum":["open","pending","resolved","closed"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"subject":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","pending","resolved","closed"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"channel":{"type":"string","enum":["manual","email","api","request","feedback"]},"slaDueAt":{"type":"string","nullable":true},"firstRespondedAt":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"escalatedAt":{"type":"string","nullable":true},"reopenCount":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"requestTypeId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{}},"approvalStatus":{"type":"string","enum":["pending","approved","rejected"],"nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"approvedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","subject","description","status","priority","assigneeId","channel","slaDueAt","firstRespondedAt","resolvedAt","closedAt","escalatedAt","reopenCount","createdById","requestTypeId","locationId","fields","approvalStatus","approvedById","approvedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tickets/{id}/assign":{"post":{"tags":["tickets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"assigneeId":{"type":"string","format":"uuid","nullable":true}},"required":["assigneeId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"subject":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","pending","resolved","closed"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"channel":{"type":"string","enum":["manual","email","api","request","feedback"]},"slaDueAt":{"type":"string","nullable":true},"firstRespondedAt":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"escalatedAt":{"type":"string","nullable":true},"reopenCount":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"requestTypeId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{}},"approvalStatus":{"type":"string","enum":["pending","approved","rejected"],"nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"approvedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","subject","description","status","priority","assigneeId","channel","slaDueAt","firstRespondedAt","resolvedAt","closedAt","escalatedAt","reopenCount","createdById","requestTypeId","locationId","fields","approvalStatus","approvedById","approvedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tickets/{id}/messages":{"get":{"tags":["tickets"],"parameters":[{"schema":{"type":"string","enum":["public","internal"]},"in":"query","name":"visibility","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ticketId":{"type":"string","format":"uuid"},"authorId":{"type":"string","format":"uuid","nullable":true},"authorType":{"type":"string","enum":["agent","customer","system"]},"visibility":{"type":"string","enum":["public","internal"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","ticketId","authorId","authorType","visibility","body","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["tickets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":5000},"visibility":{"type":"string","enum":["public","internal"],"default":"public"},"authorType":{"type":"string","enum":["agent","customer","system"],"default":"agent"}},"required":["body"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"ticketId":{"type":"string","format":"uuid"},"authorId":{"type":"string","format":"uuid","nullable":true},"authorType":{"type":"string","enum":["agent","customer","system"]},"visibility":{"type":"string","enum":["public","internal"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","ticketId","authorId","authorType","visibility","body","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/health":{"get":{"tags":["health"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","enum":["healthy","at_risk","critical","unknown"]},"in":"query","name":"tier","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"customerName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"score":{"type":"integer"},"tier":{"type":"string","enum":["healthy","at_risk","critical","unknown"]},"openTickets":{"type":"integer"},"updatedAt":{"type":"string"}},"required":["customerId","customerName","partnerId","partnerName","score","tier","openTickets","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers/{id}/health":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"score":{"type":"integer"},"tier":{"type":"string","enum":["healthy","at_risk","critical","unknown"]},"factors":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"impact":{"type":"integer"}},"required":["key","label","impact"],"additionalProperties":false}},"openTickets":{"type":"integer"},"lastCsat":{"type":"integer","nullable":true},"computedAt":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["customerId","partnerId","score","tier","factors","openTickets","lastCsat","computedAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers/{id}/health/history":{"get":{"tags":["customers"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":730},"in":"query","name":"days","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"score":{"type":"integer"},"tier":{"type":"string","enum":["healthy","at_risk","critical","unknown"]},"computedAt":{"type":"string"}},"required":["score","tier","computedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers/{id}/health/recompute":{"post":{"tags":["customers"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"score":{"type":"integer"},"tier":{"type":"string","enum":["healthy","at_risk","critical","unknown"]},"factors":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"impact":{"type":"integer"}},"required":["key","label","impact"],"additionalProperties":false}},"openTickets":{"type":"integer"},"lastCsat":{"type":"integer","nullable":true},"computedAt":{"type":"string","nullable":true},"updatedAt":{"type":"string"}},"required":["customerId","partnerId","score","tier","factors","openTickets","lastCsat","computedAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/surveys":{"get":{"tags":["surveys"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["csat","nps"]},"name":{"type":"string"},"question":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","type","name","question","status","responseCount","avgScore","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["surveys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["csat","nps"],"default":"csat"},"name":{"type":"string","minLength":1,"maxLength":120},"question":{"type":"string","minLength":1,"maxLength":300}},"required":["name","question"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["csat","nps"]},"name":{"type":"string"},"question":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","type","name","question","status","responseCount","avgScore","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/surveys/{id}":{"get":{"tags":["surveys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["csat","nps"]},"name":{"type":"string"},"question":{"type":"string"},"status":{"type":"string","enum":["active","archived"]},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","type","name","question","status","responseCount","avgScore","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["surveys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/surveys/{id}/send":{"post":{"tags":["surveys"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"}},"required":["customerId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"responseId":{"type":"string","format":"uuid"},"token":{"type":"string"},"url":{"type":"string"},"emailedTo":{"type":"string","nullable":true}},"required":["responseId","token","url"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/surveys/{id}/results":{"get":{"tags":["surveys"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"surveyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["csat","nps"]},"total":{"type":"integer"},"responded":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"npsScore":{"type":"number","nullable":true},"promoters":{"type":"integer"},"passives":{"type":"integer"},"detractors":{"type":"integer"},"responses":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"surveyId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["sent","responded","expired"]},"score":{"type":"integer","nullable":true},"comment":{"type":"string","nullable":true},"sentAt":{"type":"string","nullable":true},"respondedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","surveyId","partnerId","customerId","status","score","comment","sentAt","respondedAt","createdAt"],"additionalProperties":false}}},"required":["surveyId","type","total","responded","avgScore","npsScore","promoters","passives","detractors","responses"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/survey/{token}":{"get":{"tags":["survey"],"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"surveyId":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["csat","nps"]},"name":{"type":"string"},"question":{"type":"string"},"status":{"type":"string","enum":["sent","responded","expired"]},"brandName":{"type":"string","nullable":true},"brandColor":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true}},"required":["surveyId","type","name","question","status"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["survey"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"score":{"type":"integer"},"comment":{"type":"string","maxLength":2000}},"required":["score"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":1},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/feedback/surveys":{"get":{"tags":["feedback"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["csat","nps"]},"question":{"type":"string"}},"required":["id","name","type","question"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/feedback/summary":{"get":{"tags":["feedback"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"pointId","required":false},{"schema":{"type":"integer","minimum":1,"maximum":730,"default":90},"in":"query","name":"days","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"locationId":{"type":"string","format":"uuid","nullable":true},"days":{"type":"integer"},"responses":{"type":"integer"},"scans":{"type":"integer"},"lowScores":{"type":"integer"},"npsScore":{"type":"number","nullable":true},"npsResponses":{"type":"integer"},"promoters":{"type":"integer"},"passives":{"type":"integer"},"detractors":{"type":"integer"},"csatAvg":{"type":"number","nullable":true},"csatResponses":{"type":"integer"},"csatPositivePct":{"type":"number","nullable":true},"trend":{"type":"array","items":{"type":"object","properties":{"weekStart":{"type":"string"},"responses":{"type":"integer"},"npsScore":{"type":"number","nullable":true},"csatAvg":{"type":"number","nullable":true}},"required":["weekStart","responses","npsScore","csatAvg"],"additionalProperties":false}},"recent":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"feedbackPointId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"type":{"type":"string","enum":["csat","nps"]},"score":{"type":"integer","nullable":true},"comment":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"low":{"type":"boolean"},"respondedAt":{"type":"string","nullable":true}},"required":["id","feedbackPointId","locationId","locationName","type","score","comment","contactEmail","low","respondedAt"],"additionalProperties":false}}},"required":["locationId","days","responses","scans","lowScores","npsScore","npsResponses","promoters","passives","detractors","csatAvg","csatResponses","csatPositivePct","trend","recent"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/feedback-points":{"get":{"tags":["feedback-points"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"surveyId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"label":{"type":"string"},"active":{"type":"boolean"},"scanCount":{"type":"integer"},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"url":{"type":"string"},"createdAt":{"type":"string"},"type":{"type":"string","enum":["csat","nps"]}},"required":["id","orgId","surveyId","locationId","locationName","partnerId","slug","label","active","scanCount","responseCount","avgScore","url","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["feedback-points"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"surveyId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","minLength":1,"maxLength":120}},"required":["surveyId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"surveyId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"label":{"type":"string"},"active":{"type":"boolean"},"scanCount":{"type":"integer"},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"url":{"type":"string"},"createdAt":{"type":"string"},"type":{"type":"string","enum":["csat","nps"]}},"required":["id","orgId","surveyId","locationId","locationName","partnerId","slug","label","active","scanCount","responseCount","avgScore","url","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/feedback-points/bulk":{"post":{"tags":["feedback-points"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"surveyId":{"type":"string","format":"uuid"},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000}},"required":["surveyId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"skipped":{"type":"integer"},"points":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"surveyId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"label":{"type":"string"},"active":{"type":"boolean"},"scanCount":{"type":"integer"},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"url":{"type":"string"},"createdAt":{"type":"string"},"type":{"type":"string","enum":["csat","nps"]}},"required":["id","orgId","surveyId","locationId","locationName","partnerId","slug","label","active","scanCount","responseCount","avgScore","url","createdAt"],"additionalProperties":false}}},"required":["created","skipped","points"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/feedback-points/{id}":{"get":{"tags":["feedback-points"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"surveyId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"label":{"type":"string"},"active":{"type":"boolean"},"scanCount":{"type":"integer"},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"url":{"type":"string"},"createdAt":{"type":"string"},"type":{"type":"string","enum":["csat","nps"]}},"required":["id","orgId","surveyId","locationId","locationName","partnerId","slug","label","active","scanCount","responseCount","avgScore","url","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["feedback-points"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"active":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"surveyId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"label":{"type":"string"},"active":{"type":"boolean"},"scanCount":{"type":"integer"},"responseCount":{"type":"integer"},"avgScore":{"type":"number","nullable":true},"url":{"type":"string"},"createdAt":{"type":"string"},"type":{"type":"string","enum":["csat","nps"]}},"required":["id","orgId","surveyId","locationId","locationName","partnerId","slug","label","active","scanCount","responseCount","avgScore","url","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["feedback-points"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/feedback-points/{id}/qr.svg":{"get":{"tags":["feedback-points"],"parameters":[{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}]},"in":"query","name":"download","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/feedback-points/{id}/qr.png":{"get":{"tags":["feedback-points"],"parameters":[{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}]},"in":"query","name":"download","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/feedback-points/{id}/poster.html":{"get":{"tags":["feedback-points"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/public/feedback/{slug}":{"get":{"tags":["public"],"parameters":[{"schema":{"type":"string","minLength":4,"maxLength":64},"in":"path","name":"slug","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"slug":{"type":"string"},"brandName":{"type":"string"},"brandLogoUrl":{"type":"string","nullable":true},"brandColor":{"type":"string","nullable":true},"locationName":{"type":"string","nullable":true},"type":{"type":"string","enum":["csat","nps"]},"question":{"type":"string"},"scaleMin":{"type":"integer"},"scaleMax":{"type":"integer"}},"required":["slug","brandName","brandLogoUrl","brandColor","locationName","type","question","scaleMin","scaleMax"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":10},"comment":{"type":"string","maxLength":2000},"contactEmail":{"type":"string","format":"email","maxLength":200}},"required":["score"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":4,"maxLength":64},"in":"path","name":"slug","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"ticketOpened":{"type":"boolean"}},"required":["ok","ticketOpened"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/locations/{id}/statement":{"get":{"tags":["locations"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"from","required":false},{"schema":{"type":"string"},"in":"query","name":"to","required":false},{"schema":{"type":"string","enum":["json","csv"],"default":"json"},"in":"query","name":"format","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"from":{"type":"string"},"to":{"type":"string"},"currency":{"type":"string"},"lines":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"kind":{"type":"string","enum":["royalty","marketing_fund","fixed_fee","invoice","payment","adjustment"]},"label":{"type":"string"},"reference":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"status":{"type":"string"},"sourceId":{"type":"string","format":"uuid","nullable":true},"balanceCents":{"type":"integer"}},"required":["date","kind","label","reference","amountCents","currency","status","sourceId"],"additionalProperties":false}},"totals":{"type":"object","properties":{"chargedCents":{"type":"integer"},"paidCents":{"type":"integer"},"outstandingCents":{"type":"integer"}},"required":["chargedCents","paidCents","outstandingCents"],"additionalProperties":false}},"required":["locationId","locationName","partnerId","partnerName","from","to","currency","lines","totals"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/customers/{id}/events":{"post":{"tags":["customers"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","minLength":1,"maxLength":120},"source":{"type":"string","enum":["api","connector","manual","system"],"default":"manual"},"occurredAt":{"type":"string","format":"date-time"},"payload":{"type":"object","additionalProperties":{},"default":{}}},"required":["type"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"type":{"type":"string"},"source":{"type":"string","enum":["api","connector","manual","system"]},"payload":{"type":"object","additionalProperties":{}},"environment":{"type":"string","enum":["live","test"]},"occurredAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","partnerId","customerId","type","source","payload","environment","occurredAt","createdAt"],"additionalProperties":false}}}}}},"get":{"tags":["customers"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","enum":["live","test"],"default":"live"},"in":"query","name":"environment","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"type":{"type":"string"},"source":{"type":"string","enum":["api","connector","manual","system"]},"payload":{"type":"object","additionalProperties":{}},"environment":{"type":"string","enum":["live","test"]},"occurredAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","partnerId","customerId","type","source","payload","environment","occurredAt","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/events":{"get":{"tags":["events"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string"},"in":"query","name":"type","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","enum":["live","test"],"default":"live"},"in":"query","name":"environment","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"type":{"type":"string"},"source":{"type":"string","enum":["api","connector","manual","system"]},"payload":{"type":"object","additionalProperties":{}},"environment":{"type":"string","enum":["live","test"]},"occurredAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","partnerId","customerId","type","source","payload","environment","occurredAt","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/events/ingest":{"post":{"tags":["events"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","format":"uuid"},"externalCustomerId":{"type":"string","maxLength":200},"customerEmail":{"type":"string","format":"email"},"type":{"type":"string","minLength":1,"maxLength":120},"source":{"type":"string","enum":["api","connector","manual","system"],"default":"connector"},"occurredAt":{"type":"string","format":"date-time"},"payload":{"type":"object","additionalProperties":{},"default":{}}},"required":["type"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"type":{"type":"string"},"source":{"type":"string","enum":["api","connector","manual","system"]},"payload":{"type":"object","additionalProperties":{}},"environment":{"type":"string","enum":["live","test"]},"occurredAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","partnerId","customerId","type","source","payload","environment","occurredAt","createdAt"],"additionalProperties":false}}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/metrics":{"get":{"tags":["metrics"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["count","sum","unique"]},"eventType":{"type":"string","nullable":true},"valueField":{"type":"string","nullable":true},"window":{"type":"string","enum":["day","week","month","quarter","all"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","kind","eventType","valueField","window","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["metrics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"nullable":true},"kind":{"type":"string","enum":["count","sum","unique"]},"eventType":{"type":"string","maxLength":120,"nullable":true},"valueField":{"type":"string","maxLength":120,"nullable":true},"window":{"type":"string","enum":["day","week","month","quarter","all"],"default":"all"}},"required":["name","kind"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["count","sum","unique"]},"eventType":{"type":"string","nullable":true},"valueField":{"type":"string","nullable":true},"window":{"type":"string","enum":["day","week","month","quarter","all"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","kind","eventType","valueField","window","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/metrics/{id}":{"get":{"tags":["metrics"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["count","sum","unique"]},"eventType":{"type":"string","nullable":true},"valueField":{"type":"string","nullable":true},"window":{"type":"string","enum":["day","week","month","quarter","all"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","kind","eventType","valueField","window","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["metrics"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"nullable":true},"kind":{"type":"string","enum":["count","sum","unique"]},"eventType":{"type":"string","nullable":true},"valueField":{"type":"string","nullable":true},"window":{"type":"string","enum":["day","week","month","quarter","all"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["count","sum","unique"]},"eventType":{"type":"string","nullable":true},"valueField":{"type":"string","nullable":true},"window":{"type":"string","enum":["day","week","month","quarter","all"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","kind","eventType","valueField","window","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["metrics"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/metrics/{id}/compute":{"get":{"tags":["metrics"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","enum":["day","week","month","quarter","all"]},"in":"query","name":"window","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"metricId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["count","sum","unique"]},"value":{"type":"number"},"window":{"type":"string","enum":["day","week","month","quarter","all"]},"from":{"type":"string","nullable":true},"to":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true}},"required":["metricId","kind","value","window","from","to","partnerId","customerId"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/metrics/{id}/series":{"get":{"tags":["metrics"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","enum":["day","week","month","quarter","all"]},"in":"query","name":"window","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"metricId":{"type":"string","format":"uuid"},"window":{"type":"string","enum":["day","week","month","quarter","all"]},"points":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"],"additionalProperties":false}}},"required":["metricId","window","points"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/dashboards":{"get":{"tags":["dashboards"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","partnerId","isDefault","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["dashboards"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"isDefault":{"type":"boolean","default":false}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","partnerId","isDefault","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/dashboards/{id}":{"get":{"tags":["dashboards"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","partnerId","isDefault","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["dashboards"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500,"nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"isDefault":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","partnerId","isDefault","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["dashboards"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/dashboards/{id}/render":{"get":{"tags":["dashboards"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","enum":["day","week","month","quarter","all"]},"in":"query","name":"window","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"dashboard":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","partnerId","isDefault","createdAt","updatedAt"],"additionalProperties":false},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"widgets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string","enum":["metric","stat","timeseries","event_list","goal"]},"metricId":{"type":"string","format":"uuid","nullable":true},"config":{"type":"object","additionalProperties":{}},"position":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"result":{"type":"object","properties":{"widgetId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["metric","stat","timeseries","event_list","goal"]},"value":{"type":"number","nullable":true},"points":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"value":{"type":"number"}},"required":["bucket","value"],"additionalProperties":false},"nullable":true},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid"},"type":{"type":"string"},"source":{"type":"string","enum":["api","connector","manual","system"]},"payload":{"type":"object","additionalProperties":{}},"environment":{"type":"string","enum":["live","test"]},"occurredAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","partnerId","customerId","type","source","payload","environment","occurredAt","createdAt"],"additionalProperties":false},"nullable":true},"error":{"type":"string","nullable":true}},"required":["widgetId","kind","value","points","events","error"],"additionalProperties":false}},"required":["id","dashboardId","title","kind","metricId","config","position","createdAt","updatedAt","result"],"additionalProperties":false}}},"required":["dashboard","partnerId","customerId","widgets"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/dashboards/{id}/widgets":{"post":{"tags":["dashboards"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":120},"kind":{"type":"string","enum":["metric","stat","timeseries","event_list","goal"]},"metricId":{"type":"string","format":"uuid","nullable":true},"config":{"type":"object","additionalProperties":{},"default":{}},"position":{"type":"integer","default":0}},"required":["title","kind"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string","enum":["metric","stat","timeseries","event_list","goal"]},"metricId":{"type":"string","format":"uuid","nullable":true},"config":{"type":"object","additionalProperties":{}},"position":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","dashboardId","title","kind","metricId","config","position","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/dashboards/{id}/widgets/{widgetId}":{"patch":{"tags":["dashboards"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":120},"kind":{"type":"string","enum":["metric","stat","timeseries","event_list","goal"]},"metricId":{"type":"string","format":"uuid","nullable":true},"config":{"type":"object","additionalProperties":{}},"position":{"type":"integer"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"widgetId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dashboardId":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string","enum":["metric","stat","timeseries","event_list","goal"]},"metricId":{"type":"string","format":"uuid","nullable":true},"config":{"type":"object","additionalProperties":{}},"position":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","dashboardId","title","kind","metricId","config","position","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["dashboards"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"widgetId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/engagement/paths":{"get":{"tags":["engagement"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"active":{"type":"boolean"},"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"pathId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"points":{"type":"integer","minimum":0},"eventType":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"order":{"type":"integer"}},"required":["id","pathId","title","description","points","eventType","url","order"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","orgId","productId","name","description","active","missions","createdAt"],"additionalProperties":false}}}}}}},"post":{"tags":["engagement"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean","default":true},"missions":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"points":{"type":"integer","minimum":0,"maximum":100000,"default":0},"eventType":{"type":"string","maxLength":100,"nullable":true},"url":{"type":"string","maxLength":500,"nullable":true},"order":{"type":"integer","minimum":0,"default":0}},"required":["title"],"additionalProperties":false},"maxItems":50,"default":[]}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"active":{"type":"boolean"},"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"pathId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"points":{"type":"integer","minimum":0},"eventType":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"order":{"type":"integer"}},"required":["id","pathId","title","description","points","eventType","url","order"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","orgId","productId","name","description","active","missions","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/engagement/paths/{id}":{"patch":{"tags":["engagement"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"productId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean","default":true},"missions":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"points":{"type":"integer","minimum":0,"maximum":100000,"default":0},"eventType":{"type":"string","maxLength":100,"nullable":true},"url":{"type":"string","maxLength":500,"nullable":true},"order":{"type":"integer","minimum":0,"default":0}},"required":["title"],"additionalProperties":false},"maxItems":50,"default":[]}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"description":{"type":"string","nullable":true},"active":{"type":"boolean"},"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"pathId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"points":{"type":"integer","minimum":0},"eventType":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"order":{"type":"integer"}},"required":["id","pathId","title","description","points","eventType","url","order"],"additionalProperties":false}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","orgId","productId","name","description","active","missions","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["engagement"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/engagement/activation":{"get":{"tags":["engagement"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"tier":{"type":"string","nullable":true},"points":{"type":"integer"},"missionsCompleted":{"type":"integer"},"missionsTotal":{"type":"integer"},"lastActivityAt":{"type":"string","format":"date-time","nullable":true}},"required":["orgId","orgName","tier","points","missionsCompleted","missionsTotal","lastActivityAt"],"additionalProperties":false}}}}}}}},"/api/engagement/me":{"get":{"tags":["engagement"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalPoints":{"type":"integer"},"paths":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"pathId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"points":{"type":"integer","minimum":0},"eventType":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"order":{"type":"integer"},"completedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","pathId","title","description","points","eventType","url","order","completedAt"],"additionalProperties":false}},"completed":{"type":"integer"},"total":{"type":"integer"}},"required":["id","name","description","missions","completed","total"],"additionalProperties":false}}},"required":["totalPoints","paths"],"additionalProperties":false}}}}}}},"/api/engagement/missions/{id}/complete":{"post":{"tags":["engagement"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"totalPoints":{"type":"integer"},"paths":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"missions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"pathId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"points":{"type":"integer","minimum":0},"eventType":{"type":"string","nullable":true},"url":{"type":"string","nullable":true},"order":{"type":"integer"},"completedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","pathId","title","description","points","eventType","url","order","completedAt"],"additionalProperties":false}},"completed":{"type":"integer"},"total":{"type":"integer"}},"required":["id","name","description","missions","completed","total"],"additionalProperties":false}}},"required":["totalPoints","paths"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/engagement/tier-rules":{"get":{"tags":["engagement"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"label":{"type":"string","nullable":true},"rank":{"type":"integer"},"minPoints":{"type":"integer","minimum":0},"minCustomers":{"type":"integer","minimum":0},"minWonDeals":{"type":"integer","minimum":0},"benefits":{"type":"string","nullable":true}},"required":["id","orgId","tier","label","rank","minPoints","minCustomers","minWonDeals","benefits"],"additionalProperties":false}}}}}}},"put":{"tags":["engagement"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"label":{"type":"string","maxLength":100,"nullable":true},"rank":{"type":"integer","minimum":0},"minPoints":{"type":"integer","minimum":0,"default":0},"minCustomers":{"type":"integer","minimum":0,"default":0},"minWonDeals":{"type":"integer","minimum":0,"default":0},"benefits":{"type":"string","maxLength":2000,"nullable":true}},"required":["tier","rank"],"additionalProperties":false},"maxItems":20}},"required":["rules"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"label":{"type":"string","nullable":true},"rank":{"type":"integer"},"minPoints":{"type":"integer","minimum":0},"minCustomers":{"type":"integer","minimum":0},"minWonDeals":{"type":"integer","minimum":0},"benefits":{"type":"string","nullable":true}},"required":["id","orgId","tier","label","rank","minPoints","minCustomers","minWonDeals","benefits"],"additionalProperties":false}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/engagement/tier-status":{"get":{"tags":["engagement"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"currentTier":{"type":"string","nullable":true},"currentLabel":{"type":"string","nullable":true},"points":{"type":"integer"},"customers":{"type":"integer"},"wonDeals":{"type":"integer"},"nextTier":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"tier":{"type":"string","enum":["registered","bronze","silver","gold","platinum"]},"label":{"type":"string","nullable":true},"rank":{"type":"integer"},"minPoints":{"type":"integer","minimum":0},"minCustomers":{"type":"integer","minimum":0},"minWonDeals":{"type":"integer","minimum":0},"benefits":{"type":"string","nullable":true}},"required":["id","orgId","tier","label","rank","minPoints","minCustomers","minWonDeals","benefits"],"additionalProperties":false,"nullable":true}},"required":["currentTier","currentLabel","points","customers","wonDeals","nextTier"],"additionalProperties":false}}}}}}},"/api/mentorships":{"get":{"tags":["mentorships"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"mentorOrgId":{"type":"string","format":"uuid"},"menteeOrgId":{"type":"string","format":"uuid"},"mentorName":{"type":"string"},"menteeName":{"type":"string"},"mentorEmail":{"type":"string","nullable":true},"menteeEmail":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","ended"]},"notes":{"type":"string","nullable":true},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","orgId","mentorOrgId","menteeOrgId","mentorName","menteeName","mentorEmail","menteeEmail","status","notes","startedAt","endedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["mentorships"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mentorOrgId":{"type":"string","format":"uuid"},"menteeOrgId":{"type":"string","format":"uuid"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["mentorOrgId","menteeOrgId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"mentorOrgId":{"type":"string","format":"uuid"},"menteeOrgId":{"type":"string","format":"uuid"},"mentorName":{"type":"string"},"menteeName":{"type":"string"},"mentorEmail":{"type":"string","nullable":true},"menteeEmail":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","ended"]},"notes":{"type":"string","nullable":true},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","orgId","mentorOrgId","menteeOrgId","mentorName","menteeName","mentorEmail","menteeEmail","status","notes","startedAt","endedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mentorships/{id}":{"patch":{"tags":["mentorships"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["active","ended"]},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"mentorOrgId":{"type":"string","format":"uuid"},"menteeOrgId":{"type":"string","format":"uuid"},"mentorName":{"type":"string"},"menteeName":{"type":"string"},"mentorEmail":{"type":"string","nullable":true},"menteeEmail":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","ended"]},"notes":{"type":"string","nullable":true},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"type":"string","format":"date-time","nullable":true}},"required":["id","orgId","mentorOrgId","menteeOrgId","mentorName","menteeName","mentorEmail","menteeEmail","status","notes","startedAt","endedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/offerings":{"get":{"tags":["offerings"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"hours":{"type":"integer","nullable":true},"priceCredits":{"type":"integer","nullable":true},"amount":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","orgId","name","description","kind","hours","priceCredits","amount","currency","active","createdAt"],"additionalProperties":false}}}}}}},"post":{"tags":["offerings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"kind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"hours":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"priceCredits":{"type":"integer","minimum":0,"nullable":true},"amount":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"active":{"type":"boolean","default":true}},"required":["name","kind"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"hours":{"type":"integer","nullable":true},"priceCredits":{"type":"integer","nullable":true},"amount":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","orgId","name","description","kind","hours","priceCredits","amount","currency","active","createdAt"],"additionalProperties":false}}}}}}},"/api/offerings/{id}":{"patch":{"tags":["offerings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":2000,"nullable":true},"kind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"hours":{"type":"integer","minimum":0,"maximum":10000,"nullable":true},"priceCredits":{"type":"integer","minimum":0,"nullable":true},"amount":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"active":{"type":"boolean","default":true}},"required":["name","kind"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"hours":{"type":"integer","nullable":true},"priceCredits":{"type":"integer","nullable":true},"amount":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","orgId","name","description","kind","hours","priceCredits","amount","currency","active","createdAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["offerings"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/bookings":{"get":{"tags":["bookings"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"offeringId":{"type":"string","format":"uuid"},"offeringName":{"type":"string"},"offeringKind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"status":{"type":"string","enum":["requested","confirmed","delivered","cancelled"]},"notes":{"type":"string","nullable":true},"scheduledAt":{"type":"string","format":"date-time","nullable":true},"creditCost":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","offeringId","offeringName","offeringKind","orgId","orgName","status","notes","scheduledAt","creditCost","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["bookings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"offeringId":{"type":"string","format":"uuid"},"notes":{"type":"string","maxLength":2000,"nullable":true},"scheduledAt":{"type":"string","format":"date-time","nullable":true}},"required":["offeringId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"offeringId":{"type":"string","format":"uuid"},"offeringName":{"type":"string"},"offeringKind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"status":{"type":"string","enum":["requested","confirmed","delivered","cancelled"]},"notes":{"type":"string","nullable":true},"scheduledAt":{"type":"string","format":"date-time","nullable":true},"creditCost":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","offeringId","offeringName","offeringKind","orgId","orgName","status","notes","scheduledAt","creditCost","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/bookings/{id}":{"patch":{"tags":["bookings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["requested","confirmed","delivered","cancelled"]},"notes":{"type":"string","maxLength":2000,"nullable":true},"scheduledAt":{"type":"string","format":"date-time","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"offeringId":{"type":"string","format":"uuid"},"offeringName":{"type":"string"},"offeringKind":{"type":"string","enum":["managed_sales","managed_service","training","mentoring","other"]},"orgId":{"type":"string","format":"uuid"},"orgName":{"type":"string"},"status":{"type":"string","enum":["requested","confirmed","delivered","cancelled"]},"notes":{"type":"string","nullable":true},"scheduledAt":{"type":"string","format":"date-time","nullable":true},"creditCost":{"type":"integer","nullable":true},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","offeringId","offeringName","offeringKind","orgId","orgName","status","notes","scheduledAt","creditCost","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/usage/ingest":{"post":{"tags":["usage"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"metric":{"type":"string","minLength":1,"maxLength":100},"quantity":{"type":"integer"},"unit":{"type":"string","maxLength":50,"nullable":true},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"externalRef":{"type":"string","maxLength":200,"nullable":true},"externalCustomerId":{"type":"string","maxLength":200,"nullable":true}},"required":["metric","quantity","periodStart","periodEnd"],"additionalProperties":false},"minItems":1,"maxItems":500}},"required":["records"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"inserted":{"type":"integer"},"duplicates":{"type":"integer"},"linked":{"type":"integer"},"rejected":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"status":{"type":"string","enum":["inserted","duplicate","rejected"]},"orgId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"reason":{"type":"string","nullable":true}},"required":["index","status","orgId","customerId","reason"],"additionalProperties":false}}},"required":["inserted","duplicates","linked","rejected","results"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/usage/ingest\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"records\": [\n    {\n      \"orgId\": \"00000000-0000-4000-8000-000000000010\",\n      \"metric\": \"api_calls\",\n      \"quantity\": 18250,\n      \"unit\": \"calls\",\n      \"periodStart\": \"2026-10-01T00:00:00Z\",\n      \"periodEnd\": \"2026-10-02T00:00:00Z\",\n      \"externalRef\": \"example:usage:acct_123:api_calls:2026-10-01\",\n      \"externalCustomerId\": \"acct_123\"\n    }\n  ]\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/usage/ingest\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"records\": [\n      {\n        \"orgId\": \"00000000-0000-4000-8000-000000000010\",\n        \"metric\": \"api_calls\",\n        \"quantity\": 18250,\n        \"unit\": \"calls\",\n        \"periodStart\": \"2026-10-01T00:00:00Z\",\n        \"periodEnd\": \"2026-10-02T00:00:00Z\",\n        \"externalRef\": \"example:usage:acct_123:api_calls:2026-10-01\",\n        \"externalCustomerId\": \"acct_123\"\n      }\n    ]\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/usage/ingest\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    json={\n      \"records\": [\n        {\n          \"orgId\": \"00000000-0000-4000-8000-000000000010\",\n          \"metric\": \"api_calls\",\n          \"quantity\": 18250,\n          \"unit\": \"calls\",\n          \"periodStart\": \"2026-10-01T00:00:00Z\",\n          \"periodEnd\": \"2026-10-02T00:00:00Z\",\n          \"externalRef\": \"example:usage:acct_123:api_calls:2026-10-01\",\n          \"externalCustomerId\": \"acct_123\"\n        }\n      ]\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/usage":{"get":{"tags":["usage"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"orgId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string"},"in":"query","name":"metric","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","enum":["live","test"],"default":"live"},"in":"query","name":"environment","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"metric":{"type":"string"},"quantity":{"type":"integer"},"unit":{"type":"string","nullable":true},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time"},"source":{"type":"string"},"externalRef":{"type":"string","nullable":true},"externalCustomerId":{"type":"string","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"environment":{"type":"string","enum":["live","test"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","orgId","productId","metric","quantity","unit","periodStart","periodEnd","source","externalRef","externalCustomerId","customerId","environment","createdAt"],"additionalProperties":false}}}}}}}},"/api/usage/summary":{"get":{"tags":["usage"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"orgId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string"},"in":"query","name":"metric","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"from","required":false},{"schema":{"type":"string","format":"date-time"},"in":"query","name":"to","required":false},{"schema":{"type":"string","enum":["live","test"],"default":"live"},"in":"query","name":"environment","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"metric":{"type":"string"},"unit":{"type":"string","nullable":true},"total":{"type":"integer"},"records":{"type":"integer"}},"required":["metric","unit","total","records"],"additionalProperties":false}}}}}}}},"/api/domains":{"get":{"tags":["domains"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"orgId","required":false},{"schema":{"type":"string","maxLength":253},"in":"query","name":"domain","required":false},{"schema":{"type":"string","enum":["pending","verified","failed"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"method":{"type":"string","enum":["dns_txt","well_known"]},"token":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"]},"verifiedAt":{"type":"string","nullable":true},"lastCheckedAt":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"instruction":{"type":"string"}},"required":["id","orgId","domain","method","token","status","verifiedAt","lastCheckedAt","lastError","createdAt","updatedAt","instruction"],"additionalProperties":false}}}}}}},"post":{"tags":["domains"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string","minLength":3,"maxLength":253,"pattern":"^(?!-)[a-z0-9-]+(\\.[a-z0-9-]+)+$"},"method":{"type":"string","enum":["dns_txt","well_known"],"default":"dns_txt"},"orgId":{"type":"string","format":"uuid"}},"required":["domain"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"method":{"type":"string","enum":["dns_txt","well_known"]},"token":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"]},"verifiedAt":{"type":"string","nullable":true},"lastCheckedAt":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"instruction":{"type":"string"}},"required":["id","orgId","domain","method","token","status","verifiedAt","lastCheckedAt","lastError","createdAt","updatedAt","instruction"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/domains/{id}/verify":{"post":{"tags":["domains"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"domain":{"type":"string"},"method":{"type":"string","enum":["dns_txt","well_known"]},"token":{"type":"string"},"status":{"type":"string","enum":["pending","verified","failed"]},"verifiedAt":{"type":"string","nullable":true},"lastCheckedAt":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"instruction":{"type":"string"}},"required":["id","orgId","domain","method","token","status","verifiedAt","lastCheckedAt","lastError","createdAt","updatedAt","instruction"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/subscriptions/ingest":{"post":{"tags":["subscriptions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"type":"object","properties":{"externalAccountId":{"type":"string","minLength":1,"maxLength":200},"state":{"type":"string","enum":["active","trialing","past_due","paused","cancelled","churned"]},"productId":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"planCode":{"type":"string","maxLength":120},"quantity":{"type":"integer","minimum":0,"maximum":10000000},"mrr":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"reason":{"type":"string","maxLength":500},"effectiveAt":{"type":"string","format":"date-time"},"externalRef":{"type":"string","minLength":1,"maxLength":200},"raw":{"type":"object","additionalProperties":{}}},"required":["externalAccountId","state"],"additionalProperties":false},"minItems":1,"maxItems":500}},"required":["records"],"additionalProperties":false}}}},"security":[{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"integer"},"duplicates":{"type":"integer"},"unresolved":{"type":"integer"},"notes":{"type":"array","items":{"type":"string"}},"commission":{"type":"array","items":{"type":"object","properties":{"externalAccountId":{"type":"string"},"externalRef":{"type":"string","nullable":true},"action":{"type":"string"},"dealId":{"type":"string","nullable":true},"amount":{"type":"integer"}},"required":["externalAccountId","externalRef","action","dealId","amount"],"additionalProperties":false}}},"required":["accepted","duplicates","unresolved","notes"],"additionalProperties":false}}}}},"x-codeSamples":[{"lang":"shell","label":"curl","source":"curl -X POST \"https://partners.naridon.com/api/subscriptions/ingest\" \\\n  -H \"Authorization: Bearer $PW_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n  \"records\": [\n    {\n      \"externalAccountId\": \"acct_123\",\n      \"state\": \"active\",\n      \"planCode\": \"growth\",\n      \"mrr\": 24900,\n      \"currency\": \"USD\",\n      \"effectiveAt\": \"2026-10-02T09:30:00Z\",\n      \"externalRef\": \"example:sub:acct_123:evt_9f8e7d\"\n    }\n  ]\n}'"},{"lang":"node","label":"Node (fetch)","source":"const res = await fetch(\"https://partners.naridon.com/api/subscriptions/ingest\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.PW_KEY}`, \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"records\": [\n      {\n        \"externalAccountId\": \"acct_123\",\n        \"state\": \"active\",\n        \"planCode\": \"growth\",\n        \"mrr\": 24900,\n        \"currency\": \"USD\",\n        \"effectiveAt\": \"2026-10-02T09:30:00Z\",\n        \"externalRef\": \"example:sub:acct_123:evt_9f8e7d\"\n      }\n    ]\n  }),\n});\nif (!res.ok) throw new Error(`${res.status} ${await res.text()}`);\nconsole.log(await res.json());"},{"lang":"python","label":"Python (requests)","source":"import os, requests\n\nres = requests.post(\n    \"https://partners.naridon.com/api/subscriptions/ingest\",\n    headers={\"Authorization\": f\"Bearer {os.environ['PW_KEY']}\"},\n    json={\n      \"records\": [\n        {\n          \"externalAccountId\": \"acct_123\",\n          \"state\": \"active\",\n          \"planCode\": \"growth\",\n          \"mrr\": 24900,\n          \"currency\": \"USD\",\n          \"effectiveAt\": \"2026-10-02T09:30:00Z\",\n          \"externalRef\": \"example:sub:acct_123:evt_9f8e7d\"\n        }\n      ]\n    },\n    timeout=30,\n)\nres.raise_for_status()\nprint(res.json())"}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Optional, 1–255 characters. A repeat with the same key and body replays the first 2xx/4xx response (header `Idempotent-Replayed: true`) for 24 hours; a different body is `422 idempotency_key_mismatch`, a repeat while the first runs is `409 idempotency_in_progress`. See *Errors, pagination, idempotency & rate limits*.","schema":{"type":"string","maxLength":255}}]}},"/api/subscriptions":{"get":{"tags":["subscriptions"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"orgId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"productId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"customerId","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"externalAccountId","required":false},{"schema":{"type":"string","enum":["active","trialing","past_due","paused","cancelled","churned"]},"in":"query","name":"state","required":false},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}],"default":false},"in":"query","name":"latestOnly","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false},{"schema":{"type":"string","minLength":1,"maxLength":512},"in":"query","name":"cursor","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"productId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"externalAccountId":{"type":"string"},"state":{"type":"string","enum":["active","trialing","past_due","paused","cancelled","churned"]},"planCode":{"type":"string","nullable":true},"quantity":{"type":"integer","nullable":true},"mrr":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","nullable":true},"reason":{"type":"string","nullable":true},"effectiveAt":{"type":"string"},"externalRef":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"]},"createdAt":{"type":"string"},"customerName":{"type":"string","nullable":true},"productName":{"type":"string","nullable":true}},"required":["id","orgId","productId","customerId","externalAccountId","state","planCode","quantity","mrr","currency","reason","effectiveAt","externalRef","environment","createdAt","customerName","productName"],"additionalProperties":false}}}}}}}},"/api/products/{id}/manifest":{"get":{"tags":["products"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"manifest":{"type":"object","properties":{"version":{"type":"string","enum":["1"],"default":"1"},"revision":{"type":"string","maxLength":100,"nullable":true,"default":null},"productName":{"type":"string","maxLength":200,"nullable":true,"default":null},"productDescription":{"type":"string","maxLength":2000,"nullable":true,"default":null},"environments":{"type":"object","properties":{"live":{"type":"object","properties":{"provision":{"type":"string","format":"uri","maxLength":2000},"health":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null},"partner":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null}},"required":["provision"],"additionalProperties":false},"test":{"type":"object","properties":{"provision":{"type":"string","format":"uri","maxLength":2000},"health":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null},"partner":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null}},"required":["provision"],"additionalProperties":false}},"additionalProperties":false},"auth":{"type":"object","properties":{"mode":{"type":"string","enum":["bearer","header"],"default":"bearer"},"header":{"type":"string","maxLength":100,"nullable":true,"default":null}},"additionalProperties":false,"default":{"mode":"bearer","header":null}},"payloadVersion":{"type":"integer","minimum":1,"maximum":99,"default":1},"events":{"type":"array","items":{"type":"string","maxLength":100},"default":[]},"webhookUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null},"plans":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":120},"planId":{"type":"string","format":"uuid"},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["code"],"additionalProperties":false},"default":[]},"mail":{"type":"object","properties":{"send":{"type":"boolean","default":false},"categories":{"type":"array","items":{"type":"string","enum":["transactional","marketing"]},"default":["transactional"]}},"additionalProperties":false,"nullable":true,"default":null},"contactEmail":{"type":"string","format":"email","maxLength":200,"nullable":true,"default":null},"docsUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null}},"required":["environments"],"additionalProperties":false,"nullable":true},"submittedAt":{"type":"string","nullable":true}},"required":["productId","manifest","submittedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["products"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"manifest":{"type":"object","properties":{"version":{"type":"string","enum":["1"],"default":"1"},"revision":{"type":"string","maxLength":100,"nullable":true,"default":null},"productName":{"type":"string","maxLength":200,"nullable":true,"default":null},"productDescription":{"type":"string","maxLength":2000,"nullable":true,"default":null},"environments":{"type":"object","properties":{"live":{"type":"object","properties":{"provision":{"type":"string","format":"uri","maxLength":2000},"health":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null},"partner":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null}},"required":["provision"],"additionalProperties":false},"test":{"type":"object","properties":{"provision":{"type":"string","format":"uri","maxLength":2000},"health":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null},"partner":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null}},"required":["provision"],"additionalProperties":false}},"additionalProperties":false},"auth":{"type":"object","properties":{"mode":{"type":"string","enum":["bearer","header"],"default":"bearer"},"header":{"type":"string","maxLength":100,"nullable":true,"default":null}},"additionalProperties":false,"default":{"mode":"bearer","header":null}},"payloadVersion":{"type":"integer","minimum":1,"maximum":99,"default":1},"events":{"type":"array","items":{"type":"string","maxLength":100},"default":[]},"webhookUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null},"plans":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":120},"planId":{"type":"string","format":"uuid"},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["code"],"additionalProperties":false},"default":[]},"mail":{"type":"object","properties":{"send":{"type":"boolean","default":false},"categories":{"type":"array","items":{"type":"string","enum":["transactional","marketing"]},"default":["transactional"]}},"additionalProperties":false,"nullable":true,"default":null},"contactEmail":{"type":"string","format":"email","maxLength":200,"nullable":true,"default":null},"docsUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true,"default":null}},"required":["environments"],"additionalProperties":false},"secrets":{"type":"object","properties":{"live":{"type":"string","minLength":8,"maxLength":500},"test":{"type":"string","minLength":8,"maxLength":500}},"additionalProperties":false,"default":{}},"dryRun":{"type":"boolean","default":false}},"required":["manifest"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"string","format":"uuid"},"dryRun":{"type":"boolean"},"changes":{"type":"array","items":{"type":"object","properties":{"target":{"type":"string","enum":["product","connection","plan","webhook"]},"action":{"type":"string","enum":["created","updated","unchanged","skipped"]},"environment":{"type":"string","enum":["live","test"],"nullable":true},"detail":{"type":"string"}},"required":["target","action","environment","detail"],"additionalProperties":false}},"signingSecrets":{"type":"object","additionalProperties":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}}},"required":["productId","dryRun","changes","signingSecrets","warnings"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/terminology":{"get":{"tags":["terminology"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"operatorOrgId":{"type":"string","format":"uuid","nullable":true},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"features":{"type":"array","items":{"type":"string"}},"terminology":{"type":"object","properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false,"nullable":true},"terms":{"type":"object","required":["partner","customer","deal","commission","location","territory","royalty","salesReport","audit"],"properties":{"partner":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"customer":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"deal":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"commission":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"location":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"territory":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"royalty":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"salesReport":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false},"audit":{"type":"object","properties":{"singular":{"type":"string","minLength":1,"maxLength":40},"plural":{"type":"string","minLength":1,"maxLength":40}},"required":["singular","plural"],"additionalProperties":false}},"additionalProperties":false}},"required":["operatorOrgId","businessType","features","terminology","terms"],"additionalProperties":false}}}}}}},"/api/locations":{"get":{"tags":["locations"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"territoryId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"parentId","required":false},{"schema":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["region","district","site"]},"in":"query","name":"level","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true},"territoryId":{"type":"string","format":"uuid","nullable":true},"level":{"type":"string","enum":["region","district","site"]},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"]},"addressLine1":{"type":"string","nullable":true},"addressLine2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"region":{"type":"string","nullable":true},"postalCode":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"latitude":{"type":"number","nullable":true},"longitude":{"type":"number","nullable":true},"timezone":{"type":"string","nullable":true},"openingDate":{"type":"string","nullable":true},"closedDate":{"type":"string","nullable":true},"managerName":{"type":"string","nullable":true},"managerEmail":{"type":"string","nullable":true},"managerPhone":{"type":"string","nullable":true},"customFields":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","parentId","territoryId","level","name","code","status","addressLine1","addressLine2","city","region","postalCode","country","latitude","longitude","timezone","openingDate","closedDate","managerName","managerEmail","managerPhone","customFields","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["locations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid","nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true},"territoryId":{"type":"string","format":"uuid","nullable":true},"level":{"type":"string","enum":["region","district","site"],"default":"site"},"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","maxLength":60,"nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"],"default":"planned"},"addressLine1":{"type":"string","maxLength":300,"nullable":true},"addressLine2":{"type":"string","maxLength":300,"nullable":true},"city":{"type":"string","maxLength":120,"nullable":true},"region":{"type":"string","maxLength":120,"nullable":true},"postalCode":{"type":"string","maxLength":20,"nullable":true},"country":{"type":"string","maxLength":100,"nullable":true},"latitude":{"type":"number","minimum":-90,"maximum":90,"nullable":true},"longitude":{"type":"number","minimum":-180,"maximum":180,"nullable":true},"timezone":{"type":"string","maxLength":60,"nullable":true},"openingDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"closedDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"managerName":{"type":"string","maxLength":200,"nullable":true},"managerEmail":{"type":"string","format":"email","nullable":true},"managerPhone":{"type":"string","maxLength":40,"nullable":true},"customFields":{"type":"object","additionalProperties":{}}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true},"territoryId":{"type":"string","format":"uuid","nullable":true},"level":{"type":"string","enum":["region","district","site"]},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"]},"addressLine1":{"type":"string","nullable":true},"addressLine2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"region":{"type":"string","nullable":true},"postalCode":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"latitude":{"type":"number","nullable":true},"longitude":{"type":"number","nullable":true},"timezone":{"type":"string","nullable":true},"openingDate":{"type":"string","nullable":true},"closedDate":{"type":"string","nullable":true},"managerName":{"type":"string","nullable":true},"managerEmail":{"type":"string","nullable":true},"managerPhone":{"type":"string","nullable":true},"customFields":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","parentId","territoryId","level","name","code","status","addressLine1","addressLine2","city","region","postalCode","country","latitude","longitude","timezone","openingDate","closedDate","managerName","managerEmail","managerPhone","customFields","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/locations/{id}":{"get":{"tags":["locations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true},"territoryId":{"type":"string","format":"uuid","nullable":true},"level":{"type":"string","enum":["region","district","site"]},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"]},"addressLine1":{"type":"string","nullable":true},"addressLine2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"region":{"type":"string","nullable":true},"postalCode":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"latitude":{"type":"number","nullable":true},"longitude":{"type":"number","nullable":true},"timezone":{"type":"string","nullable":true},"openingDate":{"type":"string","nullable":true},"closedDate":{"type":"string","nullable":true},"managerName":{"type":"string","nullable":true},"managerEmail":{"type":"string","nullable":true},"managerPhone":{"type":"string","nullable":true},"customFields":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","parentId","territoryId","level","name","code","status","addressLine1","addressLine2","city","region","postalCode","country","latitude","longitude","timezone","openingDate","closedDate","managerName","managerEmail","managerPhone","customFields","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["locations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid","nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true},"territoryId":{"type":"string","format":"uuid","nullable":true},"level":{"type":"string","enum":["region","district","site"],"default":"site"},"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","maxLength":60,"nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"],"default":"planned"},"addressLine1":{"type":"string","maxLength":300,"nullable":true},"addressLine2":{"type":"string","maxLength":300,"nullable":true},"city":{"type":"string","maxLength":120,"nullable":true},"region":{"type":"string","maxLength":120,"nullable":true},"postalCode":{"type":"string","maxLength":20,"nullable":true},"country":{"type":"string","maxLength":100,"nullable":true},"latitude":{"type":"number","minimum":-90,"maximum":90,"nullable":true},"longitude":{"type":"number","minimum":-180,"maximum":180,"nullable":true},"timezone":{"type":"string","maxLength":60,"nullable":true},"openingDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"closedDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"managerName":{"type":"string","maxLength":200,"nullable":true},"managerEmail":{"type":"string","format":"email","nullable":true},"managerPhone":{"type":"string","maxLength":40,"nullable":true},"customFields":{"type":"object","additionalProperties":{}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true},"territoryId":{"type":"string","format":"uuid","nullable":true},"level":{"type":"string","enum":["region","district","site"]},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"]},"addressLine1":{"type":"string","nullable":true},"addressLine2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"region":{"type":"string","nullable":true},"postalCode":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"latitude":{"type":"number","nullable":true},"longitude":{"type":"number","nullable":true},"timezone":{"type":"string","nullable":true},"openingDate":{"type":"string","nullable":true},"closedDate":{"type":"string","nullable":true},"managerName":{"type":"string","nullable":true},"managerEmail":{"type":"string","nullable":true},"managerPhone":{"type":"string","nullable":true},"customFields":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","parentId","territoryId","level","name","code","status","addressLine1","addressLine2","city","region","postalCode","country","latitude","longitude","timezone","openingDate","closedDate","managerName","managerEmail","managerPhone","customFields","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["locations"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/locations/{id}/manager":{"post":{"tags":["locations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"fullName":{"type":"string","minLength":1},"phone":{"type":"string"},"password":{"type":"string","minLength":8}},"required":["email","fullName"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"location":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"parentId":{"type":"string","format":"uuid","nullable":true},"territoryId":{"type":"string","format":"uuid","nullable":true},"level":{"type":"string","enum":["region","district","site"]},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"]},"addressLine1":{"type":"string","nullable":true},"addressLine2":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"region":{"type":"string","nullable":true},"postalCode":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"latitude":{"type":"number","nullable":true},"longitude":{"type":"number","nullable":true},"timezone":{"type":"string","nullable":true},"openingDate":{"type":"string","nullable":true},"closedDate":{"type":"string","nullable":true},"managerName":{"type":"string","nullable":true},"managerEmail":{"type":"string","nullable":true},"managerPhone":{"type":"string","nullable":true},"customFields":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","parentId","territoryId","level","name","code","status","addressLine1","addressLine2","city","region","postalCode","country","latitude","longitude","timezone","openingDate","closedDate","managerName","managerEmail","managerPhone","customFields","createdAt","updatedAt"],"additionalProperties":false},"userId":{"type":"string","format":"uuid"},"created":{"type":"boolean"},"invited":{"type":"boolean"}},"required":["location","userId","created","invited"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/territories":{"get":{"tags":["territories"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["active","reserved","inactive"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"]},"exclusive":{"type":"boolean"},"countries":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"postalCodes":{"type":"array","items":{"type":"string"}},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","nullable":true},"endsOn":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","name","code","status","exclusive","countries","regions","postalCodes","geometry","startsOn","endsOn","notes","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["territories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","maxLength":60,"nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"],"default":"active"},"exclusive":{"type":"boolean","default":false},"countries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"postalCodes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"]},"exclusive":{"type":"boolean"},"countries":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"postalCodes":{"type":"array","items":{"type":"string"}},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","nullable":true},"endsOn":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","name","code","status","exclusive","countries","regions","postalCodes","geometry","startsOn","endsOn","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/territories/match":{"get":{"tags":["territories"],"parameters":[{"schema":{"type":"string","maxLength":20},"in":"query","name":"postalCode","required":false},{"schema":{"type":"string","maxLength":120},"in":"query","name":"region","required":false},{"schema":{"type":"string","maxLength":100},"in":"query","name":"country","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"territory":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"]},"exclusive":{"type":"boolean"},"countries":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"postalCodes":{"type":"array","items":{"type":"string"}},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","nullable":true},"endsOn":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","name","code","status","exclusive","countries","regions","postalCodes","geometry","startsOn","endsOn","notes","createdAt","updatedAt"],"additionalProperties":false},"matchedBy":{"type":"string","enum":["postal_code","region","country"]}},"required":["territory","matchedBy"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/territories/check":{"post":{"tags":["territories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","maxLength":60,"nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"],"default":"active"},"exclusive":{"type":"boolean","default":false},"countries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"postalCodes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true},"id":{"type":"string","format":"uuid"}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"conflicts":{"type":"array","items":{"type":"object","properties":{"territoryId":{"type":"string","format":"uuid"},"territoryName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"overlap":{"type":"string"}},"required":["territoryId","territoryName","partnerId","overlap"],"additionalProperties":false}}},"required":["ok","conflicts"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/territories/{id}":{"get":{"tags":["territories"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"]},"exclusive":{"type":"boolean"},"countries":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"postalCodes":{"type":"array","items":{"type":"string"}},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","nullable":true},"endsOn":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","name","code","status","exclusive","countries","regions","postalCodes","geometry","startsOn","endsOn","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["territories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"code":{"type":"string","maxLength":60,"nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"],"default":"active"},"exclusive":{"type":"boolean","default":false},"countries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"postalCodes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"maxItems":5000,"default":[]},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"notes":{"type":"string","maxLength":5000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"]},"exclusive":{"type":"boolean"},"countries":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"postalCodes":{"type":"array","items":{"type":"string"}},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","nullable":true},"endsOn":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","name","code","status","exclusive","countries","regions","postalCodes","geometry","startsOn","endsOn","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["territories"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/territories/{id}/assign":{"post":{"tags":["territories"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid","nullable":true},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true}},"required":["partnerId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"code":{"type":"string","nullable":true},"status":{"type":"string","enum":["active","reserved","inactive"]},"exclusive":{"type":"boolean"},"countries":{"type":"array","items":{"type":"string"}},"regions":{"type":"array","items":{"type":"string"}},"postalCodes":{"type":"array","items":{"type":"string"}},"geometry":{"type":"object","additionalProperties":{},"nullable":true},"startsOn":{"type":"string","nullable":true},"endsOn":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","name","code","status","exclusive","countries","regions","postalCodes","geometry","startsOn","endsOn","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/royalties/schedules":{"get":{"tags":["royalties"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"basis":{"type":"string","enum":["percent_of_gross","fixed"]},"rateBps":{"type":"integer","minimum":0,"maximum":10000},"amount":{"type":"integer","minimum":0},"minimumAmount":{"type":"integer","minimum":0},"period":{"type":"string","enum":["weekly","monthly","one_time"]},"currency":{"type":"string","minLength":3,"maxLength":3},"reportDueDays":{"type":"integer","minimum":0,"maximum":90},"startsOn":{"type":"string"},"endsOn":{"type":"string","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","name","kind","basis","rateBps","amount","minimumAmount","period","currency","reportDueDays","startsOn","endsOn","active","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["royalties"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"basis":{"type":"string","enum":["percent_of_gross","fixed"]},"rateBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"amount":{"type":"integer","minimum":0,"default":0},"minimumAmount":{"type":"integer","minimum":0,"default":0},"period":{"type":"string","enum":["weekly","monthly","one_time"],"default":"monthly"},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"reportDueDays":{"type":"integer","minimum":0,"maximum":90,"default":10},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"active":{"type":"boolean","default":true}},"required":["partnerId","name","kind","basis","startsOn"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"basis":{"type":"string","enum":["percent_of_gross","fixed"]},"rateBps":{"type":"integer","minimum":0,"maximum":10000},"amount":{"type":"integer","minimum":0},"minimumAmount":{"type":"integer","minimum":0},"period":{"type":"string","enum":["weekly","monthly","one_time"]},"currency":{"type":"string","minLength":3,"maxLength":3},"reportDueDays":{"type":"integer","minimum":0,"maximum":90},"startsOn":{"type":"string"},"endsOn":{"type":"string","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","name","kind","basis","rateBps","amount","minimumAmount","period","currency","reportDueDays","startsOn","endsOn","active","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/royalties/schedules/{id}":{"patch":{"tags":["royalties"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"locationId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"basis":{"type":"string","enum":["percent_of_gross","fixed"]},"rateBps":{"type":"integer","minimum":0,"maximum":10000,"default":0},"amount":{"type":"integer","minimum":0,"default":0},"minimumAmount":{"type":"integer","minimum":0,"default":0},"period":{"type":"string","enum":["weekly","monthly","one_time"],"default":"monthly"},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"reportDueDays":{"type":"integer","minimum":0,"maximum":90,"default":10},"startsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"endsOn":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true},"active":{"type":"boolean","default":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"name":{"type":"string"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"basis":{"type":"string","enum":["percent_of_gross","fixed"]},"rateBps":{"type":"integer","minimum":0,"maximum":10000},"amount":{"type":"integer","minimum":0},"minimumAmount":{"type":"integer","minimum":0},"period":{"type":"string","enum":["weekly","monthly","one_time"]},"currency":{"type":"string","minLength":3,"maxLength":3},"reportDueDays":{"type":"integer","minimum":0,"maximum":90},"startsOn":{"type":"string"},"endsOn":{"type":"string","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","name","kind","basis","rateBps","amount","minimumAmount","period","currency","reportDueDays","startsOn","endsOn","active","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["royalties"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/royalties/charges":{"get":{"tags":["royalties"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string","enum":["pending","invoiced","void"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"scheduleId":{"type":"string","format":"uuid"},"salesReportId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"description":{"type":"string"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"baseAmount":{"type":"integer","minimum":0},"rateBps":{"type":"integer"},"amount":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["pending","invoiced","void"]},"invoiceId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","scheduleId","salesReportId","kind","description","periodStart","periodEnd","baseAmount","rateBps","amount","currency","status","invoiceId","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/royalties/gaps":{"get":{"tags":["royalties"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"integer","minimum":1,"maximum":24,"default":3},"in":"query","name":"periods","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"period":{"type":"string","enum":["weekly","monthly"]},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"dueAt":{"type":"string"},"status":{"type":"string","enum":["missing","late"]},"daysOverdue":{"type":"integer"},"salesReportId":{"type":"string","format":"uuid","nullable":true}},"required":["partnerId","locationId","locationName","period","periodStart","periodEnd","dueAt","status","daysOverdue","salesReportId"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/royalties/billing-runs":{"post":{"tags":["royalties"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"period":{"type":"string","enum":["weekly","monthly"],"default":"monthly"},"periodStart":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"partnerId":{"type":"string","format":"uuid"},"invoice":{"type":"boolean","default":true},"dueInDays":{"type":"integer","minimum":0,"maximum":120,"default":14}},"required":["periodStart"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"chargesCreated":{"type":"integer"},"invoices":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"number":{"type":"string"},"total":{"type":"integer","minimum":0},"charges":{"type":"integer"}},"required":["invoiceId","partnerId","number","total","charges"],"additionalProperties":false}},"missingReports":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"period":{"type":"string","enum":["weekly","monthly"]},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"dueAt":{"type":"string"},"status":{"type":"string","enum":["missing","late"]},"daysOverdue":{"type":"integer"},"salesReportId":{"type":"string","format":"uuid","nullable":true}},"required":["partnerId","locationId","locationName","period","periodStart","periodEnd","dueAt","status","daysOverdue","salesReportId"],"additionalProperties":false}}},"required":["periodStart","periodEnd","chargesCreated","invoices","missingReports"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sales-reports":{"get":{"tags":["sales-reports"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string","enum":["submitted","approved","invoiced","disputed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"in":"query","name":"from","required":false},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"in":"query","name":"to","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"period":{"type":"string","enum":["weekly","monthly"]},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"grossSales":{"type":"integer","minimum":0},"transactions":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["submitted","approved","invoiced","disputed"]},"source":{"type":"string","enum":["portal","console","api","csv"]},"dueAt":{"type":"string","nullable":true},"submittedAt":{"type":"string"},"late":{"type":"boolean"},"feeLines":{"type":"array","items":{"type":"object","properties":{"scheduleId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"description":{"type":"string"},"rateBps":{"type":"integer"},"baseAmount":{"type":"integer","minimum":0},"amount":{"type":"integer","minimum":0}},"required":["scheduleId","kind","description","rateBps","baseAmount","amount"],"additionalProperties":false}},"feesTotal":{"type":"integer","minimum":0},"invoiceId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"submittedById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","period","periodStart","periodEnd","grossSales","transactions","currency","status","source","dueAt","submittedAt","late","feeLines","feesTotal","invoiceId","notes","submittedById","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["sales-reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"period":{"type":"string","enum":["weekly","monthly"],"default":"monthly"},"periodStart":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"grossSales":{"type":"integer","minimum":0},"transactions":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"notes":{"type":"string","maxLength":2000,"nullable":true}},"required":["periodStart","grossSales"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"period":{"type":"string","enum":["weekly","monthly"]},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"grossSales":{"type":"integer","minimum":0},"transactions":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["submitted","approved","invoiced","disputed"]},"source":{"type":"string","enum":["portal","console","api","csv"]},"dueAt":{"type":"string","nullable":true},"submittedAt":{"type":"string"},"late":{"type":"boolean"},"feeLines":{"type":"array","items":{"type":"object","properties":{"scheduleId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"description":{"type":"string"},"rateBps":{"type":"integer"},"baseAmount":{"type":"integer","minimum":0},"amount":{"type":"integer","minimum":0}},"required":["scheduleId","kind","description","rateBps","baseAmount","amount"],"additionalProperties":false}},"feesTotal":{"type":"integer","minimum":0},"invoiceId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"submittedById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","period","periodStart","periodEnd","grossSales","transactions","currency","status","source","dueAt","submittedAt","late","feeLines","feesTotal","invoiceId","notes","submittedById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sales-reports/import":{"post":{"tags":["sales-reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"csv":{"type":"string","minLength":1,"maxLength":2000000}},"required":["csv"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"imported":{"type":"integer"},"errors":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"message":{"type":"string"}},"required":["row","message"],"additionalProperties":false}},"reports":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"period":{"type":"string","enum":["weekly","monthly"]},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"grossSales":{"type":"integer","minimum":0},"transactions":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["submitted","approved","invoiced","disputed"]},"source":{"type":"string","enum":["portal","console","api","csv"]},"dueAt":{"type":"string","nullable":true},"submittedAt":{"type":"string"},"late":{"type":"boolean"},"feeLines":{"type":"array","items":{"type":"object","properties":{"scheduleId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"description":{"type":"string"},"rateBps":{"type":"integer"},"baseAmount":{"type":"integer","minimum":0},"amount":{"type":"integer","minimum":0}},"required":["scheduleId","kind","description","rateBps","baseAmount","amount"],"additionalProperties":false}},"feesTotal":{"type":"integer","minimum":0},"invoiceId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"submittedById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","period","periodStart","periodEnd","grossSales","transactions","currency","status","source","dueAt","submittedAt","late","feeLines","feesTotal","invoiceId","notes","submittedById","createdAt","updatedAt"],"additionalProperties":false}}},"required":["imported","errors","reports"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sales-reports/{id}":{"get":{"tags":["sales-reports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"period":{"type":"string","enum":["weekly","monthly"]},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"grossSales":{"type":"integer","minimum":0},"transactions":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["submitted","approved","invoiced","disputed"]},"source":{"type":"string","enum":["portal","console","api","csv"]},"dueAt":{"type":"string","nullable":true},"submittedAt":{"type":"string"},"late":{"type":"boolean"},"feeLines":{"type":"array","items":{"type":"object","properties":{"scheduleId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"description":{"type":"string"},"rateBps":{"type":"integer"},"baseAmount":{"type":"integer","minimum":0},"amount":{"type":"integer","minimum":0}},"required":["scheduleId","kind","description","rateBps","baseAmount","amount"],"additionalProperties":false}},"feesTotal":{"type":"integer","minimum":0},"invoiceId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"submittedById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","period","periodStart","periodEnd","grossSales","transactions","currency","status","source","dueAt","submittedAt","late","feeLines","feesTotal","invoiceId","notes","submittedById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["sales-reports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["approved","disputed"]},"grossSales":{"type":"integer","minimum":0},"notes":{"type":"string","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid","nullable":true},"period":{"type":"string","enum":["weekly","monthly"]},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"grossSales":{"type":"integer","minimum":0},"transactions":{"type":"integer","minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3},"status":{"type":"string","enum":["submitted","approved","invoiced","disputed"]},"source":{"type":"string","enum":["portal","console","api","csv"]},"dueAt":{"type":"string","nullable":true},"submittedAt":{"type":"string"},"late":{"type":"boolean"},"feeLines":{"type":"array","items":{"type":"object","properties":{"scheduleId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["royalty","marketing_fund","technology_fee","initial_fee","renewal_fee","other"]},"description":{"type":"string"},"rateBps":{"type":"integer"},"baseAmount":{"type":"integer","minimum":0},"amount":{"type":"integer","minimum":0}},"required":["scheduleId","kind","description","rateBps","baseAmount","amount"],"additionalProperties":false}},"feesTotal":{"type":"integer","minimum":0},"invoiceId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"submittedById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","locationId","period","periodStart","periodEnd","grossSales","transactions","currency","status","source","dueAt","submittedAt","late","feeLines","feesTotal","invoiceId","notes","submittedById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/audit-templates":{"get":{"tags":["audit-templates"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":60},"label":{"type":"string","minLength":1,"maxLength":300},"category":{"type":"string","maxLength":80,"nullable":true,"default":null},"weight":{"type":"integer","minimum":1,"maximum":100,"default":1},"guidance":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["id","label"],"additionalProperties":false}},"passingScore":{"type":"integer","minimum":0,"maximum":100},"documentId":{"type":"string","format":"uuid","nullable":true},"courseId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","items","passingScore","documentId","courseId","active","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["audit-templates"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":5000,"nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":60},"label":{"type":"string","minLength":1,"maxLength":300},"category":{"type":"string","maxLength":80,"nullable":true,"default":null},"weight":{"type":"integer","minimum":1,"maximum":100,"default":1},"guidance":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["id","label"],"additionalProperties":false},"minItems":1,"maxItems":500},"passingScore":{"type":"integer","minimum":0,"maximum":100,"default":80},"documentId":{"type":"string","format":"uuid","nullable":true},"courseId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean","default":true}},"required":["name","items"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":60},"label":{"type":"string","minLength":1,"maxLength":300},"category":{"type":"string","maxLength":80,"nullable":true,"default":null},"weight":{"type":"integer","minimum":1,"maximum":100,"default":1},"guidance":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["id","label"],"additionalProperties":false}},"passingScore":{"type":"integer","minimum":0,"maximum":100},"documentId":{"type":"string","format":"uuid","nullable":true},"courseId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","items","passingScore","documentId","courseId","active","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/audit-templates/{id}":{"get":{"tags":["audit-templates"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":60},"label":{"type":"string","minLength":1,"maxLength":300},"category":{"type":"string","maxLength":80,"nullable":true,"default":null},"weight":{"type":"integer","minimum":1,"maximum":100,"default":1},"guidance":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["id","label"],"additionalProperties":false}},"passingScore":{"type":"integer","minimum":0,"maximum":100},"documentId":{"type":"string","format":"uuid","nullable":true},"courseId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","items","passingScore","documentId","courseId","active","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["audit-templates"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":5000,"nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":60},"label":{"type":"string","minLength":1,"maxLength":300},"category":{"type":"string","maxLength":80,"nullable":true,"default":null},"weight":{"type":"integer","minimum":1,"maximum":100,"default":1},"guidance":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["id","label"],"additionalProperties":false},"minItems":1,"maxItems":500},"passingScore":{"type":"integer","minimum":0,"maximum":100,"default":80},"documentId":{"type":"string","format":"uuid","nullable":true},"courseId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean","default":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":60},"label":{"type":"string","minLength":1,"maxLength":300},"category":{"type":"string","maxLength":80,"nullable":true,"default":null},"weight":{"type":"integer","minimum":1,"maximum":100,"default":1},"guidance":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["id","label"],"additionalProperties":false}},"passingScore":{"type":"integer","minimum":0,"maximum":100},"documentId":{"type":"string","format":"uuid","nullable":true},"courseId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","description","items","passingScore","documentId","courseId","active","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/location-audits":{"get":{"tags":["location-audits"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"templateId","required":false},{"schema":{"type":"string","enum":["scheduled","in_progress","completed","cancelled"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid"},"templateName":{"type":"string"},"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["scheduled","in_progress","completed","cancelled"]},"scheduledFor":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"auditorName":{"type":"string","nullable":true},"responses":{"type":"array","items":{"type":"object","properties":{"itemId":{"type":"string","minLength":1,"maxLength":60},"result":{"type":"string","enum":["pass","fail","na"]},"note":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["itemId","result"],"additionalProperties":false}},"score":{"type":"number","nullable":true},"passed":{"type":"boolean","nullable":true},"summary":{"type":"string","nullable":true},"openActions":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","templateId","templateName","locationId","locationName","partnerId","status","scheduledFor","completedAt","auditorName","responses","score","passed","summary","openActions","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["location-audits"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string","format":"uuid"},"locationId":{"type":"string","format":"uuid"},"scheduledFor":{"type":"string","nullable":true},"auditorName":{"type":"string","maxLength":200,"nullable":true}},"required":["templateId","locationId"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid"},"templateName":{"type":"string"},"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["scheduled","in_progress","completed","cancelled"]},"scheduledFor":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"auditorName":{"type":"string","nullable":true},"responses":{"type":"array","items":{"type":"object","properties":{"itemId":{"type":"string","minLength":1,"maxLength":60},"result":{"type":"string","enum":["pass","fail","na"]},"note":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["itemId","result"],"additionalProperties":false}},"score":{"type":"number","nullable":true},"passed":{"type":"boolean","nullable":true},"summary":{"type":"string","nullable":true},"openActions":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","templateId","templateName","locationId","locationName","partnerId","status","scheduledFor","completedAt","auditorName","responses","score","passed","summary","openActions","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/location-audits/{id}":{"get":{"tags":["location-audits"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid"},"templateName":{"type":"string"},"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["scheduled","in_progress","completed","cancelled"]},"scheduledFor":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"auditorName":{"type":"string","nullable":true},"responses":{"type":"array","items":{"type":"object","properties":{"itemId":{"type":"string","minLength":1,"maxLength":60},"result":{"type":"string","enum":["pass","fail","na"]},"note":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["itemId","result"],"additionalProperties":false}},"score":{"type":"number","nullable":true},"passed":{"type":"boolean","nullable":true},"summary":{"type":"string","nullable":true},"openActions":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","templateId","templateName","locationId","locationName","partnerId","status","scheduledFor","completedAt","auditorName","responses","score","passed","summary","openActions","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/location-audits/{id}/record":{"post":{"tags":["location-audits"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"responses":{"type":"array","items":{"type":"object","properties":{"itemId":{"type":"string","minLength":1,"maxLength":60},"result":{"type":"string","enum":["pass","fail","na"]},"note":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["itemId","result"],"additionalProperties":false},"maxItems":500},"summary":{"type":"string","maxLength":5000,"nullable":true},"auditorName":{"type":"string","maxLength":200,"nullable":true},"complete":{"type":"boolean","default":false},"actionDueDays":{"type":"integer","minimum":1,"maximum":365,"default":14}},"required":["responses"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"templateId":{"type":"string","format":"uuid"},"templateName":{"type":"string"},"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["scheduled","in_progress","completed","cancelled"]},"scheduledFor":{"type":"string","nullable":true},"completedAt":{"type":"string","nullable":true},"auditorName":{"type":"string","nullable":true},"responses":{"type":"array","items":{"type":"object","properties":{"itemId":{"type":"string","minLength":1,"maxLength":60},"result":{"type":"string","enum":["pass","fail","na"]},"note":{"type":"string","maxLength":2000,"nullable":true,"default":null}},"required":["itemId","result"],"additionalProperties":false}},"score":{"type":"number","nullable":true},"passed":{"type":"boolean","nullable":true},"summary":{"type":"string","nullable":true},"openActions":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","templateId","templateName","locationId","locationName","partnerId","status","scheduledFor","completedAt","auditorName","responses","score","passed","summary","openActions","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/corrective-actions":{"get":{"tags":["corrective-actions"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"locationId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"auditId","required":false},{"schema":{"type":"string","enum":["open","in_progress","resolved","verified"]},"in":"query","name":"status","required":false},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false","1","0"]}]},"in":"query","name":"overdue","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"auditId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"itemId":{"type":"string","nullable":true},"title":{"type":"string"},"description":{"type":"string","nullable":true},"dueDate":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","in_progress","resolved","verified"]},"overdue":{"type":"boolean"},"resolutionNote":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"verifiedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","auditId","locationId","locationName","partnerId","itemId","title","description","dueDate","status","overdue","resolutionNote","resolvedAt","verifiedAt","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["corrective-actions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"locationId":{"type":"string","format":"uuid"},"auditId":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string","minLength":1,"maxLength":300},"description":{"type":"string","maxLength":5000,"nullable":true},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true}},"required":["locationId","title"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"auditId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"itemId":{"type":"string","nullable":true},"title":{"type":"string"},"description":{"type":"string","nullable":true},"dueDate":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","in_progress","resolved","verified"]},"overdue":{"type":"boolean"},"resolutionNote":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"verifiedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","auditId","locationId","locationName","partnerId","itemId","title","description","dueDate","status","overdue","resolutionNote","resolvedAt","verifiedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/corrective-actions/{id}":{"patch":{"tags":["corrective-actions"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["open","in_progress","resolved","verified"]},"resolutionNote":{"type":"string","maxLength":5000,"nullable":true},"dueDate":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"auditId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid"},"locationName":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"itemId":{"type":"string","nullable":true},"title":{"type":"string"},"description":{"type":"string","nullable":true},"dueDate":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","in_progress","resolved","verified"]},"overdue":{"type":"boolean"},"resolutionNote":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"verifiedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","auditId","locationId","locationName","partnerId","itemId","title","description","dueDate","status","overdue","resolutionNote","resolvedAt","verifiedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/network/partners":{"get":{"tags":["network"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"type":"string","nullable":true},"status":{"type":"string","nullable":true},"managedByOrgId":{"type":"string","format":"uuid","nullable":true}},"required":["id","name","type","status","managedByOrgId"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/network/rollup":{"get":{"tags":["network"],"parameters":[{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"in":"query","name":"from","required":false},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"in":"query","name":"to","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"},"currency":{"type":"string"},"locations":{"type":"object","properties":{"total":{"type":"integer"},"byStatus":{"type":"object","required":["planned","opening","open","temporarily_closed","closed"],"properties":{"planned":{"type":"integer"},"opening":{"type":"integer"},"open":{"type":"integer"},"temporarily_closed":{"type":"integer"},"closed":{"type":"integer"}},"additionalProperties":false},"openedInWindow":{"type":"integer"},"closedInWindow":{"type":"integer"}},"required":["total","byStatus","openedInWindow","closedInWindow"],"additionalProperties":false},"sales":{"type":"object","properties":{"grossSales":{"type":"integer","minimum":0},"reports":{"type":"integer"},"late":{"type":"integer"},"missing":{"type":"integer"}},"required":["grossSales","reports","late","missing"],"additionalProperties":false},"royalties":{"type":"object","properties":{"charged":{"type":"integer","minimum":0},"invoiced":{"type":"integer","minimum":0},"collected":{"type":"integer","minimum":0}},"required":["charged","invoiced","collected"],"additionalProperties":false},"audits":{"type":"object","properties":{"completed":{"type":"integer"},"averageScore":{"type":"number","nullable":true},"passRate":{"type":"number","nullable":true},"openActions":{"type":"integer"},"overdueActions":{"type":"integer"}},"required":["completed","averageScore","passRate","openActions","overdueActions"],"additionalProperties":false},"byLocation":{"type":"array","items":{"type":"object","properties":{"locationId":{"type":"string","format":"uuid"},"name":{"type":"string"},"code":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["planned","opening","open","temporarily_closed","closed"]},"grossSales":{"type":"integer","minimum":0},"fees":{"type":"integer","minimum":0},"lastAuditScore":{"type":"number","nullable":true}},"required":["locationId","name","code","partnerId","status","grossSales","fees","lastAuditScore"],"additionalProperties":false}},"byTerritory":{"type":"array","items":{"type":"object","properties":{"territoryId":{"type":"string","format":"uuid"},"name":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"locations":{"type":"integer"},"grossSales":{"type":"integer","minimum":0}},"required":["territoryId","name","partnerId","locations","grossSales"],"additionalProperties":false}}},"required":["from","to","currency","locations","sales","royalties","audits","byLocation","byTerritory"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/network/listings":{"get":{"tags":["public"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"in":"query","name":"category","required":false},{"schema":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"in":"query","name":"partnerKind","required":false},{"schema":{"type":"string","maxLength":60},"in":"query","name":"region","required":false},{"schema":{"type":"string","maxLength":60},"in":"query","name":"ecosystem","required":false},{"schema":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"in":"query","name":"commissionType","required":false},{"schema":{"type":"string","enum":["newest","trending"]},"in":"query","name":"sort","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"q","required":false},{"schema":{"type":"string","maxLength":60},"in":"query","name":"country","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true},"waitingCount":{"type":"integer"},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"],"nullable":true},"trending":{"type":"boolean"},"brandName":{"type":"string"},"verified":{"type":"boolean"},"partnerCount":{"type":"integer"}},"required":["id","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","publishedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","claimStatus","waitingCount","commissionType","trending","brandName","verified","partnerCount"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/public/network/listings/{slug}":{"get":{"tags":["public"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":120},"in":"path","name":"slug","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"publishedAt":{"type":"string","nullable":true},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true},"waitingCount":{"type":"integer"},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"],"nullable":true},"trending":{"type":"boolean"},"brandName":{"type":"string"},"verified":{"type":"boolean"},"partnerCount":{"type":"integer"}},"required":["id","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","publishedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","claimStatus","waitingCount","commissionType","trending","brandName","verified","partnerCount"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/network/facets":{"get":{"tags":["public"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"total":{"type":"integer"},"categories":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"count":{"type":"integer"}},"required":["key","count"],"additionalProperties":false}},"partnerKinds":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"count":{"type":"integer"}},"required":["key","count"],"additionalProperties":false}},"regions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"count":{"type":"integer"}},"required":["key","count"],"additionalProperties":false}},"ecosystems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"count":{"type":"integer"}},"required":["key","count"],"additionalProperties":false}},"commissionTypes":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"count":{"type":"integer"}},"required":["key","count"],"additionalProperties":false}}},"required":["total","categories","partnerKinds","regions","ecosystems","commissionTypes"],"additionalProperties":false}}}}}}},"/api/public/network/listings/{slug}/view":{"post":{"tags":["public"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":120},"in":"path","name":"slug","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"counted":{"type":"boolean"}},"required":["counted"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/network/pulse":{"get":{"tags":["public"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"generatedAt":{"type":"string"},"currency":{"type":"string","enum":["USD"]},"last24h":{"type":"object","properties":{"activePartners":{"type":"integer","nullable":true},"dealsWon":{"type":"integer","nullable":true},"closedWonVolume":{"type":"integer","nullable":true},"commissionsEarned":{"type":"integer","nullable":true},"customerEvents":{"type":"integer","nullable":true},"publishedListings":{"type":"integer"},"openPrograms":{"type":"integer"}},"required":["activePartners","dealsWon","closedWonVolume","commissionsEarned","customerEvents","publishedListings","openPrograms"],"additionalProperties":false},"last30d":{"type":"object","properties":{"activePartners":{"type":"integer","nullable":true},"dealsWon":{"type":"integer","nullable":true},"closedWonVolume":{"type":"integer","nullable":true},"commissionsEarned":{"type":"integer","nullable":true},"customerEvents":{"type":"integer","nullable":true},"publishedListings":{"type":"integer"},"openPrograms":{"type":"integer"}},"required":["activePartners","dealsWon","closedWonVolume","commissionsEarned","customerEvents","publishedListings","openPrograms"],"additionalProperties":false},"points":{"type":"array","items":{"type":"object","properties":{"lat":{"type":"number"},"lng":{"type":"number"},"kind":{"type":"string","enum":["commission","deal","partner_joined","listing"]},"weight":{"type":"integer","minimum":1,"maximum":5},"at":{"type":"string"}},"required":["lat","lng","kind","weight","at"],"additionalProperties":false}},"listingRegions":{"type":"array","items":{"type":"string"}},"kAnonymity":{"type":"integer"},"minPrograms":{"type":"integer"}},"required":["generatedAt","currency","last24h","last30d","points","listingRegions","kAnonymity","minPrograms"],"additionalProperties":false}}}}}}},"/api/public/network/listings/{slug}/inquiries":{"post":{"tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"email":{"type":"string","format":"email","maxLength":254},"company":{"type":"string","maxLength":160,"nullable":true},"website":{"type":"string","maxLength":300,"nullable":true},"country":{"type":"string","maxLength":60,"nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"message":{"type":"string","maxLength":3000,"nullable":true},"consent":{"type":"boolean","enum":[true]}},"required":["name","email","partnerKind","consent"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":120},"in":"path","name":"slug","required":true}],"responses":{"202":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["unconfirmed","waiting","forwarded","delivered","withdrawn"]},"needsConfirmation":{"type":"boolean"}},"required":["status","needsConfirmation"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/network/inquiries/confirm":{"post":{"tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":20,"maxLength":200}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"listingSlug":{"type":"string"},"listingTitle":{"type":"string"},"companyName":{"type":"string"},"status":{"type":"string","enum":["unconfirmed","waiting","forwarded","delivered","withdrawn"]}},"required":["listingSlug","listingTitle","companyName","status"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/network/claim/info":{"post":{"tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":20,"maxLength":200}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"listingSlug":{"type":"string"},"listingTitle":{"type":"string"},"companyName":{"type":"string"},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"]},"waiting":{"type":"integer"},"unsubscribed":{"type":"boolean"},"claimRequested":{"type":"boolean"},"signupOpen":{"type":"boolean"}},"required":["listingSlug","listingTitle","companyName","claimStatus","waiting","unsubscribed","claimRequested","signupOpen"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/network/claim/request":{"post":{"tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":20,"maxLength":200},"name":{"type":"string","minLength":1,"maxLength":120},"email":{"type":"string","format":"email","maxLength":254}},"required":["token","name","email"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"listingSlug":{"type":"string"},"listingTitle":{"type":"string"},"companyName":{"type":"string"},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"]},"waiting":{"type":"integer"},"unsubscribed":{"type":"boolean"},"claimRequested":{"type":"boolean"},"signupOpen":{"type":"boolean"}},"required":["listingSlug","listingTitle","companyName","claimStatus","waiting","unsubscribed","claimRequested","signupOpen"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/network/claim/opt-out":{"post":{"tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":20,"maxLength":200},"removeListing":{"type":"boolean","default":false}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"listingSlug":{"type":"string"},"listingTitle":{"type":"string"},"companyName":{"type":"string"},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"]},"waiting":{"type":"integer"},"unsubscribed":{"type":"boolean"},"claimRequested":{"type":"boolean"},"signupOpen":{"type":"boolean"}},"required":["listingSlug","listingTitle","companyName","claimStatus","waiting","unsubscribed","claimRequested","signupOpen"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/directory/claim":{"post":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":20,"maxLength":200}},"required":["token"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"listingId":{"type":"string","format":"uuid"},"delivered":{"type":"integer"}},"required":["listingId","delivered"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/directory/curator":{"get":{"tags":["exchange"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"curator":{"type":"boolean"}},"required":["curator"],"additionalProperties":false}}}}}}},"/api/exchange/directory/queue":{"get":{"tags":["exchange"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"listing":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false},"waiting":{"type":"integer"},"forwarded":{"type":"integer"},"delivered":{"type":"integer"},"unconfirmed":{"type":"integer"},"outreach":{"type":"object","properties":{"email":{"type":"string"},"sendCount":{"type":"integer"},"firstSentAt":{"type":"string","nullable":true},"lastSentAt":{"type":"string","nullable":true},"lastInquiryCount":{"type":"integer"},"openedAt":{"type":"string","nullable":true},"claimedAt":{"type":"string","nullable":true},"unsubscribedAt":{"type":"string","nullable":true},"claimRequest":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"at":{"type":"string"}},"required":["name","email","at"],"additionalProperties":false,"nullable":true}},"required":["email","sendCount","firstSentAt","lastSentAt","lastInquiryCount","openedAt","claimedAt","unsubscribedAt","claimRequest"],"additionalProperties":false,"nullable":true},"nextSendAt":{"type":"string","nullable":true}},"required":["listing","waiting","forwarded","delivered","unconfirmed","outreach","nextSendAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/directory/import":{"post":{"tags":["exchange"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"}},"required":["created","updated","skipped"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/directory/{id}/inquiries":{"get":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"listingId":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"message":{"type":"string","nullable":true},"status":{"type":"string","enum":["unconfirmed","waiting","forwarded","delivered","withdrawn"]},"confirmedAt":{"type":"string","nullable":true},"forwardedAt":{"type":"string","nullable":true},"deliveredAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","listingId","name","email","company","website","country","partnerKind","message","status","confirmedAt","forwardedAt","deliveredAt","createdAt"],"additionalProperties":false}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/directory/{id}/outreach":{"put":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","maxLength":254}},"required":["email"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"listing":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false},"waiting":{"type":"integer"},"forwarded":{"type":"integer"},"delivered":{"type":"integer"},"unconfirmed":{"type":"integer"},"outreach":{"type":"object","properties":{"email":{"type":"string"},"sendCount":{"type":"integer"},"firstSentAt":{"type":"string","nullable":true},"lastSentAt":{"type":"string","nullable":true},"lastInquiryCount":{"type":"integer"},"openedAt":{"type":"string","nullable":true},"claimedAt":{"type":"string","nullable":true},"unsubscribedAt":{"type":"string","nullable":true},"claimRequest":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"at":{"type":"string"}},"required":["name","email","at"],"additionalProperties":false,"nullable":true}},"required":["email","sendCount","firstSentAt","lastSentAt","lastInquiryCount","openedAt","claimedAt","unsubscribedAt","claimRequest"],"additionalProperties":false,"nullable":true},"nextSendAt":{"type":"string","nullable":true}},"required":["listing","waiting","forwarded","delivered","unconfirmed","outreach","nextSendAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/directory/{id}/send":{"post":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"boolean"},"forwarded":{"type":"integer"},"to":{"type":"string"}},"required":["sent","forwarded","to"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/directory/{id}/{action}":{"post":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","enum":["publish","pause"]},"in":"path","name":"action","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"listing":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false},"waiting":{"type":"integer"},"forwarded":{"type":"integer"},"delivered":{"type":"integer"},"unconfirmed":{"type":"integer"},"outreach":{"type":"object","properties":{"email":{"type":"string"},"sendCount":{"type":"integer"},"firstSentAt":{"type":"string","nullable":true},"lastSentAt":{"type":"string","nullable":true},"lastInquiryCount":{"type":"integer"},"openedAt":{"type":"string","nullable":true},"claimedAt":{"type":"string","nullable":true},"unsubscribedAt":{"type":"string","nullable":true},"claimRequest":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"at":{"type":"string"}},"required":["name","email","at"],"additionalProperties":false,"nullable":true}},"required":["email","sendCount","firstSentAt","lastSentAt","lastInquiryCount","openedAt","claimedAt","unsubscribedAt","claimRequest"],"additionalProperties":false,"nullable":true},"nextSendAt":{"type":"string","nullable":true}},"required":["listing","waiting","forwarded","delivered","unconfirmed","outreach","nextSendAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/listings":{"get":{"tags":["exchange"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false}}}}}}},"put":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"slug":{"type":"string","minLength":2,"maxLength":120,"pattern":"^[a-z0-9][a-z0-9-]*$"},"tagline":{"type":"string","maxLength":240,"nullable":true},"description":{"type":"string","maxLength":20000,"nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"],"default":"other"},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"minItems":1},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":60,"default":[]},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false,"default":{}},"requirements":{"type":"string","maxLength":5000,"nullable":true},"perks":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":20,"default":[]},"ecosystems":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false},"maxItems":10,"default":[]},"logoUrl":{"type":"string","maxLength":1000,"nullable":true},"website":{"type":"string","maxLength":300,"nullable":true},"visibility":{"type":"string","enum":["public","unlisted"],"default":"public"},"autoAccept":{"type":"boolean","default":false}},"required":["title","partnerKinds"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"slug":{"type":"string","minLength":2,"maxLength":120,"pattern":"^[a-z0-9][a-z0-9-]*$"},"tagline":{"type":"string","maxLength":240,"nullable":true},"description":{"type":"string","maxLength":20000,"nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"],"default":"other"},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"minItems":1},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":60,"default":[]},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false,"default":{}},"requirements":{"type":"string","maxLength":5000,"nullable":true},"perks":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":20,"default":[]},"ecosystems":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false},"maxItems":10,"default":[]},"logoUrl":{"type":"string","maxLength":1000,"nullable":true},"website":{"type":"string","maxLength":300,"nullable":true},"visibility":{"type":"string","enum":["public","unlisted"],"default":"public"},"autoAccept":{"type":"boolean","default":false}},"required":["title","partnerKinds"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/listings/{id}":{"get":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":160},"slug":{"type":"string","minLength":2,"maxLength":120,"pattern":"^[a-z0-9][a-z0-9-]*$"},"tagline":{"type":"string","maxLength":240,"nullable":true},"description":{"type":"string","maxLength":20000,"nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"],"default":"other"},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"minItems":1},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":60,"default":[]},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false,"default":{}},"requirements":{"type":"string","maxLength":5000,"nullable":true},"perks":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":20,"default":[]},"ecosystems":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":20},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false},"maxItems":10,"default":[]},"logoUrl":{"type":"string","maxLength":1000,"nullable":true},"website":{"type":"string","maxLength":300,"nullable":true},"visibility":{"type":"string","enum":["public","unlisted"],"default":"public"},"autoAccept":{"type":"boolean","default":false}},"required":["title","partnerKinds"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/listings/{id}/publish":{"post":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/listings/{id}/pause":{"post":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid","nullable":true},"slug":{"type":"string"},"title":{"type":"string"},"tagline":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"businessType":{"type":"string","enum":["saas","retail_brand","agency","franchise","multi_location","distribution","referral_network","brokerage","education","local","marketplace","custom"],"nullable":true},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"regions":{"type":"array","items":{"type":"string"}},"terms":{"type":"object","properties":{"commission":{"type":"string","maxLength":200},"commissionType":{"type":"string","enum":["recurring","one_time","revenue_share","royalty","flat_fee"]},"fees":{"type":"string","maxLength":200},"investmentMin":{"type":"integer","minimum":0},"investmentMax":{"type":"integer","minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3}},"additionalProperties":false},"requirements":{"type":"string","nullable":true},"perks":{"type":"array","items":{"type":"string"}},"ecosystems":{"type":"array","items":{"type":"string"}},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"logoUrl":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"visibility":{"type":"string","enum":["public","unlisted"]},"status":{"type":"string","enum":["draft","published","paused"]},"autoAccept":{"type":"boolean"},"publishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"applicationCount":{"type":"integer"},"viewCount":{"type":"integer"},"source":{"type":"string","enum":["native","directory"]},"companyName":{"type":"string","nullable":true},"sourceUrl":{"type":"string","nullable":true},"sourceCheckedAt":{"type":"string","nullable":true},"applyUrl":{"type":"string","nullable":true},"contactEmail":{"type":"string","nullable":true},"claimStatus":{"type":"string","enum":["unclaimed","claimed","removed"],"nullable":true}},"required":["id","orgId","slug","title","tagline","description","category","businessType","partnerKinds","regions","terms","requirements","perks","ecosystems","questions","logoUrl","website","visibility","status","autoAccept","publishedAt","createdAt","updatedAt","source","companyName","sourceUrl","sourceCheckedAt","applyUrl","contactEmail","claimStatus"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/applications":{"get":{"tags":["exchange"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"listingId","required":false},{"schema":{"type":"string","enum":["recent","fit"]},"in":"query","name":"sort","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"listingId":{"type":"string","format":"uuid"},"listingTitle":{"type":"string"},"listingSlug":{"type":"string"},"brandOrgId":{"type":"string","format":"uuid"},"brandName":{"type":"string"},"partnerOrgId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"answers":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string","nullable":true},"status":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"applicationId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"decidedAt":{"type":"string","nullable":true},"unread":{"type":"integer"},"lastMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"summary":{"type":"string"},"strengths":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"suggestedGroup":{"type":"string","nullable":true},"signals":{"type":"object","properties":{"profileCompleteness":{"type":"integer","minimum":0,"maximum":100},"regionMatch":{"type":"string","enum":["match","open","mismatch","unknown"]},"categoryMatch":{"type":"string","enum":["match","mismatch","unknown"]},"partnerKindMatch":{"type":"boolean"},"questionsAnswered":{"type":"integer"},"questionsTotal":{"type":"integer"},"priorApplications":{"type":"integer"},"acceptedElsewhere":{"type":"integer"},"yearsInBusiness":{"type":"integer","nullable":true},"breakdown":{"type":"object","additionalProperties":{"type":"number"}}},"required":["profileCompleteness","regionMatch","categoryMatch","partnerKindMatch","questionsAnswered","questionsTotal","priorApplications","acceptedElsewhere","yearsInBusiness","breakdown"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"scoredAt":{"type":"string"}},"required":["score","summary","strengths","risks","suggestedGroup","signals","source","scoredAt"],"additionalProperties":false,"nullable":true}},"required":["id","listingId","listingTitle","listingSlug","brandOrgId","brandName","partnerOrgId","partnerName","profile","partnerKind","answers","message","status","applicationId","decisionNote","decidedAt","unread","lastMessageAt","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/exchange/applications/{id}/decision":{"post":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["reviewing","accept","decline"]},"note":{"type":"string","maxLength":2000}},"required":["decision"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"listingId":{"type":"string","format":"uuid"},"listingTitle":{"type":"string"},"listingSlug":{"type":"string"},"brandOrgId":{"type":"string","format":"uuid"},"brandName":{"type":"string"},"partnerOrgId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"answers":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string","nullable":true},"status":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"applicationId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"decidedAt":{"type":"string","nullable":true},"unread":{"type":"integer"},"lastMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"summary":{"type":"string"},"strengths":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"suggestedGroup":{"type":"string","nullable":true},"signals":{"type":"object","properties":{"profileCompleteness":{"type":"integer","minimum":0,"maximum":100},"regionMatch":{"type":"string","enum":["match","open","mismatch","unknown"]},"categoryMatch":{"type":"string","enum":["match","mismatch","unknown"]},"partnerKindMatch":{"type":"boolean"},"questionsAnswered":{"type":"integer"},"questionsTotal":{"type":"integer"},"priorApplications":{"type":"integer"},"acceptedElsewhere":{"type":"integer"},"yearsInBusiness":{"type":"integer","nullable":true},"breakdown":{"type":"object","additionalProperties":{"type":"number"}}},"required":["profileCompleteness","regionMatch","categoryMatch","partnerKindMatch","questionsAnswered","questionsTotal","priorApplications","acceptedElsewhere","yearsInBusiness","breakdown"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"scoredAt":{"type":"string"}},"required":["score","summary","strengths","risks","suggestedGroup","signals","source","scoredAt"],"additionalProperties":false,"nullable":true},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"authorUserId":{"type":"string","format":"uuid","nullable":true},"authorName":{"type":"string","nullable":true},"side":{"type":"string","enum":["brand","partner","system"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","applicationId","authorUserId","authorName","side","body","createdAt"],"additionalProperties":false}}},"required":["id","listingId","listingTitle","listingSlug","brandOrgId","brandName","partnerOrgId","partnerName","profile","partnerKind","answers","message","status","applicationId","decisionNote","decidedAt","unread","lastMessageAt","createdAt","updatedAt","questions","messages"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/applications/{id}/score":{"post":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"summary":{"type":"string"},"strengths":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"suggestedGroup":{"type":"string","nullable":true},"signals":{"type":"object","properties":{"profileCompleteness":{"type":"integer","minimum":0,"maximum":100},"regionMatch":{"type":"string","enum":["match","open","mismatch","unknown"]},"categoryMatch":{"type":"string","enum":["match","mismatch","unknown"]},"partnerKindMatch":{"type":"boolean"},"questionsAnswered":{"type":"integer"},"questionsTotal":{"type":"integer"},"priorApplications":{"type":"integer"},"acceptedElsewhere":{"type":"integer"},"yearsInBusiness":{"type":"integer","nullable":true},"breakdown":{"type":"object","additionalProperties":{"type":"number"}}},"required":["profileCompleteness","regionMatch","categoryMatch","partnerKindMatch","questionsAnswered","questionsTotal","priorApplications","acceptedElsewhere","yearsInBusiness","breakdown"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"scoredAt":{"type":"string"}},"required":["score","summary","strengths","risks","suggestedGroup","signals","source","scoredAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/applications/{id}":{"get":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"listingId":{"type":"string","format":"uuid"},"listingTitle":{"type":"string"},"listingSlug":{"type":"string"},"brandOrgId":{"type":"string","format":"uuid"},"brandName":{"type":"string"},"partnerOrgId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"answers":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string","nullable":true},"status":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"applicationId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"decidedAt":{"type":"string","nullable":true},"unread":{"type":"integer"},"lastMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"summary":{"type":"string"},"strengths":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"suggestedGroup":{"type":"string","nullable":true},"signals":{"type":"object","properties":{"profileCompleteness":{"type":"integer","minimum":0,"maximum":100},"regionMatch":{"type":"string","enum":["match","open","mismatch","unknown"]},"categoryMatch":{"type":"string","enum":["match","mismatch","unknown"]},"partnerKindMatch":{"type":"boolean"},"questionsAnswered":{"type":"integer"},"questionsTotal":{"type":"integer"},"priorApplications":{"type":"integer"},"acceptedElsewhere":{"type":"integer"},"yearsInBusiness":{"type":"integer","nullable":true},"breakdown":{"type":"object","additionalProperties":{"type":"number"}}},"required":["profileCompleteness","regionMatch","categoryMatch","partnerKindMatch","questionsAnswered","questionsTotal","priorApplications","acceptedElsewhere","yearsInBusiness","breakdown"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"scoredAt":{"type":"string"}},"required":["score","summary","strengths","risks","suggestedGroup","signals","source","scoredAt"],"additionalProperties":false,"nullable":true},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"authorUserId":{"type":"string","format":"uuid","nullable":true},"authorName":{"type":"string","nullable":true},"side":{"type":"string","enum":["brand","partner","system"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","applicationId","authorUserId","authorName","side","body","createdAt"],"additionalProperties":false}}},"required":["id","listingId","listingTitle","listingSlug","brandOrgId","brandName","partnerOrgId","partnerName","profile","partnerKind","answers","message","status","applicationId","decisionNote","decidedAt","unread","lastMessageAt","createdAt","updatedAt","questions","messages"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/applications/{id}/messages":{"get":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"authorUserId":{"type":"string","format":"uuid","nullable":true},"authorName":{"type":"string","nullable":true},"side":{"type":"string","enum":["brand","partner","system"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","applicationId","authorUserId","authorName","side","body","createdAt"],"additionalProperties":false}}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":5000}},"required":["body"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"authorUserId":{"type":"string","format":"uuid","nullable":true},"authorName":{"type":"string","nullable":true},"side":{"type":"string","enum":["brand","partner","system"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","applicationId","authorUserId","authorName","side","body","createdAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/applications/{id}/read":{"post":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/unread":{"get":{"tags":["exchange"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"brand":{"type":"integer"},"partner":{"type":"integer"}},"required":["brand","partner"],"additionalProperties":false}}}}}}},"/api/exchange/profile":{"get":{"tags":["exchange"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false}}}}}},"put":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"displayName":{"type":"string","minLength":1,"maxLength":160},"headline":{"type":"string","maxLength":240,"nullable":true},"bio":{"type":"string","maxLength":5000,"nullable":true},"website":{"type":"string","maxLength":300,"nullable":true},"country":{"type":"string","maxLength":80,"nullable":true},"regions":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":40,"default":[]},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"minItems":1},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]},"maxItems":12,"default":[]},"yearsInBusiness":{"type":"integer","minimum":0,"maximum":200,"nullable":true},"teamSize":{"type":"integer","minimum":1,"maximum":1000000,"nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","maxLength":300,"nullable":true}},"required":["displayName","partnerKinds"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/listings/{slug}/apply":{"post":{"tags":["exchange"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"answers":{"type":"object","additionalProperties":{"type":"string","maxLength":5000},"default":{}},"message":{"type":"string","maxLength":5000}},"required":["partnerKind"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":120},"in":"path","name":"slug","required":true}],"security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"listingId":{"type":"string","format":"uuid"},"listingTitle":{"type":"string"},"listingSlug":{"type":"string"},"brandOrgId":{"type":"string","format":"uuid"},"brandName":{"type":"string"},"partnerOrgId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"answers":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string","nullable":true},"status":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"applicationId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"decidedAt":{"type":"string","nullable":true},"unread":{"type":"integer"},"lastMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"summary":{"type":"string"},"strengths":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"suggestedGroup":{"type":"string","nullable":true},"signals":{"type":"object","properties":{"profileCompleteness":{"type":"integer","minimum":0,"maximum":100},"regionMatch":{"type":"string","enum":["match","open","mismatch","unknown"]},"categoryMatch":{"type":"string","enum":["match","mismatch","unknown"]},"partnerKindMatch":{"type":"boolean"},"questionsAnswered":{"type":"integer"},"questionsTotal":{"type":"integer"},"priorApplications":{"type":"integer"},"acceptedElsewhere":{"type":"integer"},"yearsInBusiness":{"type":"integer","nullable":true},"breakdown":{"type":"object","additionalProperties":{"type":"number"}}},"required":["profileCompleteness","regionMatch","categoryMatch","partnerKindMatch","questionsAnswered","questionsTotal","priorApplications","acceptedElsewhere","yearsInBusiness","breakdown"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"scoredAt":{"type":"string"}},"required":["score","summary","strengths","risks","suggestedGroup","signals","source","scoredAt"],"additionalProperties":false,"nullable":true},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"authorUserId":{"type":"string","format":"uuid","nullable":true},"authorName":{"type":"string","nullable":true},"side":{"type":"string","enum":["brand","partner","system"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","applicationId","authorUserId","authorName","side","body","createdAt"],"additionalProperties":false}}},"required":["id","listingId","listingTitle","listingSlug","brandOrgId","brandName","partnerOrgId","partnerName","profile","partnerKind","answers","message","status","applicationId","decisionNote","decidedAt","unread","lastMessageAt","createdAt","updatedAt","questions","messages"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/exchange/my-applications":{"get":{"tags":["exchange"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"listingId","required":false},{"schema":{"type":"string","enum":["recent","fit"]},"in":"query","name":"sort","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"listingId":{"type":"string","format":"uuid"},"listingTitle":{"type":"string"},"listingSlug":{"type":"string"},"brandOrgId":{"type":"string","format":"uuid"},"brandName":{"type":"string"},"partnerOrgId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"answers":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string","nullable":true},"status":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"applicationId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"decidedAt":{"type":"string","nullable":true},"unread":{"type":"integer"},"lastMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"summary":{"type":"string"},"strengths":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"suggestedGroup":{"type":"string","nullable":true},"signals":{"type":"object","properties":{"profileCompleteness":{"type":"integer","minimum":0,"maximum":100},"regionMatch":{"type":"string","enum":["match","open","mismatch","unknown"]},"categoryMatch":{"type":"string","enum":["match","mismatch","unknown"]},"partnerKindMatch":{"type":"boolean"},"questionsAnswered":{"type":"integer"},"questionsTotal":{"type":"integer"},"priorApplications":{"type":"integer"},"acceptedElsewhere":{"type":"integer"},"yearsInBusiness":{"type":"integer","nullable":true},"breakdown":{"type":"object","additionalProperties":{"type":"number"}}},"required":["profileCompleteness","regionMatch","categoryMatch","partnerKindMatch","questionsAnswered","questionsTotal","priorApplications","acceptedElsewhere","yearsInBusiness","breakdown"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"scoredAt":{"type":"string"}},"required":["score","summary","strengths","risks","suggestedGroup","signals","source","scoredAt"],"additionalProperties":false,"nullable":true}},"required":["id","listingId","listingTitle","listingSlug","brandOrgId","brandName","partnerOrgId","partnerName","profile","partnerKind","answers","message","status","applicationId","decisionNote","decidedAt","unread","lastMessageAt","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}}}}},"/api/exchange/applications/{id}/withdraw":{"post":{"tags":["exchange"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"listingId":{"type":"string","format":"uuid"},"listingTitle":{"type":"string"},"listingSlug":{"type":"string"},"brandOrgId":{"type":"string","format":"uuid"},"brandName":{"type":"string"},"partnerOrgId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"profile":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"regions":{"type":"array","items":{"type":"string"}},"partnerKinds":{"type":"array","items":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]}},"categories":{"type":"array","items":{"type":"string","enum":["software","ecommerce","food_beverage","retail","fitness_wellness","health","education","home_services","business_services","financial","real_estate","travel","other"]}},"yearsInBusiness":{"type":"integer","nullable":true},"teamSize":{"type":"integer","nullable":true},"capitalRange":{"type":"string","enum":["<25k","25k-100k","100k-250k","250k-500k","500k+"],"nullable":true},"linkedinUrl":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","complete"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","displayName","headline","bio","website","country","regions","partnerKinds","categories","yearsInBusiness","teamSize","capitalRange","linkedinUrl","status","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"partnerKind":{"type":"string","enum":["reseller","agency","referral","affiliate","franchisee","location_operator","distributor","integrator","agent"]},"answers":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string","nullable":true},"status":{"type":"string","enum":["submitted","reviewing","accepted","declined","withdrawn"]},"applicationId":{"type":"string","format":"uuid","nullable":true},"decisionNote":{"type":"string","nullable":true},"decidedAt":{"type":"string","nullable":true},"unread":{"type":"integer"},"lastMessageAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100},"summary":{"type":"string"},"strengths":{"type":"array","items":{"type":"string"}},"risks":{"type":"array","items":{"type":"string"}},"suggestedGroup":{"type":"string","nullable":true},"signals":{"type":"object","properties":{"profileCompleteness":{"type":"integer","minimum":0,"maximum":100},"regionMatch":{"type":"string","enum":["match","open","mismatch","unknown"]},"categoryMatch":{"type":"string","enum":["match","mismatch","unknown"]},"partnerKindMatch":{"type":"boolean"},"questionsAnswered":{"type":"integer"},"questionsTotal":{"type":"integer"},"priorApplications":{"type":"integer"},"acceptedElsewhere":{"type":"integer"},"yearsInBusiness":{"type":"integer","nullable":true},"breakdown":{"type":"object","additionalProperties":{"type":"number"}}},"required":["profileCompleteness","regionMatch","categoryMatch","partnerKindMatch","questionsAnswered","questionsTotal","priorApplications","acceptedElsewhere","yearsInBusiness","breakdown"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"scoredAt":{"type":"string"}},"required":["score","summary","strengths","risks","suggestedGroup","signals","source","scoredAt"],"additionalProperties":false,"nullable":true},"questions":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"required":{"type":"boolean","default":false}},"required":["key","label"],"additionalProperties":false}},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"applicationId":{"type":"string","format":"uuid"},"authorUserId":{"type":"string","format":"uuid","nullable":true},"authorName":{"type":"string","nullable":true},"side":{"type":"string","enum":["brand","partner","system"]},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","applicationId","authorUserId","authorName","side","body","createdAt"],"additionalProperties":false}}},"required":["id","listingId","listingTitle","listingSlug","brandOrgId","brandName","partnerOrgId","partnerName","profile","partnerKind","answers","message","status","applicationId","decisionNote","decidedAt","unread","lastMessageAt","createdAt","updatedAt","questions","messages"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/request-types":{"get":{"tags":["request-types"],"parameters":[{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"all","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["supply","maintenance","marketing","approval","it","finance","other"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","textarea","number","date","select","checkbox"]},"required":{"type":"boolean","default":false},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"help":{"type":"string","maxLength":300}},"required":["key","label","type"],"additionalProperties":false}},"slaHours":{"type":"integer","nullable":true},"requiresApproval":{"type":"boolean"},"assigneeId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"sortOrder":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","key","name","description","category","fields","slaHours","requiresApproval","assigneeId","active","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["request-types"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000,"nullable":true},"category":{"type":"string","enum":["supply","maintenance","marketing","approval","it","finance","other"],"default":"other"},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","textarea","number","date","select","checkbox"]},"required":{"type":"boolean","default":false},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"help":{"type":"string","maxLength":300}},"required":["key","label","type"],"additionalProperties":false},"maxItems":30,"default":[]},"slaHours":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1440,"nullable":true},"requiresApproval":{"type":"boolean","default":false},"assigneeId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean","default":true},"sortOrder":{"type":"integer","default":0}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["supply","maintenance","marketing","approval","it","finance","other"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","textarea","number","date","select","checkbox"]},"required":{"type":"boolean","default":false},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"help":{"type":"string","maxLength":300}},"required":["key","label","type"],"additionalProperties":false}},"slaHours":{"type":"integer","nullable":true},"requiresApproval":{"type":"boolean"},"assigneeId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"sortOrder":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","key","name","description","category","fields","slaHours","requiresApproval","assigneeId","active","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/request-types/{id}":{"get":{"tags":["request-types"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["supply","maintenance","marketing","approval","it","finance","other"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","textarea","number","date","select","checkbox"]},"required":{"type":"boolean","default":false},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"help":{"type":"string","maxLength":300}},"required":["key","label","type"],"additionalProperties":false}},"slaHours":{"type":"integer","nullable":true},"requiresApproval":{"type":"boolean"},"assigneeId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"sortOrder":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","key","name","description","category","fields","slaHours","requiresApproval","assigneeId","active","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["request-types"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000,"nullable":true},"category":{"type":"string","enum":["supply","maintenance","marketing","approval","it","finance","other"],"default":"other"},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","textarea","number","date","select","checkbox"]},"required":{"type":"boolean","default":false},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"help":{"type":"string","maxLength":300}},"required":["key","label","type"],"additionalProperties":false},"maxItems":30,"default":[]},"slaHours":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":1440,"nullable":true},"requiresApproval":{"type":"boolean","default":false},"assigneeId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean","default":true},"sortOrder":{"type":"integer","default":0}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string","enum":["supply","maintenance","marketing","approval","it","finance","other"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":60,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":120},"type":{"type":"string","enum":["text","textarea","number","date","select","checkbox"]},"required":{"type":"boolean","default":false},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"help":{"type":"string","maxLength":300}},"required":["key","label","type"],"additionalProperties":false}},"slaHours":{"type":"integer","nullable":true},"requiresApproval":{"type":"boolean"},"assigneeId":{"type":"string","format":"uuid","nullable":true},"active":{"type":"boolean"},"sortOrder":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","key","name","description","category","fields","slaHours","requiresApproval","assigneeId","active","sortOrder","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["request-types"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"retired":{"type":"boolean"}},"required":["ok","retired"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tickets/{id}/decision":{"post":{"tags":["tickets"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string","maxLength":2000}},"required":["decision"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"customerId":{"type":"string","format":"uuid","nullable":true},"subject":{"type":"string"},"description":{"type":"string","nullable":true},"status":{"type":"string","enum":["open","pending","resolved","closed"]},"priority":{"type":"string","enum":["low","normal","high","urgent"]},"assigneeId":{"type":"string","format":"uuid","nullable":true},"channel":{"type":"string","enum":["manual","email","api","request","feedback"]},"slaDueAt":{"type":"string","nullable":true},"firstRespondedAt":{"type":"string","nullable":true},"resolvedAt":{"type":"string","nullable":true},"closedAt":{"type":"string","nullable":true},"escalatedAt":{"type":"string","nullable":true},"reopenCount":{"type":"integer"},"createdById":{"type":"string","format":"uuid","nullable":true},"requestTypeId":{"type":"string","format":"uuid","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"fields":{"type":"object","additionalProperties":{}},"approvalStatus":{"type":"string","enum":["pending","approved","rejected"],"nullable":true},"approvedById":{"type":"string","format":"uuid","nullable":true},"approvedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","customerId","subject","description","status","priority","assigneeId","channel","slaDueAt","firstRespondedAt","resolvedAt","closedAt","escalatedAt","reopenCount","createdById","requestTypeId","locationId","fields","approvalStatus","approvedById","approvedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/campaigns":{"get":{"tags":["campaigns"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","enum":["draft","live","ended","archived"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"in":"query","name":"kind","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["campaigns"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"],"default":"announcement"},"title":{"type":"string","minLength":1,"maxLength":200},"summary":{"type":"string","maxLength":500,"nullable":true},"body":{"type":"string","maxLength":20000,"nullable":true},"offerCode":{"type":"string","maxLength":60,"nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":30,"default":[]},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false,"default":{}},"requiresAck":{"type":"boolean","default":false},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]},"minItems":1}},"required":["title"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/campaigns/{id}":{"get":{"tags":["campaigns"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["campaigns"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"],"default":"announcement"},"title":{"type":"string","minLength":1,"maxLength":200},"summary":{"type":"string","maxLength":500,"nullable":true},"body":{"type":"string","maxLength":20000,"nullable":true},"offerCode":{"type":"string","maxLength":60,"nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":30,"default":[]},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false,"default":{}},"requiresAck":{"type":"boolean","default":false},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]},"minItems":1}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["campaigns"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"archived":{"type":"boolean"}},"required":["ok","archived"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/campaigns/{id}/receipts":{"get":{"tags":["campaigns"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"status":{"type":"string","enum":["delivered","seen","acknowledged","opted_in","declined"]},"seenAt":{"type":"string","nullable":true},"respondedAt":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"emailStatus":{"type":"string","enum":["sent","failed","no_recipient"],"nullable":true},"emailedAt":{"type":"string","nullable":true},"openedAt":{"type":"string","nullable":true},"clickedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","campaignId","partnerId","partnerName","locationId","locationName","status","seenAt","respondedAt","note","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/campaigns/{id}/publish":{"post":{"tags":["campaigns"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/campaigns/{id}/end":{"post":{"tags":["campaigns"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/campaigns/pinned":{"get":{"tags":["portal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"status":{"type":"string","enum":["delivered","seen","acknowledged","opted_in","declined"]},"seenAt":{"type":"string","nullable":true},"respondedAt":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"emailStatus":{"type":"string","enum":["sent","failed","no_recipient"],"nullable":true},"emailedAt":{"type":"string","nullable":true},"openedAt":{"type":"string","nullable":true},"clickedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","campaignId","partnerId","partnerName","locationId","locationName","status","seenAt","respondedAt","note","createdAt"],"additionalProperties":false}},"materials":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string"}},"required":["id","title","kind"],"additionalProperties":false}}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt","receipts"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/campaigns":{"get":{"tags":["portal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"status":{"type":"string","enum":["delivered","seen","acknowledged","opted_in","declined"]},"seenAt":{"type":"string","nullable":true},"respondedAt":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"emailStatus":{"type":"string","enum":["sent","failed","no_recipient"],"nullable":true},"emailedAt":{"type":"string","nullable":true},"openedAt":{"type":"string","nullable":true},"clickedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","campaignId","partnerId","partnerName","locationId","locationName","status","seenAt","respondedAt","note","createdAt"],"additionalProperties":false}},"materials":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string"}},"required":["id","title","kind"],"additionalProperties":false}}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt","receipts"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/campaigns/{id}":{"get":{"tags":["portal"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"status":{"type":"string","enum":["delivered","seen","acknowledged","opted_in","declined"]},"seenAt":{"type":"string","nullable":true},"respondedAt":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"emailStatus":{"type":"string","enum":["sent","failed","no_recipient"],"nullable":true},"emailedAt":{"type":"string","nullable":true},"openedAt":{"type":"string","nullable":true},"clickedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","campaignId","partnerId","partnerName","locationId","locationName","status","seenAt","respondedAt","note","createdAt"],"additionalProperties":false}},"materials":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string"}},"required":["id","title","kind"],"additionalProperties":false}}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt","receipts"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/campaigns/{id}/respond":{"post":{"tags":["portal"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["acknowledged","opted_in","declined"]},"locationId":{"type":"string","format":"uuid","nullable":true},"note":{"type":"string","maxLength":1000}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["offer","announcement","asset_kit","promotion"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"offerCode":{"type":"string","nullable":true},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"locationIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"perLocation":{"type":"boolean","default":false}},"additionalProperties":false},"requiresAck":{"type":"boolean"},"pinnedUntil":{"type":"string","nullable":true},"channels":{"type":"array","items":{"type":"string","enum":["inbox","email"]}},"status":{"type":"string","enum":["draft","live","ended","archived"]},"publishedAt":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"stats":{"type":"object","properties":{"targeted":{"type":"integer"},"seen":{"type":"integer"},"acknowledged":{"type":"integer"},"optedIn":{"type":"integer"},"declined":{"type":"integer"},"emailed":{"type":"integer"},"opened":{"type":"integer"},"clicked":{"type":"integer"}},"required":["targeted","seen","acknowledged","optedIn","declined"],"additionalProperties":false},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"locationId":{"type":"string","format":"uuid","nullable":true},"locationName":{"type":"string","nullable":true},"status":{"type":"string","enum":["delivered","seen","acknowledged","opted_in","declined"]},"seenAt":{"type":"string","nullable":true},"respondedAt":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"emailStatus":{"type":"string","enum":["sent","failed","no_recipient"],"nullable":true},"emailedAt":{"type":"string","nullable":true},"openedAt":{"type":"string","nullable":true},"clickedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","campaignId","partnerId","partnerName","locationId","locationName","status","seenAt","respondedAt","note","createdAt"],"additionalProperties":false}},"materials":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"kind":{"type":"string"}},"required":["id","title","kind"],"additionalProperties":false}}},"required":["id","orgId","kind","title","summary","body","offerCode","startsAt","endsAt","materialIds","audience","requiresAck","status","publishedAt","createdById","createdAt","updatedAt","receipts"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/campaigns/t/o/{token}":{"get":{"tags":["campaigns"],"parameters":[{"schema":{"type":"string","minLength":10,"maxLength":200},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/campaigns/t/c/{token}":{"get":{"tags":["campaigns"],"parameters":[{"schema":{"type":"string","minLength":10,"maxLength":200},"in":"path","name":"token","required":true}],"responses":{"200":{"description":"Default Response"}}}},"/api/referrals/widgets":{"get":{"tags":["referrals"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"config":{"type":"object","properties":{"headline":{"type":"string","maxLength":140},"body":{"type":"string","maxLength":600},"buttonLabel":{"type":"string","maxLength":40},"landingUrl":{"type":"string","format":"uri","maxLength":500},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"partnerId":{"type":"string","format":"uuid","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true}},"additionalProperties":false},"reward":{"type":"object","properties":{"kind":{"type":"string","enum":["none","credit","wallet","coupon"],"default":"none"},"amount":{"type":"integer","minimum":0,"maximum":10000000},"currency":{"type":"string","minLength":3,"maxLength":3},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000},"trigger":{"type":"string","enum":["signup","conversion"],"default":"conversion"}},"additionalProperties":false},"status":{"type":"string","enum":["active","paused"]},"stats":{"type":"object","properties":{"invited":{"type":"integer"},"signedUp":{"type":"integer"},"converted":{"type":"integer"},"rewarded":{"type":"integer"}},"required":["invited","signedUp","converted","rewarded"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","config","reward","status","stats","createdAt","updatedAt"],"additionalProperties":false}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["referrals"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"config":{"type":"object","properties":{"headline":{"type":"string","maxLength":140},"body":{"type":"string","maxLength":600},"buttonLabel":{"type":"string","maxLength":40},"landingUrl":{"type":"string","format":"uri","maxLength":500},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"partnerId":{"type":"string","format":"uuid","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true}},"additionalProperties":false,"default":{}},"reward":{"type":"object","properties":{"kind":{"type":"string","enum":["none","credit","wallet","coupon"],"default":"none"},"amount":{"type":"integer","minimum":0,"maximum":10000000},"currency":{"type":"string","minLength":3,"maxLength":3},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000},"trigger":{"type":"string","enum":["signup","conversion"],"default":"conversion"}},"additionalProperties":false,"default":{"kind":"none","trigger":"conversion"}},"status":{"type":"string","enum":["active","paused"],"default":"active"}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"config":{"type":"object","properties":{"headline":{"type":"string","maxLength":140},"body":{"type":"string","maxLength":600},"buttonLabel":{"type":"string","maxLength":40},"landingUrl":{"type":"string","format":"uri","maxLength":500},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"partnerId":{"type":"string","format":"uuid","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true}},"additionalProperties":false},"reward":{"type":"object","properties":{"kind":{"type":"string","enum":["none","credit","wallet","coupon"],"default":"none"},"amount":{"type":"integer","minimum":0,"maximum":10000000},"currency":{"type":"string","minLength":3,"maxLength":3},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000},"trigger":{"type":"string","enum":["signup","conversion"],"default":"conversion"}},"additionalProperties":false},"status":{"type":"string","enum":["active","paused"]},"stats":{"type":"object","properties":{"invited":{"type":"integer"},"signedUp":{"type":"integer"},"converted":{"type":"integer"},"rewarded":{"type":"integer"}},"required":["invited","signedUp","converted","rewarded"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","config","reward","status","stats","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/referrals/widgets/{id}":{"get":{"tags":["referrals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"config":{"type":"object","properties":{"headline":{"type":"string","maxLength":140},"body":{"type":"string","maxLength":600},"buttonLabel":{"type":"string","maxLength":40},"landingUrl":{"type":"string","format":"uri","maxLength":500},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"partnerId":{"type":"string","format":"uuid","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true}},"additionalProperties":false},"reward":{"type":"object","properties":{"kind":{"type":"string","enum":["none","credit","wallet","coupon"],"default":"none"},"amount":{"type":"integer","minimum":0,"maximum":10000000},"currency":{"type":"string","minLength":3,"maxLength":3},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000},"trigger":{"type":"string","enum":["signup","conversion"],"default":"conversion"}},"additionalProperties":false},"status":{"type":"string","enum":["active","paused"]},"stats":{"type":"object","properties":{"invited":{"type":"integer"},"signedUp":{"type":"integer"},"converted":{"type":"integer"},"rewarded":{"type":"integer"}},"required":["invited","signedUp","converted","rewarded"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","config","reward","status","stats","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["referrals"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"config":{"type":"object","properties":{"headline":{"type":"string","maxLength":140},"body":{"type":"string","maxLength":600},"buttonLabel":{"type":"string","maxLength":40},"landingUrl":{"type":"string","format":"uri","maxLength":500},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"partnerId":{"type":"string","format":"uuid","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true}},"additionalProperties":false,"default":{}},"reward":{"type":"object","properties":{"kind":{"type":"string","enum":["none","credit","wallet","coupon"],"default":"none"},"amount":{"type":"integer","minimum":0,"maximum":10000000},"currency":{"type":"string","minLength":3,"maxLength":3},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000},"trigger":{"type":"string","enum":["signup","conversion"],"default":"conversion"}},"additionalProperties":false,"default":{"kind":"none","trigger":"conversion"}},"status":{"type":"string","enum":["active","paused"],"default":"active"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"config":{"type":"object","properties":{"headline":{"type":"string","maxLength":140},"body":{"type":"string","maxLength":600},"buttonLabel":{"type":"string","maxLength":40},"landingUrl":{"type":"string","format":"uri","maxLength":500},"accentColor":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},"partnerId":{"type":"string","format":"uuid","nullable":true},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer","exclusiveMinimum":true,"minimum":0},"currency":{"type":"string","minLength":3,"maxLength":3},"durationMonths":{"type":"integer","minimum":1,"maximum":36},"label":{"type":"string","maxLength":160},"stripeCoupon":{"type":"boolean","default":false}},"required":["kind","value"],"additionalProperties":false,"nullable":true}},"additionalProperties":false},"reward":{"type":"object","properties":{"kind":{"type":"string","enum":["none","credit","wallet","coupon"],"default":"none"},"amount":{"type":"integer","minimum":0,"maximum":10000000},"currency":{"type":"string","minLength":3,"maxLength":3},"discountType":{"type":"string","enum":["percent","amount"]},"discountValue":{"type":"integer","minimum":0,"maximum":1000000},"trigger":{"type":"string","enum":["signup","conversion"],"default":"conversion"}},"additionalProperties":false},"status":{"type":"string","enum":["active","paused"]},"stats":{"type":"object","properties":{"invited":{"type":"integer"},"signedUp":{"type":"integer"},"converted":{"type":"integer"},"rewarded":{"type":"integer"}},"required":["invited","signedUp","converted","rewarded"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","config","reward","status","stats","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["referrals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/referrals/widgets/{id}/install":{"get":{"tags":["referrals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"widgetId":{"type":"string","format":"uuid"},"publishableKey":{"type":"string"},"scriptUrl":{"type":"string"},"frameUrl":{"type":"string"},"snippet":{"type":"string"},"param":{"type":"string"}},"required":["widgetId","publishableKey","scriptUrl","frameUrl","snippet","param"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/referrals":{"get":{"tags":["referrals"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"widgetId","required":false},{"schema":{"type":"string","enum":["invited","signed_up","converted","rewarded","void"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"widgetId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"referrerEmail":{"type":"string"},"referrerCustomerId":{"type":"string","format":"uuid","nullable":true},"referrerPartnerId":{"type":"string","format":"uuid","nullable":true},"referredEmail":{"type":"string","nullable":true},"referredCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["invited","signed_up","converted","rewarded","void"]},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","widgetId","code","referrerEmail","referrerCustomerId","referrerPartnerId","referredEmail","referredCustomerId","status","rewardRef","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/referrals/{id}/void":{"post":{"tags":["referrals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"widgetId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"referrerEmail":{"type":"string"},"referrerCustomerId":{"type":"string","format":"uuid","nullable":true},"referrerPartnerId":{"type":"string","format":"uuid","nullable":true},"referredEmail":{"type":"string","nullable":true},"referredCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["invited","signed_up","converted","rewarded","void"]},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","widgetId","code","referrerEmail","referrerCustomerId","referrerPartnerId","referredEmail","referredCustomerId","status","rewardRef","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/referrals/{id}/reward":{"post":{"tags":["referrals"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"widgetId":{"type":"string","format":"uuid","nullable":true},"code":{"type":"string"},"referrerEmail":{"type":"string"},"referrerCustomerId":{"type":"string","format":"uuid","nullable":true},"referrerPartnerId":{"type":"string","format":"uuid","nullable":true},"referredEmail":{"type":"string","nullable":true},"referredCustomerId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["invited","signed_up","converted","rewarded","void"]},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","widgetId","code","referrerEmail","referrerCustomerId","referrerPartnerId","referredEmail","referredCustomerId","status","rewardRef","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/rw/widget":{"get":{"tags":["rw"],"parameters":[{"schema":{"type":"string","minLength":10,"maxLength":120},"in":"query","name":"k","required":true},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"w","required":true}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"headline":{"type":"string"},"body":{"type":"string"},"buttonLabel":{"type":"string"},"accentColor":{"type":"string"},"referredIncentive":{"type":"object","properties":{"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"}},"required":["kind","value","currency","durationMonths","description"],"additionalProperties":false,"nullable":true,"default":null}},"required":["id","name","headline","body","buttonLabel","accentColor"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/rw/join":{"post":{"tags":["rw"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"k":{"type":"string","minLength":10,"maxLength":120},"w":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email","maxLength":254}},"required":["k","w","email"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"shareUrl":{"type":"string","nullable":true},"status":{"type":"string"},"testMode":{"type":"boolean"}},"required":["code","shareUrl","status","testMode"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/rw/signup":{"post":{"tags":["rw"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"k":{"type":"string","minLength":10,"maxLength":120},"code":{"type":"string","minLength":4,"maxLength":64},"email":{"type":"string","format":"email","maxLength":254},"customerKey":{"type":"string","maxLength":200}},"required":["k","code","email"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"status":{"type":"string","nullable":true},"rewarded":{"type":"boolean"},"reason":{"type":"string","nullable":true}},"required":["accepted","status","rewarded","reason"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/rw/conversion":{"post":{"tags":["rw"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"k":{"type":"string","minLength":10,"maxLength":120},"code":{"type":"string","minLength":4,"maxLength":64},"email":{"type":"string","format":"email","maxLength":254},"externalId":{"type":"string","maxLength":200}},"required":["k","email"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"status":{"type":"string","nullable":true},"rewarded":{"type":"boolean"},"reason":{"type":"string","nullable":true}},"required":["accepted","status","rewarded","reason"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cosell/overlaps":{"get":{"tags":["cosell"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["open","actioned","dismissed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"shared","required":false},{"schema":{"type":"integer","minimum":0,"maximum":100},"in":"query","name":"minScore","required":false},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":200},"in":"query","name":"limit","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"accountDomain":{"type":"string"},"accountName":{"type":"string","nullable":true},"ourStatus":{"type":"string","nullable":true},"partnerStatus":{"type":"string","nullable":true},"source":{"type":"string"},"score":{"type":"integer"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"shared":{"type":"boolean"},"suggestion":{"type":"object","properties":{"source":{"type":"string","enum":["rules","ai"]},"nextStep":{"type":"string"},"introEmail":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"}},"required":["subject","body"],"additionalProperties":false},"rationale":{"type":"string","nullable":true},"sharedWithPartner":{"type":"boolean","default":false},"generatedAt":{"type":"string","nullable":true}},"required":["source","nextStep","introEmail"],"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","partnerName","accountDomain","accountName","ourStatus","partnerStatus","source","score","status","shared","suggestion","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cosell/overlaps/{id}":{"get":{"tags":["cosell"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"accountDomain":{"type":"string"},"accountName":{"type":"string","nullable":true},"ourStatus":{"type":"string","nullable":true},"partnerStatus":{"type":"string","nullable":true},"source":{"type":"string"},"score":{"type":"integer"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"shared":{"type":"boolean"},"suggestion":{"type":"object","properties":{"source":{"type":"string","enum":["rules","ai"]},"nextStep":{"type":"string"},"introEmail":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"}},"required":["subject","body"],"additionalProperties":false},"rationale":{"type":"string","nullable":true},"sharedWithPartner":{"type":"boolean","default":false},"generatedAt":{"type":"string","nullable":true}},"required":["source","nextStep","introEmail"],"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","partnerName","accountDomain","accountName","ourStatus","partnerStatus","source","score","status","shared","suggestion","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["cosell"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["open","actioned","dismissed"]},"shared":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"accountDomain":{"type":"string"},"accountName":{"type":"string","nullable":true},"ourStatus":{"type":"string","nullable":true},"partnerStatus":{"type":"string","nullable":true},"source":{"type":"string"},"score":{"type":"integer"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"shared":{"type":"boolean"},"suggestion":{"type":"object","properties":{"source":{"type":"string","enum":["rules","ai"]},"nextStep":{"type":"string"},"introEmail":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"}},"required":["subject","body"],"additionalProperties":false},"rationale":{"type":"string","nullable":true},"sharedWithPartner":{"type":"boolean","default":false},"generatedAt":{"type":"string","nullable":true}},"required":["source","nextStep","introEmail"],"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","partnerName","accountDomain","accountName","ourStatus","partnerStatus","source","score","status","shared","suggestion","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["cosell"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cosell/overlaps/{id}/suggest":{"post":{"tags":["cosell"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"accountDomain":{"type":"string"},"accountName":{"type":"string","nullable":true},"ourStatus":{"type":"string","nullable":true},"partnerStatus":{"type":"string","nullable":true},"source":{"type":"string"},"score":{"type":"integer"},"status":{"type":"string","enum":["open","actioned","dismissed"]},"shared":{"type":"boolean"},"suggestion":{"type":"object","properties":{"source":{"type":"string","enum":["rules","ai"]},"nextStep":{"type":"string"},"introEmail":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"}},"required":["subject","body"],"additionalProperties":false},"rationale":{"type":"string","nullable":true},"sharedWithPartner":{"type":"boolean","default":false},"generatedAt":{"type":"string","nullable":true}},"required":["source","nextStep","introEmail"],"additionalProperties":false,"nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","partnerName","accountDomain","accountName","ourStatus","partnerStatus","source","score","status","shared","suggestion","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cosell/import":{"post":{"tags":["cosell"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"theirs":{"type":"string","minLength":1,"maxLength":2000000},"ours":{"type":"string","maxLength":2000000},"source":{"type":"string","enum":["csv","reveal"],"default":"csv"}},"required":["partnerId","theirs"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ourAccounts":{"type":"integer"},"theirAccounts":{"type":"integer"},"overlaps":{"type":"integer"},"created":{"type":"integer"},"updated":{"type":"integer"}},"required":["ourAccounts","theirAccounts","overlaps","created","updated"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cosell/providers":{"get":{"tags":["cosell"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"crossbeam":{"type":"object","properties":{"connected":{"type":"boolean"},"connectionId":{"type":"string","format":"uuid","nullable":true},"label":{"type":"string","nullable":true}},"required":["connected","connectionId","label"],"additionalProperties":false}},"required":["crossbeam"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cosell/sync":{"post":{"tags":["cosell"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"provider":{"type":"string"},"fetched":{"type":"integer"},"matched":{"type":"integer"},"unmatchedPartners":{"type":"array","items":{"type":"string"}},"created":{"type":"integer"},"updated":{"type":"integer"}},"required":["provider","fetched","matched","unmatchedPartners","created","updated"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/ai/skills":{"get":{"tags":["ai"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"category","required":false},{"schema":{"type":"string"},"in":"query","name":"q","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string"},"system":{"type":"string","nullable":true},"prompt":{"type":"string"},"inputSchema":{"type":"object","additionalProperties":{},"nullable":true},"outputSchema":{"type":"object","additionalProperties":{},"nullable":true},"audience":{"type":"string","enum":["operator","partner","both"]},"status":{"type":"string","enum":["published","draft"]},"isDefault":{"type":"boolean"},"overridesDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","description","category","system","prompt","inputSchema","outputSchema","audience","status","isDefault","overridesDefault","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["ai"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000,"nullable":true},"category":{"type":"string","minLength":1,"maxLength":40},"system":{"type":"string","maxLength":8000,"nullable":true},"prompt":{"type":"string","minLength":1,"maxLength":20000},"inputSchema":{"type":"object","additionalProperties":{},"nullable":true},"outputSchema":{"type":"object","additionalProperties":{},"nullable":true},"audience":{"type":"string","enum":["operator","partner","both"]},"status":{"type":"string","enum":["published","draft"]},"key":{"type":"string","minLength":2,"maxLength":64,"pattern":"^[a-z0-9][a-z0-9_]*$"}},"required":["name","prompt","key"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string"},"system":{"type":"string","nullable":true},"prompt":{"type":"string"},"inputSchema":{"type":"object","additionalProperties":{},"nullable":true},"outputSchema":{"type":"object","additionalProperties":{},"nullable":true},"audience":{"type":"string","enum":["operator","partner","both"]},"status":{"type":"string","enum":["published","draft"]},"isDefault":{"type":"boolean"},"overridesDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","description","category","system","prompt","inputSchema","outputSchema","audience","status","isDefault","overridesDefault","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/ai/skills/{key}":{"get":{"tags":["ai"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"in":"path","name":"key","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string"},"system":{"type":"string","nullable":true},"prompt":{"type":"string"},"inputSchema":{"type":"object","additionalProperties":{},"nullable":true},"outputSchema":{"type":"object","additionalProperties":{},"nullable":true},"audience":{"type":"string","enum":["operator","partner","both"]},"status":{"type":"string","enum":["published","draft"]},"isDefault":{"type":"boolean"},"overridesDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","description","category","system","prompt","inputSchema","outputSchema","audience","status","isDefault","overridesDefault","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["ai"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":1000,"nullable":true},"category":{"type":"string","minLength":1,"maxLength":40},"system":{"type":"string","maxLength":8000,"nullable":true},"prompt":{"type":"string","minLength":1,"maxLength":20000},"inputSchema":{"type":"object","additionalProperties":{},"nullable":true},"outputSchema":{"type":"object","additionalProperties":{},"nullable":true},"audience":{"type":"string","enum":["operator","partner","both"]},"status":{"type":"string","enum":["published","draft"]}},"required":["name","prompt"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"in":"path","name":"key","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"category":{"type":"string"},"system":{"type":"string","nullable":true},"prompt":{"type":"string"},"inputSchema":{"type":"object","additionalProperties":{},"nullable":true},"outputSchema":{"type":"object","additionalProperties":{},"nullable":true},"audience":{"type":"string","enum":["operator","partner","both"]},"status":{"type":"string","enum":["published","draft"]},"isDefault":{"type":"boolean"},"overridesDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","name","description","category","system","prompt","inputSchema","outputSchema","audience","status","isDefault","overridesDefault","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["ai"],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"in":"path","name":"key","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/ai/skills/{key}/run":{"post":{"tags":["ai"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"input":{"type":"object","additionalProperties":{},"default":{}}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"in":"path","name":"key","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string"},"output":{},"provider":{"type":"string","nullable":true},"model":{"type":"string","nullable":true},"usage":{"type":"object","properties":{"inputTokens":{"type":"number"},"outputTokens":{"type":"number"},"totalTokens":{"type":"number"}},"required":["inputTokens","outputTokens","totalTokens"],"additionalProperties":false,"nullable":true}},"required":["key","provider","model","usage"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/imports":{"get":{"tags":["imports"],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["partnerstack","csv"]},"status":{"type":"string","enum":["draft","previewed","running","completed","failed"]},"options":{"type":"object","properties":{"objects":{"type":"array","items":{"type":"string","enum":["group","partner","customer","deal","reward"]}},"publicKeyMasked":{"type":"string","nullable":true},"hasCredentials":{"type":"boolean"},"csvObject":{"type":"string","enum":["partner","customer"]},"csvRows":{"type":"integer"},"csvColumns":{"type":"array","items":{"type":"string"}},"defaultPartnerType":{"type":"string"},"defaultPartnerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false},"mapping":{"type":"object","additionalProperties":{"type":"string"}},"preview":{"type":"object","properties":{"counts":{"type":"object","additionalProperties":{"type":"integer"}},"samples":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"warnings":{"type":"array","items":{"type":"string"}},"alreadyImported":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["counts","samples","warnings"],"additionalProperties":false,"nullable":true},"stats":{"type":"object","additionalProperties":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}},"required":["created","updated","skipped","failed"],"additionalProperties":false}},"error":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"startedAt":{"type":"string","nullable":true},"finishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","source","status","options","mapping","preview","stats","error","createdById","startedAt","finishedAt","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["imports"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"source":{"type":"string","enum":["partnerstack"]},"publicKey":{"type":"string","minLength":4,"maxLength":200},"secretKey":{"type":"string","minLength":4,"maxLength":200},"objects":{"type":"array","items":{"type":"string","enum":["group","partner","customer","deal","reward"]},"minItems":1},"defaultPartnerType":{"type":"string","maxLength":40}},"required":["source","publicKey","secretKey"],"additionalProperties":false},{"type":"object","properties":{"source":{"type":"string","enum":["csv"]},"objectType":{"type":"string","enum":["partner","customer"]},"csv":{"type":"string","minLength":1,"maxLength":2000000},"mapping":{"type":"object","additionalProperties":{"type":"string"},"default":{}},"defaultPartnerType":{"type":"string","maxLength":40},"defaultPartnerId":{"type":"string","format":"uuid"}},"required":["source","objectType","csv"],"additionalProperties":false}]}}}},"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["partnerstack","csv"]},"status":{"type":"string","enum":["draft","previewed","running","completed","failed"]},"options":{"type":"object","properties":{"objects":{"type":"array","items":{"type":"string","enum":["group","partner","customer","deal","reward"]}},"publicKeyMasked":{"type":"string","nullable":true},"hasCredentials":{"type":"boolean"},"csvObject":{"type":"string","enum":["partner","customer"]},"csvRows":{"type":"integer"},"csvColumns":{"type":"array","items":{"type":"string"}},"defaultPartnerType":{"type":"string"},"defaultPartnerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false},"mapping":{"type":"object","additionalProperties":{"type":"string"}},"preview":{"type":"object","properties":{"counts":{"type":"object","additionalProperties":{"type":"integer"}},"samples":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"warnings":{"type":"array","items":{"type":"string"}},"alreadyImported":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["counts","samples","warnings"],"additionalProperties":false,"nullable":true},"stats":{"type":"object","additionalProperties":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}},"required":["created","updated","skipped","failed"],"additionalProperties":false}},"error":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"startedAt":{"type":"string","nullable":true},"finishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","source","status","options","mapping","preview","stats","error","createdById","startedAt","finishedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/imports/{id}":{"get":{"tags":["imports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["partnerstack","csv"]},"status":{"type":"string","enum":["draft","previewed","running","completed","failed"]},"options":{"type":"object","properties":{"objects":{"type":"array","items":{"type":"string","enum":["group","partner","customer","deal","reward"]}},"publicKeyMasked":{"type":"string","nullable":true},"hasCredentials":{"type":"boolean"},"csvObject":{"type":"string","enum":["partner","customer"]},"csvRows":{"type":"integer"},"csvColumns":{"type":"array","items":{"type":"string"}},"defaultPartnerType":{"type":"string"},"defaultPartnerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false},"mapping":{"type":"object","additionalProperties":{"type":"string"}},"preview":{"type":"object","properties":{"counts":{"type":"object","additionalProperties":{"type":"integer"}},"samples":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"warnings":{"type":"array","items":{"type":"string"}},"alreadyImported":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["counts","samples","warnings"],"additionalProperties":false,"nullable":true},"stats":{"type":"object","additionalProperties":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}},"required":["created","updated","skipped","failed"],"additionalProperties":false}},"error":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"startedAt":{"type":"string","nullable":true},"finishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","source","status","options","mapping","preview","stats","error","createdById","startedAt","finishedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/imports/{id}/preview":{"post":{"tags":["imports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["partnerstack","csv"]},"status":{"type":"string","enum":["draft","previewed","running","completed","failed"]},"options":{"type":"object","properties":{"objects":{"type":"array","items":{"type":"string","enum":["group","partner","customer","deal","reward"]}},"publicKeyMasked":{"type":"string","nullable":true},"hasCredentials":{"type":"boolean"},"csvObject":{"type":"string","enum":["partner","customer"]},"csvRows":{"type":"integer"},"csvColumns":{"type":"array","items":{"type":"string"}},"defaultPartnerType":{"type":"string"},"defaultPartnerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false},"mapping":{"type":"object","additionalProperties":{"type":"string"}},"preview":{"type":"object","properties":{"counts":{"type":"object","additionalProperties":{"type":"integer"}},"samples":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"warnings":{"type":"array","items":{"type":"string"}},"alreadyImported":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["counts","samples","warnings"],"additionalProperties":false,"nullable":true},"stats":{"type":"object","additionalProperties":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}},"required":["created","updated","skipped","failed"],"additionalProperties":false}},"error":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"startedAt":{"type":"string","nullable":true},"finishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","source","status","options","mapping","preview","stats","error","createdById","startedAt","finishedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/imports/{id}/run":{"post":{"tags":["imports"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["partnerstack","csv"]},"status":{"type":"string","enum":["draft","previewed","running","completed","failed"]},"options":{"type":"object","properties":{"objects":{"type":"array","items":{"type":"string","enum":["group","partner","customer","deal","reward"]}},"publicKeyMasked":{"type":"string","nullable":true},"hasCredentials":{"type":"boolean"},"csvObject":{"type":"string","enum":["partner","customer"]},"csvRows":{"type":"integer"},"csvColumns":{"type":"array","items":{"type":"string"}},"defaultPartnerType":{"type":"string"},"defaultPartnerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false},"mapping":{"type":"object","additionalProperties":{"type":"string"}},"preview":{"type":"object","properties":{"counts":{"type":"object","additionalProperties":{"type":"integer"}},"samples":{"type":"object","additionalProperties":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"warnings":{"type":"array","items":{"type":"string"}},"alreadyImported":{"type":"object","additionalProperties":{"type":"integer"}}},"required":["counts","samples","warnings"],"additionalProperties":false,"nullable":true},"stats":{"type":"object","additionalProperties":{"type":"object","properties":{"created":{"type":"integer"},"updated":{"type":"integer"},"skipped":{"type":"integer"},"failed":{"type":"integer"}},"required":["created","updated","skipped","failed"],"additionalProperties":false}},"error":{"type":"string","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"startedAt":{"type":"string","nullable":true},"finishedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","source","status","options","mapping","preview","stats","error","createdById","startedAt","finishedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/imports/{id}/records":{"get":{"tags":["imports"],"parameters":[{"schema":{"type":"string"},"in":"query","name":"objectType","required":false},{"schema":{"type":"string","enum":["created","updated","skipped","failed"]},"in":"query","name":"status","required":false},{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"jobId":{"type":"string","format":"uuid"},"objectType":{"type":"string"},"externalId":{"type":"string"},"localId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["created","updated","skipped","failed"]},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","jobId","objectType","externalId","localId","status","error","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/coach/tips":{"get":{"tags":["coach"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"tips":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"rule":{"type":"string"},"area":{"type":"string","enum":["deals","leads","training","payouts","growth"]},"priority":{"type":"integer","minimum":1,"maximum":5},"severity":{"type":"string","enum":["info","warn","critical","positive"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"actionLabel":{"type":"string","nullable":true},"actionHref":{"type":"string","nullable":true},"subjectType":{"type":"string","nullable":true},"subjectId":{"type":"string","format":"uuid","nullable":true},"source":{"type":"string","enum":["rules","ai"]},"status":{"type":"string","enum":["open","done","dismissed"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","rule","area","priority","severity","title","summary","actionLabel","actionHref","subjectType","subjectId","source","status","createdAt","updatedAt"],"additionalProperties":false}},"aiAvailable":{"type":"boolean"},"generatedAt":{"type":"string"}},"required":["partnerId","tips","aiAvailable","generatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/coach/refresh":{"post":{"tags":["coach"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","enum":["true","false"]},"in":"query","name":"ai","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"tips":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"rule":{"type":"string"},"area":{"type":"string","enum":["deals","leads","training","payouts","growth"]},"priority":{"type":"integer","minimum":1,"maximum":5},"severity":{"type":"string","enum":["info","warn","critical","positive"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"actionLabel":{"type":"string","nullable":true},"actionHref":{"type":"string","nullable":true},"subjectType":{"type":"string","nullable":true},"subjectId":{"type":"string","format":"uuid","nullable":true},"source":{"type":"string","enum":["rules","ai"]},"status":{"type":"string","enum":["open","done","dismissed"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","rule","area","priority","severity","title","summary","actionLabel","actionHref","subjectType","subjectId","source","status","createdAt","updatedAt"],"additionalProperties":false}},"aiAvailable":{"type":"boolean"},"generatedAt":{"type":"string"}},"required":["partnerId","tips","aiAvailable","generatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/coach/tips/{id}":{"patch":{"tags":["coach"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["done","dismissed"]}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"rule":{"type":"string"},"area":{"type":"string","enum":["deals","leads","training","payouts","growth"]},"priority":{"type":"integer","minimum":1,"maximum":5},"severity":{"type":"string","enum":["info","warn","critical","positive"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"actionLabel":{"type":"string","nullable":true},"actionHref":{"type":"string","nullable":true},"subjectType":{"type":"string","nullable":true},"subjectId":{"type":"string","format":"uuid","nullable":true},"source":{"type":"string","enum":["rules","ai"]},"status":{"type":"string","enum":["open","done","dismissed"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","rule","area","priority","severity","title","summary","actionLabel","actionHref","subjectType","subjectId","source","status","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/prospects":{"get":{"tags":["recruit"],"parameters":[{"schema":{"type":"string","enum":["new","queued","invited","applied","joined","declined","bounced"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":500,"default":200},"in":"query","name":"pageSize","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"source":{"type":"string","enum":["manual","csv","network","agent","finder"]},"status":{"type":"string","enum":["new","queued","invited","applied","joined","declined","bounced"]},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100,"nullable":true,"default":null},"summary":{"type":"string","nullable":true,"default":null},"strengths":{"type":"array","items":{"type":"string"},"default":[]},"risks":{"type":"array","items":{"type":"string"},"default":[]},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"points":{"type":"number"}},"required":["key","label","points"],"additionalProperties":false},"default":[]},"source":{"type":"string","enum":["rules","ai"],"nullable":true,"default":null},"scoredAt":{"type":"string","nullable":true,"default":null},"draft":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":4000},"source":{"type":"string","enum":["ai","template","manual"]},"approved":{"type":"boolean","default":false},"draftedAt":{"type":"string"},"approvedAt":{"type":"string","nullable":true,"default":null}},"required":["subject","body","source","draftedAt"],"additionalProperties":false,"nullable":true,"default":null},"network":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"profileId":{"type":"string","format":"uuid"}},"required":["orgId","profileId"],"additionalProperties":false,"nullable":true,"default":null}},"additionalProperties":false,"nullable":true},"inviteUrl":{"type":"string","nullable":true},"invitedAt":{"type":"string","nullable":true},"applicationId":{"type":"string","format":"uuid","nullable":true},"partnerOrgId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","company","website","source","status","fit","inviteUrl","invitedAt","applicationId","partnerOrgId","notes","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","maxLength":320},"name":{"type":"string","maxLength":200,"nullable":true},"company":{"type":"string","maxLength":200,"nullable":true},"website":{"type":"string","maxLength":500,"nullable":true},"notes":{"type":"string","maxLength":4000,"nullable":true}},"required":["email"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"source":{"type":"string","enum":["manual","csv","network","agent","finder"]},"status":{"type":"string","enum":["new","queued","invited","applied","joined","declined","bounced"]},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100,"nullable":true,"default":null},"summary":{"type":"string","nullable":true,"default":null},"strengths":{"type":"array","items":{"type":"string"},"default":[]},"risks":{"type":"array","items":{"type":"string"},"default":[]},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"points":{"type":"number"}},"required":["key","label","points"],"additionalProperties":false},"default":[]},"source":{"type":"string","enum":["rules","ai"],"nullable":true,"default":null},"scoredAt":{"type":"string","nullable":true,"default":null},"draft":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":4000},"source":{"type":"string","enum":["ai","template","manual"]},"approved":{"type":"boolean","default":false},"draftedAt":{"type":"string"},"approvedAt":{"type":"string","nullable":true,"default":null}},"required":["subject","body","source","draftedAt"],"additionalProperties":false,"nullable":true,"default":null},"network":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"profileId":{"type":"string","format":"uuid"}},"required":["orgId","profileId"],"additionalProperties":false,"nullable":true,"default":null}},"additionalProperties":false,"nullable":true},"inviteUrl":{"type":"string","nullable":true},"invitedAt":{"type":"string","nullable":true},"applicationId":{"type":"string","format":"uuid","nullable":true},"partnerOrgId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","company","website","source","status","fit","inviteUrl","invitedAt","applicationId","partnerOrgId","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/prospects/{id}":{"get":{"tags":["recruit"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"source":{"type":"string","enum":["manual","csv","network","agent","finder"]},"status":{"type":"string","enum":["new","queued","invited","applied","joined","declined","bounced"]},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100,"nullable":true,"default":null},"summary":{"type":"string","nullable":true,"default":null},"strengths":{"type":"array","items":{"type":"string"},"default":[]},"risks":{"type":"array","items":{"type":"string"},"default":[]},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"points":{"type":"number"}},"required":["key","label","points"],"additionalProperties":false},"default":[]},"source":{"type":"string","enum":["rules","ai"],"nullable":true,"default":null},"scoredAt":{"type":"string","nullable":true,"default":null},"draft":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":4000},"source":{"type":"string","enum":["ai","template","manual"]},"approved":{"type":"boolean","default":false},"draftedAt":{"type":"string"},"approvedAt":{"type":"string","nullable":true,"default":null}},"required":["subject","body","source","draftedAt"],"additionalProperties":false,"nullable":true,"default":null},"network":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"profileId":{"type":"string","format":"uuid"}},"required":["orgId","profileId"],"additionalProperties":false,"nullable":true,"default":null}},"additionalProperties":false,"nullable":true},"inviteUrl":{"type":"string","nullable":true},"invitedAt":{"type":"string","nullable":true},"applicationId":{"type":"string","format":"uuid","nullable":true},"partnerOrgId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","company","website","source","status","fit","inviteUrl","invitedAt","applicationId","partnerOrgId","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":200,"nullable":true},"company":{"type":"string","maxLength":200,"nullable":true},"website":{"type":"string","maxLength":500,"nullable":true},"notes":{"type":"string","maxLength":4000,"nullable":true},"status":{"type":"string","enum":["new","declined","bounced"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"source":{"type":"string","enum":["manual","csv","network","agent","finder"]},"status":{"type":"string","enum":["new","queued","invited","applied","joined","declined","bounced"]},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100,"nullable":true,"default":null},"summary":{"type":"string","nullable":true,"default":null},"strengths":{"type":"array","items":{"type":"string"},"default":[]},"risks":{"type":"array","items":{"type":"string"},"default":[]},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"points":{"type":"number"}},"required":["key","label","points"],"additionalProperties":false},"default":[]},"source":{"type":"string","enum":["rules","ai"],"nullable":true,"default":null},"scoredAt":{"type":"string","nullable":true,"default":null},"draft":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":4000},"source":{"type":"string","enum":["ai","template","manual"]},"approved":{"type":"boolean","default":false},"draftedAt":{"type":"string"},"approvedAt":{"type":"string","nullable":true,"default":null}},"required":["subject","body","source","draftedAt"],"additionalProperties":false,"nullable":true,"default":null},"network":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"profileId":{"type":"string","format":"uuid"}},"required":["orgId","profileId"],"additionalProperties":false,"nullable":true,"default":null}},"additionalProperties":false,"nullable":true},"inviteUrl":{"type":"string","nullable":true},"invitedAt":{"type":"string","nullable":true},"applicationId":{"type":"string","format":"uuid","nullable":true},"partnerOrgId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","company","website","source","status","fit","inviteUrl","invitedAt","applicationId","partnerOrgId","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["recruit"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response"}}}},"/api/recruit/prospects/{id}/draft":{"put":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":4000},"approved":{"type":"boolean","default":false}},"required":["subject","body"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"source":{"type":"string","enum":["manual","csv","network","agent","finder"]},"status":{"type":"string","enum":["new","queued","invited","applied","joined","declined","bounced"]},"fit":{"type":"object","properties":{"score":{"type":"integer","minimum":0,"maximum":100,"nullable":true,"default":null},"summary":{"type":"string","nullable":true,"default":null},"strengths":{"type":"array","items":{"type":"string"},"default":[]},"risks":{"type":"array","items":{"type":"string"},"default":[]},"signals":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"points":{"type":"number"}},"required":["key","label","points"],"additionalProperties":false},"default":[]},"source":{"type":"string","enum":["rules","ai"],"nullable":true,"default":null},"scoredAt":{"type":"string","nullable":true,"default":null},"draft":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","minLength":1,"maxLength":4000},"source":{"type":"string","enum":["ai","template","manual"]},"approved":{"type":"boolean","default":false},"draftedAt":{"type":"string"},"approvedAt":{"type":"string","nullable":true,"default":null}},"required":["subject","body","source","draftedAt"],"additionalProperties":false,"nullable":true,"default":null},"network":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"profileId":{"type":"string","format":"uuid"}},"required":["orgId","profileId"],"additionalProperties":false,"nullable":true,"default":null}},"additionalProperties":false,"nullable":true},"inviteUrl":{"type":"string","nullable":true},"invitedAt":{"type":"string","nullable":true},"applicationId":{"type":"string","format":"uuid","nullable":true},"partnerOrgId":{"type":"string","format":"uuid","nullable":true},"notes":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","email","company","website","source","status","fit","inviteUrl","invitedAt","applicationId","partnerOrgId","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/drafts/approve":{"post":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prospectIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":200}},"required":["prospectIds"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"approved":{"type":"integer"}},"required":["approved"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/import":{"post":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"csv":{"type":"string","minLength":1,"maxLength":2000000},"mapping":{"type":"object","properties":{"email":{"type":"string","minLength":1},"name":{"type":"string"},"company":{"type":"string"},"website":{"type":"string"},"notes":{"type":"string"}},"required":["email"],"additionalProperties":false},"dryRun":{"type":"boolean","default":false}},"required":["csv"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"dryRun":{"type":"boolean"},"headers":{"type":"array","items":{"type":"string"}},"suggestedMapping":{"type":"object","properties":{"email":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true}},"required":["email","name","company","website","notes"],"additionalProperties":false},"total":{"type":"integer"},"created":{"type":"integer"},"duplicates":{"type":"integer"},"invalid":{"type":"integer"},"preview":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer"},"email":{"type":"string","nullable":true},"name":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"outcome":{"type":"string","enum":["create","duplicate","invalid"]}},"required":["row","email","name","company","outcome"],"additionalProperties":false}}},"required":["dryRun","headers","suggestedMapping","total","created","duplicates","invalid","preview"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/invite":{"post":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"prospectIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":200},"confirm":{"type":"boolean","enum":[true]},"useDrafts":{"type":"boolean","default":true},"subject":{"type":"string","maxLength":200},"message":{"type":"string","maxLength":4000}},"required":["prospectIds","confirm"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"integer"},"skipped":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"reason":{"type":"string"}},"required":["id","reason"],"additionalProperties":false}},"remainingThisHour":{"type":"integer"}},"required":["sent","skipped","remainingThisHour"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/icp":{"get":{"tags":["recruit"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"string"},"partnerKinds":{"type":"array","items":{"type":"string"},"default":[]},"regions":{"type":"array","items":{"type":"string"},"default":[]},"categories":{"type":"array","items":{"type":"string"},"default":[]},"keywords":{"type":"array","items":{"type":"string"},"default":[]},"requireWebsite":{"type":"boolean","default":false},"sources":{"type":"array","items":{"type":"string","enum":["listing","program","text"]},"default":[]}},"required":["summary"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/agent/run":{"post":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"profile":{"type":"string","maxLength":4000},"prospectIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":200},"score":{"type":"boolean","default":true},"draftInvites":{"type":"boolean","default":true},"suggestNetwork":{"type":"boolean","default":true},"useAi":{"type":"boolean","default":true}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"icp":{"type":"object","properties":{"summary":{"type":"string"},"partnerKinds":{"type":"array","items":{"type":"string"},"default":[]},"regions":{"type":"array","items":{"type":"string"},"default":[]},"categories":{"type":"array","items":{"type":"string"},"default":[]},"keywords":{"type":"array","items":{"type":"string"},"default":[]},"requireWebsite":{"type":"boolean","default":false},"sources":{"type":"array","items":{"type":"string","enum":["listing","program","text"]},"default":[]}},"required":["summary"],"additionalProperties":false},"source":{"type":"string","enum":["ai","rules"]},"fallbackReason":{"type":"string","nullable":true},"scored":{"type":"integer"},"drafted":{"type":"integer"},"suggestions":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"profileId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"partnerKinds":{"type":"array","items":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"}},"score":{"type":"integer","minimum":0,"maximum":100},"reasons":{"type":"array","items":{"type":"string"}}},"required":["orgId","profileId","displayName","headline","country","website","partnerKinds","categories","score","reasons"],"additionalProperties":false}}},"required":["icp","source","fallbackReason","scored","drafted","suggestions"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/network-suggestions":{"get":{"tags":["recruit"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid"},"profileId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"headline":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"partnerKinds":{"type":"array","items":{"type":"string"}},"categories":{"type":"array","items":{"type":"string"}},"score":{"type":"integer","minimum":0,"maximum":100},"reasons":{"type":"array","items":{"type":"string"}}},"required":["orgId","profileId","displayName","headline","country","website","partnerKinds","categories","score","reasons"],"additionalProperties":false}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/recruit/network-suggestions/add":{"post":{"tags":["recruit"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orgIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["orgIds"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer"},"duplicates":{"type":"integer"}},"required":["created","duplicates"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/application-form":{"get":{"tags":["application-form"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"title":{"type":"string"},"intro":{"type":"string","nullable":true},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","textarea","select","multi","url","email","number","country","checkbox","file"]},"required":{"type":"boolean","default":false},"help":{"type":"string","maxLength":500,"nullable":true},"placeholder":{"type":"string","maxLength":200,"nullable":true},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"showIf":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["equals","not_equals","in","filled","empty"]},"value":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false,"nullable":true},"mapTo":{"type":"string","enum":["country","website","motivation"],"nullable":true}},"required":["key","label","type"],"additionalProperties":false}},"autoApprove":{"type":"object","properties":{"enabled":{"type":"boolean","default":false},"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["in","not_in","equals","present","absent","gte","lte","contains"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false},"maxItems":20,"default":[]}},"additionalProperties":false},"status":{"type":"string","enum":["draft","published"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","title","intro","fields","autoApprove","status","createdAt","updatedAt"],"additionalProperties":false,"nullable":true}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"put":{"tags":["application-form"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"intro":{"type":"string","maxLength":4000,"nullable":true},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","textarea","select","multi","url","email","number","country","checkbox","file"]},"required":{"type":"boolean","default":false},"help":{"type":"string","maxLength":500,"nullable":true},"placeholder":{"type":"string","maxLength":200,"nullable":true},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"showIf":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["equals","not_equals","in","filled","empty"]},"value":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false,"nullable":true},"mapTo":{"type":"string","enum":["country","website","motivation"],"nullable":true}},"required":["key","label","type"],"additionalProperties":false},"maxItems":60},"autoApprove":{"type":"object","properties":{"enabled":{"type":"boolean","default":false},"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["in","not_in","equals","present","absent","gte","lte","contains"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false},"maxItems":20,"default":[]}},"additionalProperties":false},"status":{"type":"string","enum":["draft","published"]}},"required":["title","fields"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"key":{"type":"string"},"title":{"type":"string"},"intro":{"type":"string","nullable":true},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","textarea","select","multi","url","email","number","country","checkbox","file"]},"required":{"type":"boolean","default":false},"help":{"type":"string","maxLength":500,"nullable":true},"placeholder":{"type":"string","maxLength":200,"nullable":true},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"showIf":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["equals","not_equals","in","filled","empty"]},"value":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false,"nullable":true},"mapTo":{"type":"string","enum":["country","website","motivation"],"nullable":true}},"required":["key","label","type"],"additionalProperties":false}},"autoApprove":{"type":"object","properties":{"enabled":{"type":"boolean","default":false},"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["in","not_in","equals","present","absent","gte","lte","contains"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false},"maxItems":20,"default":[]}},"additionalProperties":false},"status":{"type":"string","enum":["draft","published"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","key","title","intro","fields","autoApprove","status","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/onboarding/applications/{id}/answers":{"get":{"tags":["onboarding"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"applicationId":{"type":"string","format":"uuid"},"formKey":{"type":"string","nullable":true},"answers":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"enum":["null"],"nullable":true}]}},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","textarea","select","multi","url","email","number","country","checkbox","file"]},"required":{"type":"boolean","default":false},"help":{"type":"string","maxLength":500,"nullable":true},"placeholder":{"type":"string","maxLength":200,"nullable":true},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"showIf":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["equals","not_equals","in","filled","empty"]},"value":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false,"nullable":true},"mapTo":{"type":"string","enum":["country","website","motivation"],"nullable":true}},"required":["key","label","type"],"additionalProperties":false}},"autoApproved":{"type":"boolean"},"autoApproveReasons":{"type":"array","items":{"type":"string"}},"prospectId":{"type":"string","format":"uuid","nullable":true}},"required":["applicationId","formKey","answers","fields","autoApproved","autoApproveReasons","prospectId"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/public/apply":{"get":{"tags":["public"],"parameters":[{"schema":{"type":"string","maxLength":100},"in":"query","name":"ref","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"invite","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"programInvite","required":false}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"string","format":"uuid","nullable":true},"programName":{"type":"string","nullable":true},"form":{"type":"object","properties":{"key":{"type":"string"},"title":{"type":"string"},"intro":{"type":"string","nullable":true},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["text","textarea","select","multi","url","email","number","country","checkbox","file"]},"required":{"type":"boolean","default":false},"help":{"type":"string","maxLength":500,"nullable":true},"placeholder":{"type":"string","maxLength":200,"nullable":true},"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"maxItems":50},"showIf":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":64},"op":{"type":"string","enum":["equals","not_equals","in","filled","empty"]},"value":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"required":["field","op"],"additionalProperties":false,"nullable":true},"mapTo":{"type":"string","enum":["country","website","motivation"],"nullable":true}},"required":["key","label","type"],"additionalProperties":false}}},"required":["key","title","intro","fields"],"additionalProperties":false,"nullable":true},"invite":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"website":{"type":"string","nullable":true}},"required":["name","email","company","website"],"additionalProperties":false,"nullable":true},"programs":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["id","name","description"],"additionalProperties":false},"default":[]},"programInvite":{"type":"object","properties":{"programId":{"type":"string","format":"uuid"},"programName":{"type":"string"},"valid":{"type":"boolean"},"reason":{"type":"string","nullable":true}},"required":["programId","programName","valid","reason"],"additionalProperties":false,"nullable":true,"default":null}},"required":["orgId","programName","form","invite"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["public"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"companyName":{"type":"string","minLength":1,"maxLength":200},"contactName":{"type":"string","minLength":1,"maxLength":200},"contactEmail":{"type":"string","format":"email"},"type":{"type":"string","enum":["agency","reseller","referral","technology","distributor","multiplier","var","msp","wholesaler","affiliate","influencer","ambassador","franchisee","franchise_developer","location_operator","broker","agent","training_center"]},"country":{"type":"string","maxLength":100,"nullable":true},"website":{"type":"string","format":"uri","nullable":true},"motivation":{"type":"string","maxLength":5000,"nullable":true},"managingOrgId":{"type":"string","format":"uuid","nullable":true},"inviteToken":{"type":"string","minLength":8,"maxLength":200,"nullable":true},"programId":{"type":"string","format":"uuid"},"programInviteToken":{"type":"string","minLength":8,"maxLength":200},"answers":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"array","items":{"type":"string"}},{"enum":["null"],"nullable":true}]},"default":{}}},"required":["companyName","contactName","contactEmail","type"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"stage":{"type":"string"},"autoApproved":{"type":"boolean"}},"required":["id","stage","autoApproved"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/comarketing/kits":{"post":{"tags":["comarketing"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"groupId":{"type":"string","format":"uuid"},"focus":{"type":"string","maxLength":1000},"items":{"type":"array","items":{"type":"string","enum":["landing","emails","social","one_pager"]},"minItems":1,"default":["landing","emails","social","one_pager"]},"useAi":{"type":"boolean","default":true}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["ai","template"]},"fallbackReason":{"type":"string","nullable":true},"kits":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"materials":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"templateId":{"type":"string","format":"uuid","nullable":true},"isTemplate":{"type":"boolean"},"productId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["deck","one_pager","case_study","email","proposal"]},"title":{"type":"string","minLength":1},"blocks":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["heading","text","bullets","image","stat","quote"]},"title":{"type":"string"},"body":{"type":"string"},"items":{"type":"array","items":{"type":"string"}},"imageUrl":{"type":"string"}},"required":["id","type"],"additionalProperties":false}},"status":{"type":"string","enum":["draft","published","archived"]},"shareToken":{"type":"string","nullable":true},"folderId":{"type":"string","format":"uuid","nullable":true},"createdById":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","partnerId","templateId","isTemplate","productId","kind","title","blocks","status","shareToken","folderId","createdById","createdAt","updatedAt"],"additionalProperties":false}}},"required":["partnerId","partnerName","materials"],"additionalProperties":false}}},"required":["source","fallbackReason","kits"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/comarketing/requests":{"get":{"tags":["comarketing"],"parameters":[{"schema":{"type":"string","enum":["pending","approved","rejected"]},"in":"query","name":"status","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"focus":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","approved","rejected"]},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"createdAt":{"type":"string"},"decidedAt":{"type":"string","nullable":true}},"required":["id","partnerId","partnerName","note","focus","status","materialIds","createdAt","decidedAt"],"additionalProperties":false}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/comarketing/requests/{id}/decision":{"post":{"tags":["comarketing"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string","maxLength":2000}},"required":["decision"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"focus":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","approved","rejected"]},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"createdAt":{"type":"string"},"decidedAt":{"type":"string","nullable":true}},"required":["id","partnerId","partnerName","note","focus","status","materialIds","createdAt","decidedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/comarketing/requests":{"get":{"tags":["portal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"focus":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","approved","rejected"]},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"createdAt":{"type":"string"},"decidedAt":{"type":"string","nullable":true}},"required":["id","partnerId","partnerName","note","focus","status","materialIds","createdAt","decidedAt"],"additionalProperties":false}}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["portal"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"focus":{"type":"string","maxLength":1000},"note":{"type":"string","maxLength":2000}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"note":{"type":"string","nullable":true},"focus":{"type":"string","nullable":true},"status":{"type":"string","enum":["pending","approved","rejected"]},"materialIds":{"type":"array","items":{"type":"string","format":"uuid"}},"createdAt":{"type":"string"},"decidedAt":{"type":"string","nullable":true}},"required":["id","partnerId","partnerName","note","focus","status","materialIds","createdAt","decidedAt"],"additionalProperties":false}}}},"400":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/challenges":{"get":{"tags":["challenges"],"parameters":[{"schema":{"type":"string","enum":["draft","live","judging","closed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["sales","activity","submission","poll"]},"in":"query","name":"kind","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["challenges"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":10000,"nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"],"default":"sales"},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false,"default":{}},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false},"maxItems":20,"default":[]},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false,"default":{}},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false},"maxItems":20,"default":[]},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true}},"required":["title"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/challenges/{id}":{"get":{"tags":["challenges"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["challenges"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":10000,"nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"],"default":"sales"},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false,"default":{}},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false},"maxItems":20,"default":[]},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false,"default":{}},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false},"maxItems":20,"default":[]},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["challenges"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/challenges/{id}/publish":{"post":{"tags":["challenges"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/challenges/{id}/settle":{"post":{"tags":["challenges"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"challenge":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt"],"additionalProperties":false},"rewarded":{"type":"integer"}},"required":["challenge","rewarded"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/challenges/{id}/entries":{"get":{"tags":["challenges"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"challengeId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"payload":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10},"optionId":{"type":"string","maxLength":40},"judgeNote":{"type":"string","maxLength":2000}},"additionalProperties":false},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"rewardedAt":{"type":"string","nullable":true},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","challengeId","partnerId","partnerName","payload","score","rank","status","rewardedAt","rewardRef","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/challenges/{id}/entries/{entryId}/judge":{"post":{"tags":["challenges"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["approved","rejected"]},"score":{"type":"number","minimum":0},"note":{"type":"string","maxLength":2000}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"entryId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"challengeId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"payload":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10},"optionId":{"type":"string","maxLength":40},"judgeNote":{"type":"string","maxLength":2000}},"additionalProperties":false},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"rewardedAt":{"type":"string","nullable":true},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","challengeId","partnerId","partnerName","payload","score","rank","status","rewardedAt","rewardRef","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/challenges/{id}/leaderboard":{"get":{"tags":["challenges"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"challengeId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","live","judging","closed"]},"rows":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"isMe":{"type":"boolean"},"rewarded":{"type":"boolean"}},"required":["partnerId","partnerName","score","rank","status","isMe","rewarded"],"additionalProperties":false}},"tally":{"type":"array","items":{"type":"object","properties":{"optionId":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["optionId","label","votes"],"additionalProperties":false},"nullable":true},"computedAt":{"type":"string"}},"required":["challengeId","status","rows","tally","computedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/challenges":{"get":{"tags":["portal"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"},"myEntry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"challengeId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"payload":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10},"optionId":{"type":"string","maxLength":40},"judgeNote":{"type":"string","maxLength":2000}},"additionalProperties":false},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"rewardedAt":{"type":"string","nullable":true},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","challengeId","partnerId","partnerName","payload","score","rank","status","rewardedAt","rewardRef","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"eligible":{"type":"boolean"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt","myEntry","eligible"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/challenges/{id}":{"get":{"tags":["portal"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"},"myEntry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"challengeId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"payload":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10},"optionId":{"type":"string","maxLength":40},"judgeNote":{"type":"string","maxLength":2000}},"additionalProperties":false},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"rewardedAt":{"type":"string","nullable":true},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","challengeId","partnerId","partnerName","payload","score","rank","status","rewardedAt","rewardRef","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"eligible":{"type":"boolean"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt","myEntry","eligible"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/challenges/{id}/join":{"post":{"tags":["portal"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"},"myEntry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"challengeId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"payload":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10},"optionId":{"type":"string","maxLength":40},"judgeNote":{"type":"string","maxLength":2000}},"additionalProperties":false},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"rewardedAt":{"type":"string","nullable":true},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","challengeId","partnerId","partnerName","payload","score","rank","status","rewardedAt","rewardRef","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"eligible":{"type":"boolean"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt","myEntry","eligible"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/challenges/{id}/submit":{"post":{"tags":["portal"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"},"myEntry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"challengeId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"payload":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10},"optionId":{"type":"string","maxLength":40},"judgeNote":{"type":"string","maxLength":2000}},"additionalProperties":false},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"rewardedAt":{"type":"string","nullable":true},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","challengeId","partnerId","partnerName","payload","score","rank","status","rewardedAt","rewardRef","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"eligible":{"type":"boolean"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt","myEntry","eligible"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/challenges/{id}/vote":{"post":{"tags":["portal"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"optionId":{"type":"string","minLength":1,"maxLength":40}},"required":["optionId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"kind":{"type":"string","enum":["sales","activity","submission","poll"]},"metric":{"type":"object","properties":{"source":{"type":"string","enum":["deals_won_count","deals_won_amount","conversions","lessons_completed","leads_submitted"]},"target":{"type":"number","minimum":0,"nullable":true},"maxScore":{"type":"number","exclusiveMinimum":true,"minimum":0,"nullable":true}},"additionalProperties":false},"rewards":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["money","points","mission"]},"label":{"type":"string","maxLength":120,"nullable":true},"fromRank":{"type":"integer","minimum":1,"nullable":true},"toRank":{"type":"integer","minimum":1,"nullable":true},"minScore":{"type":"number","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"nullable":true},"points":{"type":"integer","exclusiveMinimum":true,"minimum":0,"nullable":true},"missionId":{"type":"string","format":"uuid","nullable":true}},"required":["kind"],"additionalProperties":false}},"audience":{"type":"object","properties":{"all":{"type":"boolean","default":true},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"tiers":{"type":"array","items":{"type":"string"},"default":[]},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]}},"additionalProperties":false},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":40},"label":{"type":"string","minLength":1,"maxLength":200}},"required":["id","label"],"additionalProperties":false}},"startsAt":{"type":"string","nullable":true},"endsAt":{"type":"string","nullable":true},"status":{"type":"string","enum":["draft","live","judging","closed"]},"settledAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"entrants":{"type":"integer"},"myEntry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"challengeId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"payload":{"type":"object","properties":{"text":{"type":"string","maxLength":10000},"url":{"type":"string","format":"uri","maxLength":2000},"files":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","maxLength":2000},"name":{"type":"string","maxLength":300}},"required":["url","name"],"additionalProperties":false},"maxItems":10},"optionId":{"type":"string","maxLength":40},"judgeNote":{"type":"string","maxLength":2000}},"additionalProperties":false},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"rewardedAt":{"type":"string","nullable":true},"rewardRef":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","challengeId","partnerId","partnerName","payload","score","rank","status","rewardedAt","rewardRef","createdAt","updatedAt"],"additionalProperties":false,"nullable":true},"eligible":{"type":"boolean"}},"required":["id","orgId","title","description","kind","metric","rewards","audience","options","startsAt","endsAt","status","settledAt","createdAt","updatedAt","myEntry","eligible"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/portal/challenges/{id}/leaderboard":{"get":{"tags":["portal"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"challengeId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["draft","live","judging","closed"]},"rows":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"score":{"type":"number"},"rank":{"type":"integer","nullable":true},"status":{"type":"string","enum":["active","submitted","approved","rejected","winner"]},"isMe":{"type":"boolean"},"rewarded":{"type":"boolean"}},"required":["partnerId","partnerName","score","rank","status","isMe","rewarded"],"additionalProperties":false}},"tally":{"type":"array","items":{"type":"object","properties":{"optionId":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["optionId","label","votes"],"additionalProperties":false},"nullable":true},"computedAt":{"type":"string"}},"required":["challengeId","status","rows","tally","computedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/claim":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":10,"maxLength":400}},"required":["token"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expiresAt":{"type":"string","format":"date-time"},"spaceId":{"type":"string","format":"uuid"},"spaceSlug":{"type":"string"},"memberId":{"type":"string","format":"uuid"},"brand":{"type":"object","properties":{"name":{"type":"string"},"color":{"type":"string"},"logoUrl":{"type":"string","nullable":true}},"required":["name","color","logoUrl"],"additionalProperties":false}},"required":["token","expiresAt","spaceId","spaceSlug","memberId","brand"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/magic-link":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email","maxLength":320},"spaceSlug":{"type":"string","minLength":1,"maxLength":60}},"required":["email","spaceSlug"],"additionalProperties":false}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}}}}},"/api/community/spaces":{"get":{"tags":["community"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["partner","customer","mixed"]},"visibility":{"type":"string","enum":["private","open"]},"coverUrl":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"settings":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false},"minItems":1,"maxItems":20,"default":[{"level":1,"name":"Newcomer","minPoints":0},{"level":2,"name":"Contributor","minPoints":5},{"level":3,"name":"Regular","minPoints":20},{"level":4,"name":"Insider","minPoints":65},{"level":5,"name":"Expert","minPoints":155},{"level":6,"name":"Mentor","minPoints":515},{"level":7,"name":"Champion","minPoints":2015},{"level":8,"name":"Legend","minPoints":8015},{"level":9,"name":"Hall of Fame","minPoints":33015}]},"pointsPerLike":{"type":"integer","minimum":0,"maximum":100,"default":1},"rules":{"type":"string","maxLength":5000,"nullable":true,"default":null},"welcome":{"type":"string","maxLength":5000,"nullable":true,"default":null},"digestEnabled":{"type":"boolean","default":true},"autoModerate":{"type":"boolean","default":true}},"additionalProperties":false},"status":{"type":"string","enum":["active","archived"]},"position":{"type":"integer"},"memberCount":{"type":"integer"},"postCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","orgId","slug","name","description","audience","visibility","coverUrl","icon","settings","status","position","memberCount","postCount","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":{"type":"string","maxLength":2000,"nullable":true},"audience":{"type":"string","enum":["partner","customer","mixed"],"default":"partner"},"visibility":{"type":"string","enum":["private","open"],"default":"private"},"coverUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"icon":{"type":"string","maxLength":40,"nullable":true},"settings":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false},"minItems":1,"maxItems":20,"default":[{"level":1,"name":"Newcomer","minPoints":0},{"level":2,"name":"Contributor","minPoints":5},{"level":3,"name":"Regular","minPoints":20},{"level":4,"name":"Insider","minPoints":65},{"level":5,"name":"Expert","minPoints":155},{"level":6,"name":"Mentor","minPoints":515},{"level":7,"name":"Champion","minPoints":2015},{"level":8,"name":"Legend","minPoints":8015},{"level":9,"name":"Hall of Fame","minPoints":33015}]},"pointsPerLike":{"type":"integer","minimum":0,"maximum":100,"default":1},"rules":{"type":"string","maxLength":5000,"nullable":true,"default":null},"welcome":{"type":"string","maxLength":5000,"nullable":true,"default":null},"digestEnabled":{"type":"boolean","default":true},"autoModerate":{"type":"boolean","default":true}},"additionalProperties":false}},"required":["name"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["partner","customer","mixed"]},"visibility":{"type":"string","enum":["private","open"]},"coverUrl":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"settings":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false},"minItems":1,"maxItems":20,"default":[{"level":1,"name":"Newcomer","minPoints":0},{"level":2,"name":"Contributor","minPoints":5},{"level":3,"name":"Regular","minPoints":20},{"level":4,"name":"Insider","minPoints":65},{"level":5,"name":"Expert","minPoints":155},{"level":6,"name":"Mentor","minPoints":515},{"level":7,"name":"Champion","minPoints":2015},{"level":8,"name":"Legend","minPoints":8015},{"level":9,"name":"Hall of Fame","minPoints":33015}]},"pointsPerLike":{"type":"integer","minimum":0,"maximum":100,"default":1},"rules":{"type":"string","maxLength":5000,"nullable":true,"default":null},"welcome":{"type":"string","maxLength":5000,"nullable":true,"default":null},"digestEnabled":{"type":"boolean","default":true},"autoModerate":{"type":"boolean","default":true}},"additionalProperties":false},"status":{"type":"string","enum":["active","archived"]},"position":{"type":"integer"},"memberCount":{"type":"integer"},"postCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","orgId","slug","name","description","audience","visibility","coverUrl","icon","settings","status","position","memberCount","postCount","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{id}":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["partner","customer","mixed"]},"visibility":{"type":"string","enum":["private","open"]},"coverUrl":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"settings":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false},"minItems":1,"maxItems":20,"default":[{"level":1,"name":"Newcomer","minPoints":0},{"level":2,"name":"Contributor","minPoints":5},{"level":3,"name":"Regular","minPoints":20},{"level":4,"name":"Insider","minPoints":65},{"level":5,"name":"Expert","minPoints":155},{"level":6,"name":"Mentor","minPoints":515},{"level":7,"name":"Champion","minPoints":2015},{"level":8,"name":"Legend","minPoints":8015},{"level":9,"name":"Hall of Fame","minPoints":33015}]},"pointsPerLike":{"type":"integer","minimum":0,"maximum":100,"default":1},"rules":{"type":"string","maxLength":5000,"nullable":true,"default":null},"welcome":{"type":"string","maxLength":5000,"nullable":true,"default":null},"digestEnabled":{"type":"boolean","default":true},"autoModerate":{"type":"boolean","default":true}},"additionalProperties":false},"status":{"type":"string","enum":["active","archived"]},"position":{"type":"integer"},"memberCount":{"type":"integer"},"postCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","orgId","slug","name","description","audience","visibility","coverUrl","icon","settings","status","position","memberCount","postCount","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"slug":{"type":"string","minLength":2,"maxLength":60,"pattern":"^[a-z0-9]+(?:-[a-z0-9]+)*$"},"description":{"type":"string","maxLength":2000,"nullable":true},"audience":{"type":"string","enum":["partner","customer","mixed"]},"visibility":{"type":"string","enum":["private","open"]},"coverUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"icon":{"type":"string","maxLength":40,"nullable":true},"status":{"type":"string","enum":["active","archived"]},"position":{"type":"integer"},"settings":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false},"minItems":1,"maxItems":20,"default":[{"level":1,"name":"Newcomer","minPoints":0},{"level":2,"name":"Contributor","minPoints":5},{"level":3,"name":"Regular","minPoints":20},{"level":4,"name":"Insider","minPoints":65},{"level":5,"name":"Expert","minPoints":155},{"level":6,"name":"Mentor","minPoints":515},{"level":7,"name":"Champion","minPoints":2015},{"level":8,"name":"Legend","minPoints":8015},{"level":9,"name":"Hall of Fame","minPoints":33015}]},"pointsPerLike":{"type":"integer","minimum":0,"maximum":100,"default":1},"rules":{"type":"string","maxLength":5000,"nullable":true,"default":null},"welcome":{"type":"string","maxLength":5000,"nullable":true,"default":null},"digestEnabled":{"type":"boolean","default":true},"autoModerate":{"type":"boolean","default":true}},"additionalProperties":false}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["partner","customer","mixed"]},"visibility":{"type":"string","enum":["private","open"]},"coverUrl":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"settings":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false},"minItems":1,"maxItems":20,"default":[{"level":1,"name":"Newcomer","minPoints":0},{"level":2,"name":"Contributor","minPoints":5},{"level":3,"name":"Regular","minPoints":20},{"level":4,"name":"Insider","minPoints":65},{"level":5,"name":"Expert","minPoints":155},{"level":6,"name":"Mentor","minPoints":515},{"level":7,"name":"Champion","minPoints":2015},{"level":8,"name":"Legend","minPoints":8015},{"level":9,"name":"Hall of Fame","minPoints":33015}]},"pointsPerLike":{"type":"integer","minimum":0,"maximum":100,"default":1},"rules":{"type":"string","maxLength":5000,"nullable":true,"default":null},"welcome":{"type":"string","maxLength":5000,"nullable":true,"default":null},"digestEnabled":{"type":"boolean","default":true},"autoModerate":{"type":"boolean","default":true}},"additionalProperties":false},"status":{"type":"string","enum":["active","archived"]},"position":{"type":"integer"},"memberCount":{"type":"integer"},"postCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","orgId","slug","name","description","audience","visibility","coverUrl","icon","settings","status","position","memberCount","postCount","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/categories":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"icon":{"type":"string","maxLength":40,"nullable":true},"adminOnly":{"type":"boolean","default":false},"position":{"type":"integer"}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"name":{"type":"string"},"icon":{"type":"string","nullable":true},"adminOnly":{"type":"boolean"},"position":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","name","icon","adminOnly","position","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/categories/{id}":{"patch":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"icon":{"type":"string","maxLength":40,"nullable":true},"adminOnly":{"type":"boolean","default":false},"position":{"type":"integer"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"name":{"type":"string"},"icon":{"type":"string","nullable":true},"adminOnly":{"type":"boolean"},"position":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","name","icon","adminOnly","position","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/members/invite":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"emails":{"type":"array","items":{"type":"string","format":"email","maxLength":320},"minItems":1,"maxItems":500},"kind":{"type":"string","enum":["operator","partner","customer"],"default":"customer"},"role":{"type":"string","enum":["owner","admin","moderator","member"],"default":"member"},"sendEmail":{"type":"boolean","default":true}},"required":["emails"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"added":{"type":"integer"},"invited":{"type":"integer"},"skipped":{"type":"integer"}},"required":["added","invited","skipped"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/members/bulk":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"allPartners":{"type":"boolean","default":false},"partnerIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000,"default":[]},"groupIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":100,"default":[]},"customerIds":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":1000,"default":[]},"sendEmail":{"type":"boolean","default":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"added":{"type":"integer"},"invited":{"type":"integer"},"skipped":{"type":"integer"}},"required":["added","invited","skipped"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/members/{id}":{"patch":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"type":"string","enum":["owner","admin","moderator","member"]},"status":{"type":"string","enum":["active","banned"]},"displayName":{"type":"string","minLength":1,"maxLength":80}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid","nullable":true},"email":{"type":"string","nullable":true},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"kind":{"type":"string","enum":["operator","partner","customer"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"role":{"type":"string","enum":["owner","admin","moderator","member"]},"status":{"type":"string","enum":["invited","pending","active","banned"]},"points":{"type":"integer"},"level":{"type":"integer"},"levelName":{"type":"string"},"lastActiveAt":{"type":"string","format":"date-time","nullable":true},"joinedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","userId","email","displayName","avatarUrl","bio","kind","partnerId","customerId","role","status","points","level","levelName","lastActiveAt","joinedAt","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/members/{id}/resend":{"post":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/classroom":{"put":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"courseId":{"type":"string","format":"uuid"},"attached":{"type":"boolean","default":true},"unlockLevel":{"type":"integer","minimum":1,"maximum":99,"nullable":true,"default":null}},"required":["courseId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"courseId":{"type":"string","format":"uuid"},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"lessonCount":{"type":"integer"},"status":{"type":"string"},"unlockLevel":{"type":"integer","nullable":true},"locked":{"type":"boolean"},"progressPct":{"type":"integer","nullable":true}},"required":["courseId","title","summary","coverUrl","lessonCount","status","unlockLevel","locked","progressPct"],"additionalProperties":false}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"courseId":{"type":"string","format":"uuid"},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"lessonCount":{"type":"integer"},"status":{"type":"string"},"unlockLevel":{"type":"integer","nullable":true},"locked":{"type":"boolean"},"progressPct":{"type":"integer","nullable":true}},"required":["courseId","title","summary","coverUrl","lessonCount","status","unlockLevel","locked","progressPct"],"additionalProperties":false}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/events":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":5000,"nullable":true},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","maxLength":60,"nullable":true},"location":{"type":"string","maxLength":2000,"nullable":true},"recurrence":{"type":"string","maxLength":500,"nullable":true},"minLevel":{"type":"integer","minimum":1,"maximum":99,"nullable":true},"recordingUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true}},"required":["title","startsAt"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"recurrence":{"type":"string","nullable":true},"minLevel":{"type":"integer","nullable":true},"recordingUrl":{"type":"string","nullable":true},"goingCount":{"type":"integer"},"myRsvp":{"type":"string","enum":["going","maybe","declined"],"nullable":true},"locked":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","title","description","startsAt","endsAt","timezone","location","recurrence","minLevel","recordingUrl","goingCount","myRsvp","locked","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","enum":["upcoming","past","all"],"default":"upcoming"},"in":"query","name":"when","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"recurrence":{"type":"string","nullable":true},"minLevel":{"type":"integer","nullable":true},"recordingUrl":{"type":"string","nullable":true},"goingCount":{"type":"integer"},"myRsvp":{"type":"string","enum":["going","maybe","declined"],"nullable":true},"locked":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","title","description","startsAt","endsAt","timezone","location","recurrence","minLevel","recordingUrl","goingCount","myRsvp","locked","createdAt"],"additionalProperties":false}}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/events/{id}":{"patch":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":5000,"nullable":true},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","maxLength":60,"nullable":true},"location":{"type":"string","maxLength":2000,"nullable":true},"recurrence":{"type":"string","maxLength":500,"nullable":true},"minLevel":{"type":"integer","minimum":1,"maximum":99,"nullable":true},"recordingUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"recurrence":{"type":"string","nullable":true},"minLevel":{"type":"integer","nullable":true},"recordingUrl":{"type":"string","nullable":true},"goingCount":{"type":"integer"},"myRsvp":{"type":"string","enum":["going","maybe","declined"],"nullable":true},"locked":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","title","description","startsAt","endsAt","timezone","location","recurrence","minLevel","recordingUrl","goingCount","myRsvp","locked","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/analytics":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"object","properties":{"total":{"type":"integer"},"active":{"type":"integer"},"invited":{"type":"integer"},"banned":{"type":"integer"}},"required":["total","active","invited","banned"],"additionalProperties":false},"activeMembers7d":{"type":"integer"},"activeMembers30d":{"type":"integer"},"posts7d":{"type":"integer"},"posts30d":{"type":"integer"},"comments7d":{"type":"integer"},"likes7d":{"type":"integer"},"engagementPct":{"type":"integer"},"hiddenPosts":{"type":"integer"},"postsByDay":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string"},"posts":{"type":"integer"},"comments":{"type":"integer"}},"required":["date","posts","comments"],"additionalProperties":false}},"topContributors":{"type":"array","items":{"type":"object","properties":{"member":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"points":{"type":"integer"}},"required":["member","points"],"additionalProperties":false}}},"required":["members","activeMembers7d","activeMembers30d","posts7d","posts30d","comments7d","likes7d","engagementPct","hiddenPosts","postsByDay","topContributors"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/digest":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"send":{"type":"boolean","default":false}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"},"source":{"type":"string","enum":["ai","fallback"]},"sentTo":{"type":"integer"}},"required":["subject","body","source","sentTo"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/home":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"space":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"audience":{"type":"string","enum":["partner","customer","mixed"]},"visibility":{"type":"string","enum":["private","open"]},"coverUrl":{"type":"string","nullable":true},"icon":{"type":"string","nullable":true},"settings":{"type":"object","properties":{"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false},"minItems":1,"maxItems":20,"default":[{"level":1,"name":"Newcomer","minPoints":0},{"level":2,"name":"Contributor","minPoints":5},{"level":3,"name":"Regular","minPoints":20},{"level":4,"name":"Insider","minPoints":65},{"level":5,"name":"Expert","minPoints":155},{"level":6,"name":"Mentor","minPoints":515},{"level":7,"name":"Champion","minPoints":2015},{"level":8,"name":"Legend","minPoints":8015},{"level":9,"name":"Hall of Fame","minPoints":33015}]},"pointsPerLike":{"type":"integer","minimum":0,"maximum":100,"default":1},"rules":{"type":"string","maxLength":5000,"nullable":true,"default":null},"welcome":{"type":"string","maxLength":5000,"nullable":true,"default":null},"digestEnabled":{"type":"boolean","default":true},"autoModerate":{"type":"boolean","default":true}},"additionalProperties":false},"status":{"type":"string","enum":["active","archived"]},"position":{"type":"integer"},"memberCount":{"type":"integer"},"postCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","orgId","slug","name","description","audience","visibility","coverUrl","icon","settings","status","position","memberCount","postCount","createdAt","updatedAt"],"additionalProperties":false},"me":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid","nullable":true},"email":{"type":"string","nullable":true},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"kind":{"type":"string","enum":["operator","partner","customer"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"role":{"type":"string","enum":["owner","admin","moderator","member"]},"status":{"type":"string","enum":["invited","pending","active","banned"]},"points":{"type":"integer"},"level":{"type":"integer"},"levelName":{"type":"string"},"lastActiveAt":{"type":"string","format":"date-time","nullable":true},"joinedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","userId","email","displayName","avatarUrl","bio","kind","partnerId","customerId","role","status","points","level","levelName","lastActiveAt","joinedAt","createdAt"],"additionalProperties":false},"progress":{"type":"object","properties":{"level":{"type":"integer"},"name":{"type":"string"},"points":{"type":"integer"},"nextLevel":{"type":"integer","nullable":true},"nextName":{"type":"string","nullable":true},"pointsToNext":{"type":"integer","nullable":true},"pct":{"type":"integer"}},"required":["level","name","points","nextLevel","nextName","pointsToNext","pct"],"additionalProperties":false},"categories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"name":{"type":"string"},"icon":{"type":"string","nullable":true},"adminOnly":{"type":"boolean"},"position":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","name","icon","adminOnly","position","createdAt"],"additionalProperties":false}},"levels":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer","minimum":1,"maximum":99},"name":{"type":"string","minLength":1,"maxLength":60},"minPoints":{"type":"integer","minimum":0}},"required":["level","name","minPoints"],"additionalProperties":false}},"isModerator":{"type":"boolean"},"emailAnnouncements":{"type":"boolean"},"brand":{"type":"object","properties":{"name":{"type":"string"},"color":{"type":"string"},"logoUrl":{"type":"string","nullable":true}},"required":["name","color","logoUrl"],"additionalProperties":false}},"required":["space","me","progress","categories","levels","isModerator","emailAnnouncements","brand"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/me":{"patch":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"displayName":{"type":"string","minLength":1,"maxLength":80},"bio":{"type":"string","maxLength":1000,"nullable":true},"avatarUrl":{"type":"string","format":"uri","maxLength":2000,"nullable":true},"emailAnnouncements":{"type":"boolean"}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid","nullable":true},"email":{"type":"string","nullable":true},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"kind":{"type":"string","enum":["operator","partner","customer"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"role":{"type":"string","enum":["owner","admin","moderator","member"]},"status":{"type":"string","enum":["invited","pending","active","banned"]},"points":{"type":"integer"},"level":{"type":"integer"},"levelName":{"type":"string"},"lastActiveAt":{"type":"string","format":"date-time","nullable":true},"joinedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","userId","email","displayName","avatarUrl","bio","kind","partnerId","customerId","role","status","points","level","levelName","lastActiveAt","joinedAt","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/posts":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"categoryId","required":false},{"schema":{"type":"string","enum":["default","new","top"],"default":"default"},"in":"query","name":"sort","required":false},{"schema":{"type":"string","enum":["post","announcement","poll","question"]},"in":"query","name":"kind","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"q","required":false},{"schema":{"type":"string","enum":["published","hidden"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"categoryId":{"type":"string","format":"uuid","nullable":true},"categoryName":{"type":"string","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"kind":{"type":"string","enum":["post","announcement","poll","question"]},"title":{"type":"string"},"body":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{}}},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["id","label","votes"],"additionalProperties":false}},"closesAt":{"type":"string","format":"date-time","nullable":true},"totalVotes":{"type":"integer"},"myVote":{"type":"string","nullable":true}},"required":["options","closesAt","totalVotes","myVote"],"additionalProperties":false,"nullable":true},"pinned":{"type":"boolean"},"likeCount":{"type":"integer"},"commentCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"acceptedCommentId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["published","hidden","deleted"]},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","categoryId","categoryName","author","kind","title","body","attachments","poll","pinned","likeCount","commentCount","likedByMe","acceptedCommentId","status","lastActivityAt","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","maxLength":20000,"default":""},"categoryId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string","enum":["post","announcement","poll","question"],"default":"post"},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"string","minLength":1,"maxLength":120},"minItems":2,"maxItems":10},"closesAt":{"type":"string","format":"date-time","nullable":true}},"required":["options"],"additionalProperties":false},"attachments":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":2000},"name":{"type":"string","maxLength":200}},"required":["url"],"additionalProperties":false},"maxItems":10}},"required":["title"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"categoryId":{"type":"string","format":"uuid","nullable":true},"categoryName":{"type":"string","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"kind":{"type":"string","enum":["post","announcement","poll","question"]},"title":{"type":"string"},"body":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{}}},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["id","label","votes"],"additionalProperties":false}},"closesAt":{"type":"string","format":"date-time","nullable":true},"totalVotes":{"type":"integer"},"myVote":{"type":"string","nullable":true}},"required":["options","closesAt","totalVotes","myVote"],"additionalProperties":false,"nullable":true},"pinned":{"type":"boolean"},"likeCount":{"type":"integer"},"commentCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"acceptedCommentId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["published","hidden","deleted"]},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","categoryId","categoryName","author","kind","title","body","attachments","poll","pinned","likeCount","commentCount","likedByMe","acceptedCommentId","status","lastActivityAt","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/posts/{id}":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"categoryId":{"type":"string","format":"uuid","nullable":true},"categoryName":{"type":"string","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"kind":{"type":"string","enum":["post","announcement","poll","question"]},"title":{"type":"string"},"body":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{}}},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["id","label","votes"],"additionalProperties":false}},"closesAt":{"type":"string","format":"date-time","nullable":true},"totalVotes":{"type":"integer"},"myVote":{"type":"string","nullable":true}},"required":["options","closesAt","totalVotes","myVote"],"additionalProperties":false,"nullable":true},"pinned":{"type":"boolean"},"likeCount":{"type":"integer"},"commentCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"acceptedCommentId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["published","hidden","deleted"]},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"comments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"postId":{"type":"string","format":"uuid"},"parentId":{"type":"string","format":"uuid","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"body":{"type":"string"},"likeCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"status":{"type":"string","enum":["published","hidden","deleted"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","postId","parentId","author","body","likeCount","likedByMe","status","createdAt"],"additionalProperties":false}}},"required":["id","spaceId","categoryId","categoryName","author","kind","title","body","attachments","poll","pinned","likeCount","commentCount","likedByMe","acceptedCommentId","status","lastActivityAt","createdAt","updatedAt","comments"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","maxLength":20000},"categoryId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"categoryId":{"type":"string","format":"uuid","nullable":true},"categoryName":{"type":"string","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"kind":{"type":"string","enum":["post","announcement","poll","question"]},"title":{"type":"string"},"body":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{}}},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["id","label","votes"],"additionalProperties":false}},"closesAt":{"type":"string","format":"date-time","nullable":true},"totalVotes":{"type":"integer"},"myVote":{"type":"string","nullable":true}},"required":["options","closesAt","totalVotes","myVote"],"additionalProperties":false,"nullable":true},"pinned":{"type":"boolean"},"likeCount":{"type":"integer"},"commentCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"acceptedCommentId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["published","hidden","deleted"]},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","categoryId","categoryName","author","kind","title","body","attachments","poll","pinned","likeCount","commentCount","likedByMe","acceptedCommentId","status","lastActivityAt","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/posts/{postId}/comments":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":10000},"parentId":{"type":"string","format":"uuid","nullable":true}},"required":["body"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"postId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"postId":{"type":"string","format":"uuid"},"parentId":{"type":"string","format":"uuid","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"body":{"type":"string"},"likeCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"status":{"type":"string","enum":["published","hidden","deleted"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","postId","parentId","author","body","likeCount","likedByMe","status","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/posts/{id}/like":{"post":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"liked":{"type":"boolean"},"likeCount":{"type":"integer"}},"required":["liked","likeCount"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"liked":{"type":"boolean"},"likeCount":{"type":"integer"}},"required":["liked","likeCount"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/comments/{id}/like":{"post":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"liked":{"type":"boolean"},"likeCount":{"type":"integer"}},"required":["liked","likeCount"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"liked":{"type":"boolean"},"likeCount":{"type":"integer"}},"required":["liked","likeCount"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/posts/{postId}/vote":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"optionId":{"type":"string","minLength":1,"maxLength":40}},"required":["optionId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"postId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"categoryId":{"type":"string","format":"uuid","nullable":true},"categoryName":{"type":"string","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"kind":{"type":"string","enum":["post","announcement","poll","question"]},"title":{"type":"string"},"body":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{}}},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["id","label","votes"],"additionalProperties":false}},"closesAt":{"type":"string","format":"date-time","nullable":true},"totalVotes":{"type":"integer"},"myVote":{"type":"string","nullable":true}},"required":["options","closesAt","totalVotes","myVote"],"additionalProperties":false,"nullable":true},"pinned":{"type":"boolean"},"likeCount":{"type":"integer"},"commentCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"acceptedCommentId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["published","hidden","deleted"]},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","categoryId","categoryName","author","kind","title","body","attachments","poll","pinned","likeCount","commentCount","likedByMe","acceptedCommentId","status","lastActivityAt","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/posts/{postId}/accept":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"commentId":{"type":"string","format":"uuid","nullable":true}},"required":["commentId"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"postId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"categoryId":{"type":"string","format":"uuid","nullable":true},"categoryName":{"type":"string","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"kind":{"type":"string","enum":["post","announcement","poll","question"]},"title":{"type":"string"},"body":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{}}},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["id","label","votes"],"additionalProperties":false}},"closesAt":{"type":"string","format":"date-time","nullable":true},"totalVotes":{"type":"integer"},"myVote":{"type":"string","nullable":true}},"required":["options","closesAt","totalVotes","myVote"],"additionalProperties":false,"nullable":true},"pinned":{"type":"boolean"},"likeCount":{"type":"integer"},"commentCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"acceptedCommentId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["published","hidden","deleted"]},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","categoryId","categoryName","author","kind","title","body","attachments","poll","pinned","likeCount","commentCount","likedByMe","acceptedCommentId","status","lastActivityAt","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/posts/{id}/moderate":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["hide","unhide","pin","unpin","delete"]}},"required":["action"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"categoryId":{"type":"string","format":"uuid","nullable":true},"categoryName":{"type":"string","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"kind":{"type":"string","enum":["post","announcement","poll","question"]},"title":{"type":"string"},"body":{"type":"string"},"attachments":{"type":"array","items":{"type":"object","additionalProperties":{}}},"poll":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"votes":{"type":"integer"}},"required":["id","label","votes"],"additionalProperties":false}},"closesAt":{"type":"string","format":"date-time","nullable":true},"totalVotes":{"type":"integer"},"myVote":{"type":"string","nullable":true}},"required":["options","closesAt","totalVotes","myVote"],"additionalProperties":false,"nullable":true},"pinned":{"type":"boolean"},"likeCount":{"type":"integer"},"commentCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"acceptedCommentId":{"type":"string","format":"uuid","nullable":true},"status":{"type":"string","enum":["published","hidden","deleted"]},"lastActivityAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","categoryId","categoryName","author","kind","title","body","attachments","poll","pinned","likeCount","commentCount","likedByMe","acceptedCommentId","status","lastActivityAt","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/comments/{id}/moderate":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["hide","unhide","delete"]}},"required":["action"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"postId":{"type":"string","format":"uuid"},"parentId":{"type":"string","format":"uuid","nullable":true},"author":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"body":{"type":"string"},"likeCount":{"type":"integer"},"likedByMe":{"type":"boolean"},"status":{"type":"string","enum":["published","hidden","deleted"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","postId","parentId","author","body","likeCount","likedByMe","status","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/members":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"in":"query","name":"pageSize","required":false},{"schema":{"type":"string","minLength":1,"maxLength":200},"in":"query","name":"search","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"q","required":false},{"schema":{"type":"string","enum":["invited","pending","active","banned"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["operator","partner","customer"]},"in":"query","name":"kind","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"userId":{"type":"string","format":"uuid","nullable":true},"email":{"type":"string","nullable":true},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"bio":{"type":"string","nullable":true},"kind":{"type":"string","enum":["operator","partner","customer"]},"partnerId":{"type":"string","format":"uuid","nullable":true},"customerId":{"type":"string","format":"uuid","nullable":true},"role":{"type":"string","enum":["owner","admin","moderator","member"]},"status":{"type":"string","enum":["invited","pending","active","banned"]},"points":{"type":"integer"},"level":{"type":"integer"},"levelName":{"type":"string"},"lastActiveAt":{"type":"string","format":"date-time","nullable":true},"joinedAt":{"type":"string","format":"date-time","nullable":true},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","userId","email","displayName","avatarUrl","bio","kind","partnerId","customerId","role","status","points","level","levelName","lastActiveAt","joinedAt","createdAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/leaderboard":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","enum":["7d","30d","all"],"default":"30d"},"in":"query","name":"window","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":10},"in":"query","name":"limit","required":false},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"window":{"type":"string","enum":["7d","30d","all"]},"entries":{"type":"array","items":{"type":"object","properties":{"rank":{"type":"integer"},"member":{"type":"object","properties":{"memberId":{"type":"string","format":"uuid"},"displayName":{"type":"string"},"avatarUrl":{"type":"string","nullable":true},"level":{"type":"integer"},"kind":{"type":"string","enum":["operator","partner","customer"]},"role":{"type":"string","enum":["owner","admin","moderator","member"]}},"required":["memberId","displayName","avatarUrl","level","kind","role"],"additionalProperties":false},"points":{"type":"integer"}},"required":["rank","member","points"],"additionalProperties":false}},"me":{"type":"object","properties":{"rank":{"type":"integer","nullable":true},"points":{"type":"integer"}},"required":["rank","points"],"additionalProperties":false},"levelDistribution":{"type":"array","items":{"type":"object","properties":{"level":{"type":"integer"},"name":{"type":"string"},"minPoints":{"type":"integer"},"members":{"type":"integer"}},"required":["level","name","minPoints","members"],"additionalProperties":false}}},"required":["window","entries","me","levelDistribution"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/classroom/{courseId}":{"get":{"tags":["community"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true},{"schema":{"type":"string","format":"uuid"},"in":"path","name":"courseId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"courseId":{"type":"string","format":"uuid"},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"coverUrl":{"type":"string","nullable":true},"lessonCount":{"type":"integer"},"status":{"type":"string"},"unlockLevel":{"type":"integer","nullable":true},"locked":{"type":"boolean"},"progressPct":{"type":"integer","nullable":true},"lessons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"position":{"type":"integer"},"durationMinutes":{"type":"integer","nullable":true},"blocks":{"type":"array","items":{"type":"object","additionalProperties":{}}}},"required":["id","title","position","durationMinutes","blocks"],"additionalProperties":false}}},"required":["courseId","title","summary","coverUrl","lessonCount","status","unlockLevel","locked","progressPct","lessons"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/events/{eventId}/rsvp":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["going","maybe","declined"]}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"eventId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"spaceId":{"type":"string","format":"uuid"},"title":{"type":"string"},"description":{"type":"string","nullable":true},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time","nullable":true},"timezone":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"recurrence":{"type":"string","nullable":true},"minLevel":{"type":"integer","nullable":true},"recordingUrl":{"type":"string","nullable":true},"goingCount":{"type":"integer"},"myRsvp":{"type":"string","enum":["going","maybe","declined"],"nullable":true},"locked":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","spaceId","title","description","startsAt","endsAt","timezone","location","recurrence","minLevel","recordingUrl","goingCount","myRsvp","locked","createdAt"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/community/spaces/{spaceId}/suggest":{"post":{"tags":["community"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"body":{"type":"string","maxLength":5000}},"required":["title"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"spaceId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"type":"string","nullable":true},"sources":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["post","lesson"]},"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"snippet":{"type":"string"},"courseId":{"type":"string","format":"uuid","nullable":true}},"required":["type","id","title","snippet","courseId"],"additionalProperties":false}},"source":{"type":"string","enum":["ai","fallback"]}},"required":["answer","sources","source"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/budgets":{"get":{"tags":["mdf"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"groupId":{"type":"string","format":"uuid","nullable":true},"groupName":{"type":"string","nullable":true},"periodStart":{"type":"string","nullable":true},"periodEnd":{"type":"string","nullable":true},"currency":{"type":"string"},"amountCents":{"type":"integer"},"committedCents":{"type":"integer"},"paidCents":{"type":"integer"},"availableCents":{"type":"integer"},"status":{"type":"string","enum":["active","closed"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","partnerId","partnerName","groupId","groupName","periodStart","periodEnd","currency","amountCents","committedCents","paidCents","availableCents","status","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["mdf"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"partnerId":{"type":"string","format":"uuid","nullable":true},"groupId":{"type":"string","format":"uuid","nullable":true},"periodStart":{"type":"string","nullable":true},"periodEnd":{"type":"string","nullable":true},"currency":{"type":"string","minLength":3,"maxLength":3,"default":"USD"},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0}},"required":["name","amountCents"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"groupId":{"type":"string","format":"uuid","nullable":true},"groupName":{"type":"string","nullable":true},"periodStart":{"type":"string","nullable":true},"periodEnd":{"type":"string","nullable":true},"currency":{"type":"string"},"amountCents":{"type":"integer"},"committedCents":{"type":"integer"},"paidCents":{"type":"integer"},"availableCents":{"type":"integer"},"status":{"type":"string","enum":["active","closed"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","partnerId","partnerName","groupId","groupName","periodStart","periodEnd","currency","amountCents","committedCents","paidCents","availableCents","status","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/budgets/{id}":{"patch":{"tags":["mdf"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"periodStart":{"type":"string","nullable":true},"periodEnd":{"type":"string","nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0},"status":{"type":"string","enum":["active","closed"]}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"name":{"type":"string"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"groupId":{"type":"string","format":"uuid","nullable":true},"groupName":{"type":"string","nullable":true},"periodStart":{"type":"string","nullable":true},"periodEnd":{"type":"string","nullable":true},"currency":{"type":"string"},"amountCents":{"type":"integer"},"committedCents":{"type":"integer"},"paidCents":{"type":"integer"},"availableCents":{"type":"integer"},"status":{"type":"string","enum":["active","closed"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","name","partnerId","partnerName","groupId","groupName","periodStart","periodEnd","currency","amountCents","committedCents","paidCents","availableCents","status","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/claims":{"get":{"tags":["mdf"],"parameters":[{"schema":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"budgetId","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"budgetId":{"type":"string","format":"uuid"},"budgetName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"kind":{"type":"string","enum":["request","claim"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"decidedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"payoutId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","budgetId","budgetName","partnerId","partnerName","kind","title","description","amountCents","currency","evidence","status","decidedAt","decisionNote","payoutId","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["mdf"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"budgetId":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["request","claim"],"default":"claim"},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","maxLength":10000,"nullable":true},"amountCents":{"type":"integer","exclusiveMinimum":true,"minimum":0},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false},"maxItems":20,"default":[]}},"required":["budgetId","title","amountCents"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"budgetId":{"type":"string","format":"uuid"},"budgetName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"kind":{"type":"string","enum":["request","claim"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"decidedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"payoutId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","budgetId","budgetName","partnerId","partnerName","kind","title","description","amountCents","currency","evidence","status","decidedAt","decisionNote","payoutId","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/claims/{id}":{"get":{"tags":["mdf"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"budgetId":{"type":"string","format":"uuid"},"budgetName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"kind":{"type":"string","enum":["request","claim"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"decidedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"payoutId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","budgetId","budgetName","partnerId","partnerName","kind","title","description","amountCents","currency","evidence","status","decidedAt","decisionNote","payoutId","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/claims/{id}/evidence":{"post":{"tags":["mdf"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false},"minItems":1,"maxItems":20}},"required":["evidence"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"budgetId":{"type":"string","format":"uuid"},"budgetName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"kind":{"type":"string","enum":["request","claim"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"decidedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"payoutId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","budgetId","budgetName","partnerId","partnerName","kind","title","description","amountCents","currency","evidence","status","decidedAt","decisionNote","payoutId","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/claims/{id}/cancel":{"post":{"tags":["mdf"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"budgetId":{"type":"string","format":"uuid"},"budgetName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"kind":{"type":"string","enum":["request","claim"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"decidedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"payoutId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","budgetId","budgetName","partnerId","partnerName","kind","title","description","amountCents","currency","evidence","status","decidedAt","decisionNote","payoutId","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/claims/{id}/decide":{"post":{"tags":["mdf"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"decision":{"type":"string","enum":["approve","reject"]},"note":{"type":"string","maxLength":2000,"nullable":true}},"required":["decision"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"budgetId":{"type":"string","format":"uuid"},"budgetName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"kind":{"type":"string","enum":["request","claim"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"decidedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"payoutId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","budgetId","budgetName","partnerId","partnerName","kind","title","description","amountCents","currency","evidence","status","decidedAt","decisionNote","payoutId","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/claims/{id}/pay":{"post":{"tags":["mdf"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"budgetId":{"type":"string","format":"uuid"},"budgetName":{"type":"string","nullable":true},"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"kind":{"type":"string","enum":["request","claim"]},"title":{"type":"string"},"description":{"type":"string","nullable":true},"amountCents":{"type":"integer"},"currency":{"type":"string"},"evidence":{"type":"array","items":{"type":"object","properties":{"url":{"type":"string","minLength":1,"maxLength":2000},"name":{"type":"string","maxLength":300},"contentType":{"type":"string","maxLength":120,"nullable":true}},"required":["url","name"],"additionalProperties":false}},"status":{"type":"string","enum":["submitted","approved","rejected","paid","cancelled"]},"decidedAt":{"type":"string","nullable":true},"decisionNote":{"type":"string","nullable":true},"payoutId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","budgetId","budgetName","partnerId","partnerName","kind","title","description","amountCents","currency","evidence","status","decidedAt","decisionNote","payoutId","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/mdf/uploads":{"post":{"tags":["mdf"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"},"name":{"type":"string"},"contentType":{"type":"string"}},"required":["url","name","contentType"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/risk/overview":{"get":{"tags":["risk"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"threshold":{"type":"integer"},"openSignals":{"type":"integer"},"partnersOnHold":{"type":"integer"},"partners":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"maxScore":{"type":"integer"},"openSignals":{"type":"integer"},"onHold":{"type":"boolean"}},"required":["partnerId","partnerName","maxScore","openSignals","onHold"],"additionalProperties":false}},"providers":{"type":"array","items":{"type":"string"}}},"required":["threshold","openSignals","partnersOnHold","partners","providers"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/risk/signals":{"get":{"tags":["risk"],"parameters":[{"schema":{"type":"string","enum":["open","dismissed","confirmed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","maxLength":60},"in":"query","name":"kind","required":false},{"schema":{"type":"integer","minimum":1,"default":1},"in":"query","name":"page","required":false},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"in":"query","name":"pageSize","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"subjectType":{"type":"string"},"subjectId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string"},"score":{"type":"integer","minimum":0,"maximum":100},"detail":{"type":"object","additionalProperties":{}},"provider":{"type":"string"},"status":{"type":"string","enum":["open","dismissed","confirmed"]},"holdApplied":{"type":"boolean"},"reviewedById":{"type":"string","format":"uuid","nullable":true},"reviewedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","subjectType","subjectId","kind","score","detail","provider","status","holdApplied","reviewedById","reviewedAt","createdAt","updatedAt"],"additionalProperties":false}},"page":{"type":"integer"},"pageSize":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["data","page","pageSize","total","totalPages"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/risk/signals/{id}/dismiss":{"post":{"tags":["risk"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"subjectType":{"type":"string"},"subjectId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string"},"score":{"type":"integer","minimum":0,"maximum":100},"detail":{"type":"object","additionalProperties":{}},"provider":{"type":"string"},"status":{"type":"string","enum":["open","dismissed","confirmed"]},"holdApplied":{"type":"boolean"},"reviewedById":{"type":"string","format":"uuid","nullable":true},"reviewedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","subjectType","subjectId","kind","score","detail","provider","status","holdApplied","reviewedById","reviewedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/risk/signals/{id}/confirm":{"post":{"tags":["risk"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"signal":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"subjectType":{"type":"string"},"subjectId":{"type":"string","format":"uuid","nullable":true},"kind":{"type":"string"},"score":{"type":"integer","minimum":0,"maximum":100},"detail":{"type":"object","additionalProperties":{}},"provider":{"type":"string"},"status":{"type":"string","enum":["open","dismissed","confirmed"]},"holdApplied":{"type":"boolean"},"reviewedById":{"type":"string","format":"uuid","nullable":true},"reviewedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","subjectType","subjectId","kind","score","detail","provider","status","holdApplied","reviewedById","reviewedAt","createdAt","updatedAt"],"additionalProperties":false},"clawedBack":{"type":"integer"},"dealIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["signal","clawedBack","dealIds"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/risk/signals/{id}/explain":{"post":{"tags":["risk"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"summary":{"type":"string"},"factors":{"type":"array","items":{"type":"string"}},"recommendation":{"type":"string"},"source":{"type":"string","enum":["ai","template"]}},"required":["summary","factors","recommendation","source"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/risk/partners/{partnerId}/release":{"post":{"tags":["risk"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"partnerId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"released":{"type":"integer"}},"required":["released"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/risk/scan":{"post":{"tags":["risk"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"signals":{"type":"integer"},"held":{"type":"integer"}},"required":["signals","held"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/insights":{"get":{"tags":["insights"],"parameters":[{"schema":{"type":"string","enum":["open","done","dismissed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","maxLength":40},"in":"query","name":"kind","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":100},"in":"query","name":"limit","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"audience":{"type":"string","enum":["operator","partner"]},"kind":{"type":"string"},"severity":{"type":"string","enum":["info","warn","critical","positive"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"data":{"type":"object","additionalProperties":{}},"source":{"type":"string","enum":["rules","ai"]},"status":{"type":"string","enum":["open","done","dismissed"]},"expiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","audience","kind","severity","title","summary","data","source","status","expiresAt","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/insights/{id}":{"patch":{"tags":["insights"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["open","done","dismissed"]}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"audience":{"type":"string","enum":["operator","partner"]},"kind":{"type":"string"},"severity":{"type":"string","enum":["info","warn","critical","positive"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"data":{"type":"object","additionalProperties":{}},"source":{"type":"string","enum":["rules","ai"]},"status":{"type":"string","enum":["open","done","dismissed"]},"expiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","audience","kind","severity","title","summary","data","source","status","expiresAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/insights/radar":{"post":{"tags":["insights"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partners":{"type":"integer"},"insights":{"type":"integer"},"ai":{"type":"boolean"}},"required":["partners","insights","ai"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/insights/mine":{"get":{"tags":["insights"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":20,"default":5},"in":"query","name":"limit","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"audience":{"type":"string","enum":["operator","partner"]},"kind":{"type":"string"},"severity":{"type":"string","enum":["info","warn","critical","positive"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"data":{"type":"object","additionalProperties":{}},"source":{"type":"string","enum":["rules","ai"]},"status":{"type":"string","enum":["open","done","dismissed"]},"expiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","audience","kind","severity","title","summary","data","source","status","expiresAt","createdAt","updatedAt"],"additionalProperties":false}}}}}}}},"/api/insights/mine/{id}":{"patch":{"tags":["insights"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["open","done","dismissed"]}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"audience":{"type":"string","enum":["operator","partner"]},"kind":{"type":"string"},"severity":{"type":"string","enum":["info","warn","critical","positive"]},"title":{"type":"string"},"summary":{"type":"string","nullable":true},"data":{"type":"object","additionalProperties":{}},"source":{"type":"string","enum":["rules","ai"]},"status":{"type":"string","enum":["open","done","dismissed"]},"expiresAt":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","audience","kind","severity","title","summary","data","source","status","expiresAt","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/briefs":{"get":{"tags":["briefs"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"content":{"type":"object","properties":{"headline":{"type":"string"},"summary":{"type":"string"},"kpis":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"current":{"type":"number"},"previous":{"type":"number"},"changePct":{"type":"number","nullable":true},"format":{"type":"string","enum":["number","money"]}},"required":["key","label","current","previous","changePct","format"],"additionalProperties":false}},"topMovers":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"current":{"type":"number"},"previous":{"type":"number"},"delta":{"type":"number"}},"required":["partnerId","partnerName","current","previous","delta"],"additionalProperties":false}},"risks":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}},"actions":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}}},"required":["headline","summary","kpis","topMovers","risks","actions"],"additionalProperties":false},"source":{"type":"string","enum":["ai","template"]},"sentAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","content","source","sentAt","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/briefs/{id}":{"get":{"tags":["briefs"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"content":{"type":"object","properties":{"headline":{"type":"string"},"summary":{"type":"string"},"kpis":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"current":{"type":"number"},"previous":{"type":"number"},"changePct":{"type":"number","nullable":true},"format":{"type":"string","enum":["number","money"]}},"required":["key","label","current","previous","changePct","format"],"additionalProperties":false}},"topMovers":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"current":{"type":"number"},"previous":{"type":"number"},"delta":{"type":"number"}},"required":["partnerId","partnerName","current","previous","delta"],"additionalProperties":false}},"risks":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}},"actions":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}}},"required":["headline","summary","kpis","topMovers","risks","actions"],"additionalProperties":false},"source":{"type":"string","enum":["ai","template"]},"sentAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","content","source","sentAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/briefs/generate":{"post":{"tags":["briefs"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"send":{"type":"boolean","default":false}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"content":{"type":"object","properties":{"headline":{"type":"string"},"summary":{"type":"string"},"kpis":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"current":{"type":"number"},"previous":{"type":"number"},"changePct":{"type":"number","nullable":true},"format":{"type":"string","enum":["number","money"]}},"required":["key","label","current","previous","changePct","format"],"additionalProperties":false}},"topMovers":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string"},"current":{"type":"number"},"previous":{"type":"number"},"delta":{"type":"number"}},"required":["partnerId","partnerName","current","previous","delta"],"additionalProperties":false}},"risks":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}},"actions":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"detail":{"type":"string"}},"required":["title","detail"],"additionalProperties":false}}},"required":["headline","summary","kpis","topMovers","risks","actions"],"additionalProperties":false},"source":{"type":"string","enum":["ai","template"]},"sentAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","periodStart","periodEnd","content","source","sentAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/captures":{"get":{"tags":["captures"],"parameters":[{"schema":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","enum":["email","slack","teams","api","form"]},"in":"query","name":"channel","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"partnerName":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","teams","api","form"]},"externalId":{"type":"string","nullable":true},"sender":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"required":["name","email","company","title","phone","message","confidence"],"additionalProperties":false,"nullable":true},"confidence":{"type":"number","nullable":true},"status":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"leadId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","channel","externalId","sender","subject","body","parsed","confidence","status","leadId","error","createdAt","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["captures"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":20000},"subject":{"type":"string","maxLength":300},"partnerId":{"type":"string","format":"uuid"}},"required":["text"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"partnerName":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","teams","api","form"]},"externalId":{"type":"string","nullable":true},"sender":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"required":["name","email","company","title","phone","message","confidence"],"additionalProperties":false,"nullable":true},"confidence":{"type":"number","nullable":true},"status":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"leadId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","channel","externalId","sender","subject","body","parsed","confidence","status","leadId","error","createdAt","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/captures/{id}":{"get":{"tags":["captures"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"partnerName":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","teams","api","form"]},"externalId":{"type":"string","nullable":true},"sender":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"required":["name","email","company","title","phone","message","confidence"],"additionalProperties":false,"nullable":true},"confidence":{"type":"number","nullable":true},"status":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"leadId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","channel","externalId","sender","subject","body","parsed","confidence","status","leadId","error","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["captures"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"additionalProperties":false},"partnerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"partnerName":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","teams","api","form"]},"externalId":{"type":"string","nullable":true},"sender":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"required":["name","email","company","title","phone","message","confidence"],"additionalProperties":false,"nullable":true},"confidence":{"type":"number","nullable":true},"status":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"leadId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","channel","externalId","sender","subject","body","parsed","confidence","status","leadId","error","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/captures/{id}/approve":{"post":{"tags":["captures"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"email":{"type":"string","format":"email","nullable":true},"company":{"type":"string","maxLength":160,"nullable":true},"title":{"type":"string","maxLength":160,"nullable":true},"phone":{"type":"string","maxLength":60,"nullable":true},"message":{"type":"string","maxLength":4000,"nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true}},"additionalProperties":false,"default":{}}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"partnerName":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","teams","api","form"]},"externalId":{"type":"string","nullable":true},"sender":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"required":["name","email","company","title","phone","message","confidence"],"additionalProperties":false,"nullable":true},"confidence":{"type":"number","nullable":true},"status":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"leadId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","channel","externalId","sender","subject","body","parsed","confidence","status","leadId","error","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/captures/{id}/reject":{"post":{"tags":["captures"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"type":"string","maxLength":500}},"additionalProperties":false,"default":{}}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"partnerName":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","teams","api","form"]},"externalId":{"type":"string","nullable":true},"sender":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"required":["name","email","company","title","phone","message","confidence"],"additionalProperties":false,"nullable":true},"confidence":{"type":"number","nullable":true},"status":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"leadId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","channel","externalId","sender","subject","body","parsed","confidence","status","leadId","error","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/captures/{id}/reparse":{"post":{"tags":["captures"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"partnerId":{"type":"string","nullable":true},"partnerName":{"type":"string","nullable":true},"channel":{"type":"string","enum":["email","slack","teams","api","form"]},"externalId":{"type":"string","nullable":true},"sender":{"type":"string","nullable":true},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"parsed":{"type":"object","properties":{"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"title":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"message":{"type":"string","nullable":true},"dealValue":{"type":"number","nullable":true},"currency":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"confidence":{"type":"number","minimum":0,"maximum":100},"parser":{"type":"string","enum":["ai","rules"]}},"required":["name","email","company","title","phone","message","confidence"],"additionalProperties":false,"nullable":true},"confidence":{"type":"number","nullable":true},"status":{"type":"string","enum":["received","parsed","needs_review","converted","rejected","failed"]},"leadId":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","partnerId","partnerName","channel","externalId","sender","subject","body","parsed","confidence","status","leadId","error","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/capture/address":{"get":{"tags":["capture"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"domain":{"type":"string"},"orgAddress":{"type":"string","nullable":true},"partnerAddress":{"type":"string","nullable":true},"threshold":{"type":"number"},"aiAvailable":{"type":"boolean"}},"required":["domain","orgAddress","partnerAddress","threshold","aiAvailable"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/slack/status":{"get":{"tags":["slack"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"connected":{"type":"boolean"},"connectionId":{"type":"string","nullable":true},"teamId":{"type":"string","nullable":true},"teamName":{"type":"string","nullable":true},"channelId":{"type":"string","nullable":true},"hasSigningSecret":{"type":"boolean"},"requestUrls":{"type":"object","properties":{"events":{"type":"string"},"commands":{"type":"string"},"interactivity":{"type":"string"}},"required":["events","commands","interactivity"],"additionalProperties":false},"linkedUsers":{"type":"number"}},"required":["connected","connectionId","teamId","teamName","channelId","hasSigningSecret","requestUrls","linkedUsers"],"additionalProperties":false}}}}}}},"/api/slack/connect":{"post":{"tags":["slack"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"botToken":{"type":"string","minLength":10,"maxLength":300},"signingSecret":{"type":"string","minLength":8,"maxLength":200},"channelId":{"type":"string","maxLength":40},"teamId":{"type":"string","maxLength":40}},"required":["botToken"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"connected":{"type":"boolean"},"connectionId":{"type":"string","nullable":true},"teamId":{"type":"string","nullable":true},"teamName":{"type":"string","nullable":true},"channelId":{"type":"string","nullable":true},"hasSigningSecret":{"type":"boolean"},"requestUrls":{"type":"object","properties":{"events":{"type":"string"},"commands":{"type":"string"},"interactivity":{"type":"string"}},"required":["events","commands","interactivity"],"additionalProperties":false},"linkedUsers":{"type":"number"}},"required":["connected","connectionId","teamId","teamName","channelId","hasSigningSecret","requestUrls","linkedUsers"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/chat/link-code":{"post":{"tags":["chat"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"expiresAt":{"type":"string"},"command":{"type":"string"}},"required":["code","expiresAt","command"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/chat/identities":{"get":{"tags":["chat"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"provider":{"type":"string"},"workspaceId":{"type":"string"},"externalUserId":{"type":"string"},"userId":{"type":"string","format":"uuid"},"createdAt":{"type":"string"}},"required":["id","orgId","provider","workspaceId","externalUserId","userId","createdAt"],"additionalProperties":false}}}}}}}},"/api/chat/identities/{id}":{"delete":{"tags":["chat"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/inbound/email":{"post":{"tags":["inbound"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"captureId":{"type":"string","nullable":true},"status":{"type":"string"},"duplicate":{"type":"boolean"},"reason":{"type":"string"}},"required":["accepted"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/inbound/sns":{"post":{"tags":["inbound"],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"captureId":{"type":"string","nullable":true},"status":{"type":"string"},"duplicate":{"type":"boolean"},"reason":{"type":"string"}},"required":["accepted"],"additionalProperties":false}}}},"401":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"captureId":{"type":"string","nullable":true},"status":{"type":"string"},"duplicate":{"type":"boolean"},"reason":{"type":"string"}},"required":["accepted"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"accepted":{"type":"boolean"},"captureId":{"type":"string","nullable":true},"status":{"type":"string"},"duplicate":{"type":"boolean"},"reason":{"type":"string"}},"required":["accepted"],"additionalProperties":false}}}}}}},"/api/slack/events":{"post":{"tags":["slack"],"responses":{"200":{"description":"Default Response"}}}},"/api/slack/commands":{"post":{"tags":["slack"],"responses":{"200":{"description":"Default Response"}}}},"/api/slack/interactivity":{"post":{"tags":["slack"],"responses":{"200":{"description":"Default Response"}}}},"/api/field-mappings":{"get":{"tags":["field-mappings"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"query","name":"connectionId","required":false}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid"},"objectType":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound","both"]},"mappings":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":200,"default":""},"target":{"type":"string","minLength":1,"maxLength":200},"transform":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["constant"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["lookup"]},"map":{"type":"object","additionalProperties":{"type":"string"}},"default":{"type":"string"},"caseInsensitive":{"type":"boolean"}},"required":["type","map"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"format":{"type":"string","enum":["iso","date","epoch_ms","epoch_s"]}},"required":["type","format"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["number"]},"scale":{"type":"number"},"round":{"type":"boolean"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"template":{"type":"string","maxLength":500}},"required":["type","template"],"additionalProperties":false}],"default":{"type":"direct"}}},"required":["target"],"additionalProperties":false}},"filters":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":200},"op":{"type":"string","enum":["equals","not_equals","contains","exists","not_exists","gt","lt"]},"value":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":["field","op"],"additionalProperties":false},"maxItems":20,"default":[]}},"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","connectionId","objectType","direction","mappings","filters","createdAt","updatedAt"],"additionalProperties":false}}}}}}},"put":{"tags":["field-mappings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"connectionId":{"type":"string","format":"uuid"},"objectType":{"type":"string","enum":["lead","deal","customer","partner","contact","account"]},"direction":{"type":"string","enum":["inbound","outbound","both"]},"mappings":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":200,"default":""},"target":{"type":"string","minLength":1,"maxLength":200},"transform":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["constant"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["lookup"]},"map":{"type":"object","additionalProperties":{"type":"string"}},"default":{"type":"string"},"caseInsensitive":{"type":"boolean"}},"required":["type","map"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"format":{"type":"string","enum":["iso","date","epoch_ms","epoch_s"]}},"required":["type","format"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["number"]},"scale":{"type":"number"},"round":{"type":"boolean"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"template":{"type":"string","maxLength":500}},"required":["type","template"],"additionalProperties":false}],"default":{"type":"direct"}}},"required":["target"],"additionalProperties":false},"maxItems":200},"filters":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":200},"op":{"type":"string","enum":["equals","not_equals","contains","exists","not_exists","gt","lt"]},"value":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":["field","op"],"additionalProperties":false},"maxItems":20,"default":[]}},"additionalProperties":false,"default":{"match":"all","rules":[]}}},"required":["connectionId","objectType","direction","mappings"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid"},"objectType":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound","both"]},"mappings":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":200,"default":""},"target":{"type":"string","minLength":1,"maxLength":200},"transform":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["constant"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["lookup"]},"map":{"type":"object","additionalProperties":{"type":"string"}},"default":{"type":"string"},"caseInsensitive":{"type":"boolean"}},"required":["type","map"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"format":{"type":"string","enum":["iso","date","epoch_ms","epoch_s"]}},"required":["type","format"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["number"]},"scale":{"type":"number"},"round":{"type":"boolean"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"template":{"type":"string","maxLength":500}},"required":["type","template"],"additionalProperties":false}],"default":{"type":"direct"}}},"required":["target"],"additionalProperties":false}},"filters":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":200},"op":{"type":"string","enum":["equals","not_equals","contains","exists","not_exists","gt","lt"]},"value":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":["field","op"],"additionalProperties":false},"maxItems":20,"default":[]}},"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","orgId","connectionId","objectType","direction","mappings","filters","createdAt","updatedAt"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/field-mappings/{id}":{"delete":{"tags":["field-mappings"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"204":{"description":"Default Response","content":{"application/json":{"schema":{"enum":["null"],"nullable":true}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/field-mappings/describe/{connectionId}/{objectType}":{"get":{"tags":["field-mappings"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"connectionId","required":true},{"schema":{"type":"string","enum":["lead","deal","customer","partner","contact","account"]},"in":"path","name":"objectType","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"remote":{"type":"boolean"},"remoteFields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"}},"required":["name","label"],"additionalProperties":false}},"localFields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"label":{"type":"string"},"type":{"type":"string"}},"required":["name","label"],"additionalProperties":false}},"detail":{"type":"string"}},"required":["remote","remoteFields","localFields"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/field-mappings/preview":{"post":{"tags":["field-mappings"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"direction":{"type":"string","enum":["inbound","outbound"]},"mappings":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","maxLength":200,"default":""},"target":{"type":"string","minLength":1,"maxLength":200},"transform":{"anyOf":[{"type":"object","properties":{"type":{"type":"string","enum":["direct"]}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["constant"]},"value":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"enum":["null"],"nullable":true}]}},"required":["type","value"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["lookup"]},"map":{"type":"object","additionalProperties":{"type":"string"}},"default":{"type":"string"},"caseInsensitive":{"type":"boolean"}},"required":["type","map"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["date"]},"format":{"type":"string","enum":["iso","date","epoch_ms","epoch_s"]}},"required":["type","format"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["number"]},"scale":{"type":"number"},"round":{"type":"boolean"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","enum":["template"]},"template":{"type":"string","maxLength":500}},"required":["type","template"],"additionalProperties":false}],"default":{"type":"direct"}}},"required":["target"],"additionalProperties":false},"maxItems":200},"filters":{"type":"object","properties":{"match":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","minLength":1,"maxLength":200},"op":{"type":"string","enum":["equals","not_equals","contains","exists","not_exists","gt","lt"]},"value":{"anyOf":[{"type":"string"},{"type":"number"}]}},"required":["field","op"],"additionalProperties":false},"maxItems":20,"default":[]}},"additionalProperties":false,"default":{"match":"all","rules":[]}},"record":{"type":"object","additionalProperties":{}}},"required":["direction","mappings","record"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"skipped":{"type":"boolean"},"record":{"type":"object","additionalProperties":{},"nullable":true}},"required":["skipped","record"],"additionalProperties":false}}}}}}},"/api/sales/inquiries":{"post":{"summary":"Talk to sales","tags":["sales"],"description":"Public. Leave a sales inquiry; staff reply by email. With a user session the inquiry is recorded against the caller's workspace.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"email":{"type":"string","format":"email","maxLength":254},"company":{"type":"string","minLength":1,"maxLength":160},"website":{"type":"string","maxLength":300},"partnerCount":{"type":"string","enum":["none","1-50","51-500","500+"]},"message":{"type":"string","maxLength":2000},"honeypot":{"type":"string","maxLength":0}},"required":["name","email","company"],"additionalProperties":false}}}},"responses":{"201":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"],"additionalProperties":false}}}},"422":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/incentives":{"get":{"tags":["incentives"],"parameters":[{"schema":{"type":"string","enum":["recorded","coupon_created","applied","failed","void"]},"in":"query","name":"status","required":false},{"schema":{"type":"string","format":"uuid"},"in":"query","name":"partnerId","required":false},{"schema":{"type":"string","maxLength":200},"in":"query","name":"customerKey","required":false},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"in":"query","name":"limit","required":false}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid","nullable":true},"ruleId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"attributionId":{"type":"string","format":"uuid","nullable":true},"referralId":{"type":"string","format":"uuid","nullable":true},"customerKey":{"type":"string","nullable":true},"source":{"type":"string","enum":["signup","conversion","referral"]},"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"},"status":{"type":"string","enum":["recorded","coupon_created","applied","failed","void"]},"couponRef":{"type":"string","nullable":true},"couponCode":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"]},"appliedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","programId","ruleId","partnerId","attributionId","referralId","customerKey","source","kind","value","currency","durationMonths","description","status","couponRef","couponCode","error","environment","appliedAt","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/incentives/{id}/applied":{"post":{"tags":["incentives"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["applied","failed","void"],"default":"applied"},"note":{"type":"string","maxLength":500}},"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]},{"machineAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"programId":{"type":"string","format":"uuid","nullable":true},"ruleId":{"type":"string","format":"uuid","nullable":true},"partnerId":{"type":"string","format":"uuid","nullable":true},"partnerName":{"type":"string","nullable":true},"attributionId":{"type":"string","format":"uuid","nullable":true},"referralId":{"type":"string","format":"uuid","nullable":true},"customerKey":{"type":"string","nullable":true},"source":{"type":"string","enum":["signup","conversion","referral"]},"kind":{"type":"string","enum":["discount_percent","discount_amount","free_months","account_credit"]},"value":{"type":"integer"},"currency":{"type":"string","nullable":true},"durationMonths":{"type":"integer","nullable":true},"description":{"type":"string"},"status":{"type":"string","enum":["recorded","coupon_created","applied","failed","void"]},"couponRef":{"type":"string","nullable":true},"couponCode":{"type":"string","nullable":true},"error":{"type":"string","nullable":true},"environment":{"type":"string","enum":["live","test"]},"appliedAt":{"type":"string","nullable":true},"createdAt":{"type":"string"}},"required":["id","orgId","programId","ruleId","partnerId","attributionId","referralId","customerKey","source","kind","value","currency","durationMonths","description","status","couponRef","couponCode","error","environment","appliedAt","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/kyc/me":{"get":{"tags":["kyc"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"status":{"type":"string","enum":["unverified","pending","requires_input","verified","canceled"]},"provider":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true},"verifiedAt":{"type":"string","nullable":true},"required":{"type":"boolean"},"updatedAt":{"type":"string","nullable":true}},"required":["partnerId","status","provider","lastError","verifiedAt","required","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/kyc/sessions":{"post":{"tags":["kyc"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"returnUrl":{"type":"string","format":"uri"}},"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["unverified","pending","requires_input","verified","canceled"]},"url":{"type":"string","nullable":true}},"required":["status","url"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/kyc/partners":{"get":{"tags":["kyc"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"status":{"type":"string","enum":["unverified","pending","requires_input","verified","canceled"]},"provider":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true},"verifiedAt":{"type":"string","nullable":true},"required":{"type":"boolean"},"updatedAt":{"type":"string","nullable":true}},"required":["partnerId","status","provider","lastError","verifiedAt","required","updatedAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/kyc/partners/{partnerId}":{"put":{"tags":["kyc"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["verified","unverified","requires_input"]},"note":{"type":"string","maxLength":500}},"required":["status"],"additionalProperties":false}}}},"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"partnerId","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"partnerId":{"type":"string","format":"uuid"},"partnerName":{"type":"string","nullable":true},"status":{"type":"string","enum":["unverified","pending","requires_input","verified","canceled"]},"provider":{"type":"string","nullable":true},"lastError":{"type":"string","nullable":true},"verifiedAt":{"type":"string","nullable":true},"required":{"type":"boolean"},"updatedAt":{"type":"string","nullable":true}},"required":["partnerId","status","provider","lastError","verifiedAt","required","updatedAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/kyc/webhooks/stripe":{"post":{"tags":["kyc"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":{}}}}},"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"received":{"type":"boolean"}},"required":["received"],"additionalProperties":false}}}}}}},"/api/finder/credits":{"get":{"tags":["finder"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"allowance":{"type":"integer"},"used":{"type":"integer"},"remaining":{"type":"integer"},"periodStart":{"type":"string"},"periodEnd":{"type":"string"},"configured":{"type":"boolean"},"provider":{"type":"string","enum":["brave","serper"],"nullable":true}},"required":["allowance","used","remaining","periodStart","periodEnd","configured","provider"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/finder/searches":{"get":{"tags":["finder"],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"query":{"type":"string"},"status":{"type":"string"},"provider":{"type":"string"},"creditsUsed":{"type":"integer"},"aiSource":{"type":"string","enum":["ai","rules"]},"fallbackReason":{"type":"string","nullable":true},"resultCount":{"type":"integer"},"createdAt":{"type":"string"}},"required":["id","orgId","query","status","provider","creditsUsed","aiSource","fallbackReason","resultCount","createdAt"],"additionalProperties":false}}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["finder"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"description":{"type":"string","minLength":10,"maxLength":1000},"limit":{"type":"integer","minimum":1,"maximum":20,"default":10}},"required":["description"],"additionalProperties":false}}}},"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"query":{"type":"string"},"status":{"type":"string"},"provider":{"type":"string"},"creditsUsed":{"type":"integer"},"aiSource":{"type":"string","enum":["ai","rules"]},"fallbackReason":{"type":"string","nullable":true},"resultCount":{"type":"integer"},"createdAt":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"searchId":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string"},"domain":{"type":"string"},"audience":{"type":"string","nullable":true},"whyFit":{"type":"string","nullable":true},"contactUrl":{"type":"string","nullable":true},"score":{"type":"integer"},"prospectId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"}},"required":["id","searchId","name","url","domain","audience","whyFit","contactUrl","score","prospectId","createdAt"],"additionalProperties":false}}},"required":["id","orgId","query","status","provider","creditsUsed","aiSource","fallbackReason","resultCount","createdAt","candidates"],"additionalProperties":false}}}},"402":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/finder/searches/{id}":{"get":{"tags":["finder"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"orgId":{"type":"string","format":"uuid"},"query":{"type":"string"},"status":{"type":"string"},"provider":{"type":"string"},"creditsUsed":{"type":"integer"},"aiSource":{"type":"string","enum":["ai","rules"]},"fallbackReason":{"type":"string","nullable":true},"resultCount":{"type":"integer"},"createdAt":{"type":"string"},"candidates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"searchId":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string"},"domain":{"type":"string"},"audience":{"type":"string","nullable":true},"whyFit":{"type":"string","nullable":true},"contactUrl":{"type":"string","nullable":true},"score":{"type":"integer"},"prospectId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"}},"required":["id","searchId","name","url","domain","audience","whyFit","contactUrl","score","prospectId","createdAt"],"additionalProperties":false}}},"required":["id","orgId","query","status","provider","creditsUsed","aiSource","fallbackReason","resultCount","createdAt","candidates"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}},"/api/finder/candidates/{id}/prospect":{"post":{"tags":["finder"],"parameters":[{"schema":{"type":"string","format":"uuid"},"in":"path","name":"id","required":true}],"security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"searchId":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string"},"domain":{"type":"string"},"audience":{"type":"string","nullable":true},"whyFit":{"type":"string","nullable":true},"contactUrl":{"type":"string","nullable":true},"score":{"type":"integer"},"prospectId":{"type":"string","format":"uuid","nullable":true},"createdAt":{"type":"string"}},"required":["id","searchId","name","url","domain","audience","whyFit","contactUrl","score","prospectId","createdAt"],"additionalProperties":false}}}},"403":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Default Response","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}},"required":["code","message"],"additionalProperties":false}},"required":["error"],"additionalProperties":false}}}}}}}},"servers":[{"url":"https://partners.naridon.com","description":"production"}],"tags":[{"name":"provisions","description":"Provisions are the instructions PartnersWatch delivers to your product's endpoint: create an account, change a plan, grant credits, suspend, cancel. These endpoints create, list and retry them. See the *Provisioning rail* guide, and **Provision request** under Webhooks for what your endpoint receives.","x-displayName":"Provisioning"},{"name":"products","description":"Your product catalogue, each product's provision policy (`allowedKinds`, `maxQuantityPerProvision`, `requirePlanId`) and the integration manifest that sets up connections, plan codes and webhooks in one document.","x-displayName":"Products, policy & manifests"},{"name":"integrations","description":"Connections tell PartnersWatch where and how to deliver for a product. There is one per environment. Creating one returns its signing secret once. Rotating it keeps the previous secret signing until the next rotation. Also covers account links, delivery events and integration readiness.","x-displayName":"Connections"},{"name":"usage","description":"Push per-partner usage (`usage:ingest`). It is idempotent on `externalRef`, which is unique platform-wide. PartnersWatch displays usage and does not bill from it.","x-displayName":"Usage"},{"name":"subscriptions","description":"Report account lifecycle (`active`, `trialing`, `past_due`, `paused`, `cancelled`, `churned`) with `subscription:ingest`. A record that resolves to no partner is dropped with a note. Always read `notes`.","x-displayName":"Subscription state"},{"name":"webhooks","description":"Outbound webhook subscriptions. Deliveries are signed `X-PartnerOS-Signature: t=…,v1=…` (HMAC-SHA256 over `t.body`) and retried 5 times. After a secret rotation both secrets sign for the grace window (`v1=<new>,v1=<old>`). See **Webhook delivery** under Webhooks.","x-displayName":"Webhooks"},{"name":"apikeys","description":"Scoped machine keys (`pos_live_…` / `pos_test_…`). The plaintext is returned once. Keys can carry an optional `expiresAt`; `POST /api/apikeys/{id}/rotate` mints a replacement and keeps the old key working for a grace window (default 24h, max 7 days).","x-displayName":"API keys"},{"name":"oauth","description":"Client-credentials clients and the token endpoint. Tokens last 900 seconds and carry all of the client's scopes. Rotating a client secret keeps the old one valid for a grace window (default 24h, max 7 days; `graceSeconds: 0` for none).","x-displayName":"OAuth clients"},{"name":"v1","description":"The stable surface for machine credentials (API key or OAuth access token): ping/me, partners, partner brand, customers, deals, leads, plans, documents, referrals and REST-hook subscriptions.","x-displayName":"Public API (v1)"},{"name":"track","description":"`POST /api/track/conversion` (`attribution:write`). Confirms a referred conversion from your server. It is idempotent on `conversionKey` per environment.","x-displayName":"Server-side conversions"},{"name":"tracking","description":"Partner tracking links, coupons, attributions, and the pw.js install details (publishable keys, script URL, snippet).","x-displayName":"Tracking links & setup"},{"name":"pw","description":"Browser endpoints called by `pw.js` with a publishable key. Conversions reported here are unconfirmed and never payable.","x-displayName":"pw.js beacons"},{"name":"imports","description":"Migrate an existing program from PartnerStack or CSV: create a job, preview (required, dry run), then run. Re-runs are idempotent.","x-displayName":"Imports"},{"name":"domains","description":"Prove control of a customer domain by DNS TXT or `.well-known` file. Verified claims travel on onboard provisions as `attributes.domainVerification`.","x-displayName":"Domain claims"},{"name":"whitelabel","description":"Partner brand profiles, their review, and partner custom domains (`portal` served by PartnersWatch, `vendor_app` served by you).","x-displayName":"White-label"},{"name":"mail","description":"`POST /api/mail/send` (`mail:send`): send as a white-label partner, from the partner's own verified domain, DKIM-signed by PartnersWatch. Falls back to your own sender until the partner's DNS is verified and their brand approved. See the *Partner mail* guide. Sender setup lives under White-label (`/api/whitelabel/mail-sender`).","x-displayName":"Partner mail"},{"name":"ingest","description":"`POST /api/ingest/{connectionId}`: a signature-gated receiver for events from a connected system, such as billing providers (Stripe, Paddle, Recurly, Chargebee) or generic signed webhooks.","x-displayName":"Inbound connector ingress"},{"name":"events","description":"Per-customer event stream. Systems you connect push events with `POST /api/events/ingest` (`event:ingest`). The canonical onboarding types (`invitation.*`, `user.signed_in`, `customer.activated`) drive each customer's onboarding journey; see the *Lifecycle events* guide.","x-displayName":"Customer events"},{"name":"mcp","description":"JSON-RPC endpoints for AI agents. `/api/mcp/integration` gives an operator's machine credential the integration tools (connections, self-test, readiness, policy, manifests) as agent tools, under the same scopes and environment rules as the matching REST endpoints.","x-displayName":"MCP servers"},{"name":"partners","description":"Partner organisations, their readiness, and their vendor (partner-event) status.","x-displayName":"Partners"},{"name":"programs"},{"name":"organizations"},{"name":"relationships"},{"name":"groups"},{"name":"tags"},{"name":"application-form"},{"name":"onboarding"},{"name":"recruit"},{"name":"matching"},{"name":"directory"},{"name":"network"},{"name":"exchange"},{"name":"profile"},{"name":"profiles"},{"name":"portal"},{"name":"territories"},{"name":"locations"},{"name":"location-audits"},{"name":"mentorships"},{"name":"challenges"},{"name":"community"},{"name":"courses"},{"name":"engagement"},{"name":"journeys"},{"name":"journey-enrollments"},{"name":"campaigns"},{"name":"comarketing"},{"name":"mdf"},{"name":"materials"},{"name":"folders"},{"name":"feedback"},{"name":"feedback-points"},{"name":"customers","description":"Customer records. Partners see their own customers, and operators see the whole program.","x-displayName":"Customers"},{"name":"deals"},{"name":"leads"},{"name":"lead-routing"},{"name":"referrals"},{"name":"rw"},{"name":"cosell"},{"name":"crm"},{"name":"field-mappings"},{"name":"quotes"},{"name":"offerings"},{"name":"activities"},{"name":"bookings"},{"name":"capture"},{"name":"captures"},{"name":"inbound"},{"name":"sales-reports"},{"name":"commerce"},{"name":"commissions"},{"name":"commission-rules"},{"name":"earnings"},{"name":"balance"},{"name":"payouts"},{"name":"payout-batches"},{"name":"providers"},{"name":"invoices"},{"name":"royalties"},{"name":"tax"},{"name":"plan"},{"name":"tickets","description":"Support desk: tickets, threads, assignment, SLA escalation.","x-displayName":"Tickets"},{"name":"surveys","description":"CSAT and NPS surveys with a public, token-based response flow.","x-displayName":"Surveys"},{"name":"survey"},{"name":"health","description":"Customer health scoring and tiers.","x-displayName":"Customer health"},{"name":"metrics","description":"Operator-defined metrics (count, sum, unique) over the event stream.","x-displayName":"Metrics"},{"name":"dashboards","description":"Dashboards of metric, time-series and event-list widgets.","x-displayName":"Dashboards"},{"name":"reports"},{"name":"analytics"},{"name":"insights"},{"name":"risk"},{"name":"documents"},{"name":"compliance"},{"name":"subprocessors"},{"name":"audit"},{"name":"privacy"},{"name":"audit-templates"},{"name":"corrective-actions"},{"name":"ai"},{"name":"agents"},{"name":"copilot"},{"name":"coach"},{"name":"chat"},{"name":"briefs"},{"name":"playbooks"},{"name":"slack"},{"name":"auth","description":"User sessions: log in for a JWT and send it as `Authorization: Bearer <jwt>`. Also the public browser legs of single sign-on: SAML metadata / login / ACS, OIDC login / callback, and the one-time-code exchange.","x-displayName":"Auth"},{"name":"sso","description":"Per-org SSO connections (`type: \"saml\" | \"oidc\"`, one per email domain) and the SCIM provisioning tokens an IdP uses. Operator admins only (`sso:manage`). See the *Single sign-on & SCIM* guide.","x-displayName":"SSO & SCIM settings"},{"name":"scim","description":"`/scim/v2`, the user provisioning endpoint Okta and Entra ID call with `Authorization: Bearer scim_…`. Users only (Groups is always empty). Every call is scoped to the token's org. Deactivating a user removes that org's membership and nothing else.","x-displayName":"SCIM 2.0"},{"name":"roles"},{"name":"terminology"},{"name":"request-types"},{"name":"uploads"},{"name":"emails"},{"name":"public"},{"name":"sales","description":"Public sales inquiry form used by the marketing site and the console Plan page. Rate-limited per IP; returns no stored data.","x-displayName":"Talk to sales"},{"name":"system","description":"Liveness probe.","x-displayName":"System"},{"name":"finder"},{"name":"incentives"},{"name":"kyc"}],"x-tagGroups":[{"name":"Integrate your product","tags":["provisions","products","integrations","usage","subscriptions","webhooks","apikeys","oauth","v1","track","tracking","pw","imports","domains","whitelabel","mail","ingest","events","mcp"]},{"name":"Partners & program","tags":["partners","programs","organizations","relationships","groups","tags","application-form","onboarding","recruit","matching","directory","network","exchange","profile","profiles","portal","territories","locations","location-audits","mentorships","challenges","community","courses","engagement","journeys","journey-enrollments","campaigns","comarketing","mdf","materials","folders","feedback","feedback-points"]},{"name":"Sales & customers","tags":["customers","deals","leads","lead-routing","referrals","rw","cosell","crm","field-mappings","quotes","offerings","activities","bookings","capture","captures","inbound","sales-reports"]},{"name":"Money","tags":["commerce","commissions","commission-rules","earnings","balance","payouts","payout-batches","providers","invoices","royalties","tax","plan"]},{"name":"Customer success & analytics","tags":["tickets","surveys","survey","health","metrics","dashboards","reports","analytics","insights","risk"]},{"name":"Documents & compliance","tags":["documents","compliance","subprocessors","audit","privacy","audit-templates","corrective-actions"]},{"name":"AI & automation","tags":["ai","agents","copilot","coach","chat","briefs","playbooks","slack"]},{"name":"Platform","tags":["auth","sso","scim","roles","terminology","request-types","uploads","emails","public","sales","system"]},{"name":"Other","tags":["finder","incentives","kyc"]}],"x-webhooks":{"provisionRequest":{"post":{"summary":"Provision request (to your endpoint)","description":"Sent by PartnersWatch to your product's connection URL (`metadata.urls.provision`, `metadata.url` or `metadata.baseUrl`) when a provision is created or retried.\n\nDedupe on `ref`. One attempt can be sent up to 4 times (transport retries on timeout, network error, 5xx or 429), and a provision gets 5 attempts, spaced 1 minute, 5 minutes, 15 minutes and 1 hour apart.\n**A 4xx response is final**, except 401, 403, 404, 408 and 429. See the *Provisioning rail* guide.","parameters":[{"name":"x-partneros-timestamp","in":"header","required":false,"description":"Unix seconds when the delivery was signed. Absent on legacy unsigned connections.","schema":{"type":"string","example":"1767312000"}},{"name":"x-partneros-signature","in":"header","required":false,"description":"`v1=<hex>`, or several comma-separated while a rotated secret overlaps. HMAC-SHA256 with the connection's signing secret over `<timestamp>.<raw body>`. Accept if any value matches.","schema":{"type":"string","example":"v1=5d41402abc4b2a76b9719d911017c592"}},{"name":"authorization","in":"header","required":false,"description":"`Bearer <secret>`, the secret stored on the connection. With `metadata.auth: \"header:<Name>\"` it is sent as `<Name>: <secret>` instead.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","event","version","kind","ref","product","partner","customer","createdAt"],"properties":{"type":{"type":"string","enum":["provision"]},"event":{"type":"string","enum":["account.created","account.suspended","account.cancelled","credits.granted","units.granted","plan.changed","feature.changed","custom.applied"]},"version":{"type":"integer","enum":[1]},"kind":{"type":"string","enum":["credits","units","plan","feature","custom"]},"ref":{"type":"string","format":"uuid","description":"Provision id. The idempotency key."},"account":{"type":"string","nullable":true,"description":"Your account to act on: the caller's externalAccountId, else your previously returned id, else the onboard domain, else the customer email."},"quantity":{"type":"integer","nullable":true},"unit":{"type":"string","nullable":true},"attributes":{"type":"object","nullable":true,"additionalProperties":true,"description":"Caller instructions. Onboard provisions carry action, domain, ownerEmail, companyName, platform, location, domainVerified and, when PartnersWatch checked it, domainVerification. Plan provisions may carry planId, plan and planLabel."},"planCode":{"type":"string","description":"Your plan code (plans.config.externalPlanCode). Plan provisions with attributes.planId only."},"product":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"partner":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"brand":{"type":"object","nullable":true,"description":"The partner's live white-label brand — the snapshot taken at its last approval, which keeps serving while an edit is pending — or null when nothing is live. URLs are absolute.","properties":{"orgId":{"type":"string","format":"uuid"},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true,"description":"Square mark. Falls back to faviconUrl."},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true,"description":"Typeface family name (letters, digits, spaces, hyphens). Apply with your own fallback stack."},"fontUrl":{"type":"string","nullable":true,"description":"https stylesheet on fonts.googleapis.com or fonts.bunny.net that loads fontFamily."},"supportEmail":{"type":"string","nullable":true},"supportUrl":{"type":"string","nullable":true,"description":"Falls back to the partner's website."},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true}}},"relationship":{"type":"string","nullable":true},"billingMode":{"type":"string","nullable":true},"adminEmail":{"type":"string","nullable":true,"description":"Set only when the partner resells."},"revision":{"type":"integer","description":"Increases with every delivery. Ignore lower revisions."}}},"customer":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"company":{"type":"string","nullable":true}}},"note":{"type":"string","nullable":true},"createdAt":{"type":"string","format":"date-time"}}},"example":{"type":"provision","event":"plan.changed","version":1,"kind":"plan","ref":"6f1c2a7e-0b7c-4f61-9a55-3d2f4b8e9c10","account":"acct_123","quantity":null,"unit":null,"attributes":{"planId":"0b8f9a52-4c1e-4b0a-9f5e-1d2c3b4a5968","plan":"growth","planLabel":"Growth"},"planCode":"growth","product":{"id":"a1b2c3d4-0000-4000-8000-000000000001","name":"Example Analytics"},"partner":{"id":"a1b2c3d4-0000-4000-8000-000000000010","name":"Acme Consulting","brand":null,"relationship":"referral","billingMode":"commission","adminEmail":null,"revision":1767312000000},"customer":{"id":"a1b2c3d4-0000-4000-8000-000000000020","name":"Jane Doe","email":"jane@customer.example.com","company":"Customer Ltd"},"note":null,"createdAt":"2026-10-02T09:30:00.000Z"}}}},"responses":{"200":{"description":"Applied (or already applied for this `ref`).","content":{"application/json":{"schema":{"type":"object","description":"Any JSON object. `id` (or `externalId`) is stored as your account id and linked to the customer or partner. The whole object is kept on the delivery.","properties":{"id":{"type":"string","description":"Your account id."},"externalId":{"type":"string","description":"Alternative to `id`."}},"additionalProperties":true}}}},"422":{"description":"Rejected for good. The provision fails without retries (any 4xx except 401/403/404/408/429)."},"503":{"description":"Transient. Retried (5xx, 429, 401, 403, 404 and 408 are all retried)."}}}},"partnerEventRequest":{"post":{"summary":"Partner event (to your endpoint)","description":"Sent to your partner endpoint (`metadata.urls.partner`, `metadata.partnerUrl`, or the `/partner` sibling of a `/provision` URL) when a partner starts, changes or stops reselling your product. Live environment only.\n\nSame auth and signature as provisions. Key the account on `partner.id`. Retries: 5 attempts (1 m, 5 m, 15 m, 1 h) with no 4xx finality. 404, 502, 503 and 504 within 24 hours of creation are retried every 5 minutes. See the *Partner sync* guide.","parameters":[{"name":"x-partneros-timestamp","in":"header","required":false,"description":"Unix seconds when the delivery was signed. Absent on legacy unsigned connections.","schema":{"type":"string","example":"1767312000"}},{"name":"x-partneros-signature","in":"header","required":false,"description":"`v1=<hex>`, or several comma-separated while a rotated secret overlaps. HMAC-SHA256 with the connection's signing secret over `<timestamp>.<raw body>`. Accept if any value matches.","schema":{"type":"string","example":"v1=5d41402abc4b2a76b9719d911017c592"}},{"name":"authorization","in":"header","required":false,"description":"`Bearer <secret>`, the secret stored on the connection. With `metadata.auth: \"header:<Name>\"` it is sent as `<Name>: <secret>` instead.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["type","event","version","ref","product","partner","createdAt"],"properties":{"type":{"type":"string","enum":["partner"]},"event":{"type":"string","enum":["partner.connected","partner.updated","partner.disconnected"]},"version":{"type":"integer","enum":[1]},"ref":{"type":"string","format":"uuid","description":"Delivery id, for logs and dedupe."},"product":{"type":"object","required":["id","name"],"properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"partner":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"brand":{"type":"object","nullable":true,"description":"The partner's live white-label brand — the snapshot taken at its last approval, which keeps serving while an edit is pending — or null when nothing is live. URLs are absolute.","properties":{"orgId":{"type":"string","format":"uuid"},"brandName":{"type":"string","nullable":true},"logoUrl":{"type":"string","nullable":true},"iconUrl":{"type":"string","nullable":true,"description":"Square mark. Falls back to faviconUrl."},"faviconUrl":{"type":"string","nullable":true},"primaryColor":{"type":"string","nullable":true},"accentColor":{"type":"string","nullable":true},"fontFamily":{"type":"string","nullable":true,"description":"Typeface family name (letters, digits, spaces, hyphens). Apply with your own fallback stack."},"fontUrl":{"type":"string","nullable":true,"description":"https stylesheet on fonts.googleapis.com or fonts.bunny.net that loads fontFamily."},"supportEmail":{"type":"string","nullable":true},"supportUrl":{"type":"string","nullable":true,"description":"Falls back to the partner's website."},"termsUrl":{"type":"string","nullable":true},"privacyUrl":{"type":"string","nullable":true},"billingUrl":{"type":"string","nullable":true},"senderName":{"type":"string","nullable":true},"senderEmail":{"type":"string","nullable":true},"senderDomain":{"type":"string","nullable":true}}},"relationship":{"type":"string","nullable":true},"billingMode":{"type":"string","nullable":true},"adminEmail":{"type":"string","nullable":true,"description":"The partner's first partner_admin."},"domain":{"type":"string","nullable":true,"description":"A DNS-verified hostname the partner wants you to serve (purpose vendor_app)."},"revision":{"type":"integer"}}},"createdAt":{"type":"string","format":"date-time"}}},"example":{"type":"partner","event":"partner.connected","version":1,"ref":"3b0e8c1d-2f4a-4b6c-8d9e-0a1b2c3d4e5f","product":{"id":"a1b2c3d4-0000-4000-8000-000000000001","name":"Example Analytics"},"partner":{"id":"a1b2c3d4-0000-4000-8000-000000000010","name":"Acme Consulting","brand":null,"relationship":"whitelabel","billingMode":"resale","adminEmail":"owner@acme.example.com","domain":"app.acme.example.com","revision":1767312000000},"createdAt":"2026-10-02T09:30:00.000Z"}}}},"responses":{"200":{"description":"Applied. Optionally tell the partner what to publish for `partner.domain`.","content":{"application/json":{"schema":{"type":"object","description":"Any JSON object. `id` (or `externalId`) is stored as your account id and linked to the customer or partner. The whole object is kept on the delivery.","properties":{"id":{"type":"string","description":"Your account id."},"externalId":{"type":"string","description":"Alternative to `id`."},"domainVerification":{"type":"object","description":"Shown to the partner beside the PartnersWatch domain check.","properties":{"cnameTarget":{"type":"string"},"txtHost":{"type":"string"},"txtValue":{"type":"string"},"status":{"type":"string"},"reason":{"type":"string"},"checkedAt":{"type":"string"}}}},"additionalProperties":true}}}}}}},"webhookDelivery":{"post":{"summary":"Webhook delivery (to your endpoint)","description":"Sent to each active webhook endpoint subscribed to the event type, when the event belongs to the endpoint's org (or names it as `payload.programOrgId`).\n\nVerify `X-PartnerOS-Signature: t=<unix>,v1=<hex>`, which is HMAC-SHA256 with the endpoint secret over `<t>.<raw body>`. During a secret rotation's grace window the header carries one `v1` per secret, newest first (`t=…,v1=<new>,v1=<old>`): accept if any matches. Dedupe on the envelope `id`. Any non-2xx is retried: 5 attempts, 1 m, 5 m, 15 m, 1 h. See the *Outbound webhooks* guide.","parameters":[{"name":"X-PartnerOS-Signature","in":"header","required":true,"schema":{"type":"string","example":"t=1767312000,v1=5d41402abc4b2a76b9719d911017c592"}},{"name":"X-PartnerOS-Event","in":"header","required":true,"schema":{"type":"string","example":"deal.won"}},{"name":"X-PartnerOS-Delivery","in":"header","required":true,"description":"This endpoint's delivery id. A replay re-sends the same id.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id","type","subjectType","subjectId","orgId","actorId","payload","createdAt"],"properties":{"id":{"type":"string","format":"uuid","description":"Event id. The same across retries and endpoints."},"type":{"type":"string","description":"Event type, e.g. deal.won. See GET /api/v1/hooks/events."},"subjectType":{"type":"string"},"subjectId":{"type":"string"},"orgId":{"type":"string","nullable":true},"actorId":{"type":"string","nullable":true},"payload":{"type":"object","additionalProperties":true},"createdAt":{"type":"string","format":"date-time"}}},"example":{"id":"9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a","type":"deal.won","subjectType":"deal","subjectId":"a1b2c3d4-0000-4000-8000-000000000030","orgId":"a1b2c3d4-0000-4000-8000-000000000010","actorId":null,"payload":{"from":"proposal","to":"won"},"createdAt":"2026-10-02T09:30:00.000Z"}}}},"responses":{"200":{"description":"Received. Any 2xx counts."}}}}}}