From b47f060af65613407976b4fa664e06062b549334 Mon Sep 17 00:00:00 2001 From: Lucas-FullStackX Date: Thu, 22 Oct 2026 13:06:18 -0500 Subject: [PATCH 1/5] feat(admin): authenticate ft admin with a service token via FT_ADMIN_TOKEN Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fo7cm88pv5nC6H9aXKtwc1 --- .changeset/admin-service-token.md | 5 ++++ README.md | 2 ++ src/lib/admin-auth.test.ts | 44 +++++++++++++++++++++++++++++++ src/lib/api.ts | 30 +++++++++++++++------ 4 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 .changeset/admin-service-token.md create mode 100644 src/lib/admin-auth.test.ts diff --git a/.changeset/admin-service-token.md b/.changeset/admin-service-token.md new file mode 100644 index 0000000..420161f --- /dev/null +++ b/.changeset/admin-service-token.md @@ -0,0 +1,5 @@ +--- +"@freeticket/cli": minor +--- + +`ft admin` authenticates with a platform service token: set `FT_ADMIN_TOKEN` and it is sent as `Authorization: Bearer`, ahead of the session cookie. diff --git a/README.md b/README.md index 591dc41..4c22c69 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,8 @@ flags > environment variables > ~/.freeticket/config.json > defaults | `FT_API_URL` | `https://admin.appfreeticket.com` | API base URL (without `/api/v1`) | | `FT_API_KEY` | — | CI/headless only — a backend-issued `ft_live_...` token. Browser login (`ft login`) needs no key. When set it is the **only** account: stored logins are ignored, nothing fans out across them, and `--account` is rejected. A workspace pinned with `ft workspace use` still applies | | `FT_WORKSPACE_ID` | *home* | Default active workspace | +| `FT_ADMIN_TOKEN` | — | `ft admin` only — a platform service token (`ft admin tokens create`), sent as `Authorization: Bearer`. Takes precedence over the session cookie | +| `FT_ADMIN_SESSION` | — | `ft admin` only — a SUPER_ADMIN `better-auth.session_token` cookie (same as `ft admin login --session`) | | `FT_NO_UPDATE_CHECK` | — | Set to disable the "update available" notice (checked at most once a day; also off in CI, without a TTY, and with `--json`/`--raw`/`--csv`) | Logins are stored per account under `accounts` in `~/.freeticket/config.json` diff --git a/src/lib/admin-auth.test.ts b/src/lib/admin-auth.test.ts new file mode 100644 index 0000000..89b26b5 --- /dev/null +++ b/src/lib/admin-auth.test.ts @@ -0,0 +1,44 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { client as adminClient } from "../admin-client/client.gen"; +import { configureAdminClient } from "./api"; + +const saved = { ...process.env }; + +describe("configureAdminClient", () => { + beforeEach(() => { + process.env.FT_API_URL = "http://admin.localhost:3000"; + delete process.env.FT_ADMIN_TOKEN; + delete process.env.FT_ADMIN_SESSION; + }); + afterEach(() => { + process.env = { ...saved }; + vi.restoreAllMocks(); + }); + + function headers(): Headers { + return new Headers( + adminClient.getConfig().headers as ConstructorParameters< + typeof Headers + >[0], + ); + } + + it("sends FT_ADMIN_TOKEN as a Bearer service token, without the cookie", () => { + process.env.FT_ADMIN_TOKEN = "ftpat_test"; + process.env.FT_ADMIN_SESSION = "cookie_should_lose"; + configureAdminClient(); + expect(adminClient.getConfig().baseUrl).toBe( + "http://admin.localhost:3000/api/admin", + ); + expect(headers().get("authorization")).toBe("Bearer ftpat_test"); + expect(headers().get("cookie")).toBeNull(); + }); + + it("falls back to the session cookie when no token is set", () => { + process.env.FT_ADMIN_SESSION = "sess_123"; + configureAdminClient(); + expect(headers().get("cookie")).toBe("better-auth.session_token=sess_123"); + // The Bearer from the previous test must not linger on the singleton. + expect(headers().get("authorization")).toBeNull(); + }); +}); diff --git a/src/lib/api.ts b/src/lib/api.ts index 3026154..db9dc60 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -71,23 +71,37 @@ export function configureClient( } /** - * Configures the superadmin client (/api/admin). Auth is a better-auth session - * cookie of a SUPER_ADMIN — NOT an API key (the admin contract issues no keys). - * MVP: paste the session token via FT_ADMIN_SESSION; converges to a service - * token once the backend ships it (see free-admin#157). - * ponytail: cookie header until the Bearer service-token lands. + * Configures the superadmin client (/api/admin). Two credentials, in order: + * + * 1. `FT_ADMIN_TOKEN` — a platform service token (PAT, minted with + * `ft admin tokens create`), sent as `Authorization: Bearer`. The headless + * path for CI and scripts. With a Bearer present the backend never falls + * back to the cookie, so a bad token is a 401, not a silent session. + * 2. The SUPER_ADMIN better-auth session cookie (`FT_ADMIN_SESSION` or + * `ft admin login`). */ export function configureAdminClient(): void { const cfg = loadConfig(); + const baseUrl = `${cfg.apiUrl.replace(/\/$/, "")}/api/admin`; + const token = process.env.FT_ADMIN_TOKEN?.trim(); + if (token) { + adminClient.setConfig({ + baseUrl, + // setConfig merges headers: null drops a credential left by an earlier call. + headers: { Authorization: `Bearer ${token}`, Cookie: null }, + }); + return; + } if (!cfg.adminSession) { fail( - "No superadmin session. Export FT_ADMIN_SESSION with a SUPER_ADMIN better-auth session token.", - "Log in to the admin panel in your browser and copy the `better-auth.session_token` cookie.", + "No superadmin credential. Export FT_ADMIN_TOKEN with a service token, or FT_ADMIN_SESSION with a SUPER_ADMIN better-auth session token.", + "Mint a token with `ft admin tokens create`, or log in to the admin panel and copy the `better-auth.session_token` cookie (`ft admin login --session `).", ); } adminClient.setConfig({ - baseUrl: `${cfg.apiUrl.replace(/\/$/, "")}/api/admin`, + baseUrl, headers: { + Authorization: null, Cookie: `better-auth.session_token=${cfg.adminSession}`, }, }); From 8fdc3096af2efe38a37b43a5ef86e1b8dcee2da0 Mon Sep 17 00:00:00 2001 From: Lucas-FullStackX Date: Thu, 22 Oct 2026 13:11:07 -0500 Subject: [PATCH 2/5] feat(admin): ft admin crm commands for the master CRM Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fo7cm88pv5nC6H9aXKtwc1 --- .changeset/admin-crm.md | 5 + README.md | 100 ++++++ src/commands/admin-crm.test.ts | 394 +++++++++++++++++++++++ src/commands/admin-crm.ts | 536 ++++++++++++++++++++++++++++++++ src/commands/admin.ts | 3 + src/destructive-confirm.test.ts | 127 ++++++++ src/lib/api.ts | 4 +- src/program.test.ts | 18 ++ 8 files changed, 1186 insertions(+), 1 deletion(-) create mode 100644 .changeset/admin-crm.md create mode 100644 src/commands/admin-crm.test.ts create mode 100644 src/commands/admin-crm.ts diff --git a/.changeset/admin-crm.md b/.changeset/admin-crm.md new file mode 100644 index 0000000..4e4d6d6 --- /dev/null +++ b/.changeset/admin-crm.md @@ -0,0 +1,5 @@ +--- +"@freeticket/cli": minor +--- + +New `ft admin crm` commands for the master CRM (admin contract 1.7.0): list and inspect campaigns, search shows and dates, read options and the WhatsApp quota, preview an audience, launch a campaign, send or stop WhatsApp batches and cancel a scheduled campaign. Every write previews its target and asks for confirmation (`--yes` in scripts), and none is retried automatically. diff --git a/README.md b/README.md index 4c22c69..c6bdf8e 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ ft sales list --status CONFIRMED --json | `ft merch products publish ` · `unpublish ` | Show / hide a product in the store (publishing needs the store setup done and an active variant) | ADMIN / MERCH_MANAGER | | `ft api-keys create ` · `list` · `revoke ` | Self-service API keys (the secret is shown once, never stored) | ADMIN | | `ft admin login` · `me` · `workspaces` · `users` · `plans` · `feature-flags` · `tokens` · `audit-log` | Superadmin, cross-tenant — needs a SUPER_ADMIN session, not an API key. Includes `admin workspaces plan ` (assisted plan assignment), `plan-show ` (current plan) and `delete ` (soft delete; suspend first) and `webTemplate` / `customDomain` on `update` | SUPER_ADMIN | +| `ft admin crm campaigns` · `batches` · `events` · `options` · `quota` · `preview` · `launch` | Master CRM: email / WhatsApp campaigns to buyers across workspaces. See [`ft admin crm`](#ft-admin-crm) | SUPER_ADMIN | > **Write operations** (`create`/`update`/`delete` and actions like `publish`, > `cancel`, `refund`) send a JSON body via `--data ` or @@ -147,6 +148,105 @@ ft sales list --status CONFIRMED --json | `--csv` | list commands | CSV output for spreadsheets/accounting | | `--data ` `--yes` | write commands | JSON body (inline or `@file`) · skip delete confirmation | +## `ft admin crm` + +The master CRM for the internal team: email and WhatsApp campaigns to buyers, +across every workspace, against `/api/admin/crm`. It needs a SUPER_ADMIN +credential — `FT_ADMIN_TOKEN` (a service token from `ft admin tokens create`) +or `ft admin login --session`. + +```bash +ft admin crm campaigns list [--channel EMAIL|WHATSAPP] [--status S] [--limit N] +ft admin crm campaigns get +ft admin crm campaigns cancel [--yes] +ft admin crm batches next [--ignore-window] [--yes] +ft admin crm batches stop [--yes] +ft admin crm events search [--purpose scope|promote|except] [--sender ] +ft admin crm events dates +ft admin crm options +ft admin crm quota +ft admin crm preview --filter @filter.json [--sender freeticket|] +ft admin crm launch --data @campaign.json [--yes] +``` + +**Writes send real messages.** `launch`, `campaigns cancel`, `batches next` and +`batches stop` first show what they are about to touch — `launch` runs the +audience preview with the same filter and sender (total, how many have email +or reachable WhatsApp, the estimated days at the daily quota); the others show +the campaign — and then ask for confirmation. Without a TTY they refuse unless +you pass `--yes`. The CLI never retries a write on its own: if a `launch` +times out, check `campaigns list` before launching again (the backend rejects +the same channel + sender + subject within 10 minutes with +`DUPLICATE_CAMPAIGN` and prints the existing id). + +Named errors get a next step: `OUTSIDE_SEND_WINDOW` (WhatsApp sends only +9:00-20:00 Bogotá) prints when the window opens and suggests `--ignore-window`; +`QUOTA_EXHAUSTED` prints when the quota frees up; `INVALID_STATE` means the +campaign no longer allows that action; a 422 lists each `details[].path`. + +Find the ids for a filter with `events search` and `events dates`, and the +cities, genre/format codes, plans and WhatsApp templates with `options`. + +### `filter.json` (audience filter v2) + +```json +{ + "version": 2, + "scope": { "level": "platform" }, + "include": [ + { "type": "purchased", "eventIds": ["evt_123"], "window": { "kind": "last_days", "days": 90 } } + ], + "except": [ + { "type": "received_campaign", "days": 7, "channel": "any" } + ] +} +``` + +- `scope` (default `platform`): `{ "level": "orgs", "workspaceIds": [...] }` or + `{ "level": "events", "eventIds": [...] }`. +- `include` conditions combine with AND; `except` with OR, evaluated across the + whole platform. Up to 12 per block, 50 ids per list. +- Condition types: `purchased`, `abandoned`, `checked_in` (with optional + `eventIds`, `dateIds` + `dateEventIds`, `window`), `city` (`cities`), + `facet` (`dimension`: `genre` | `format`, `codes`), `membership` (`state`: + `active` | `expiring` | `cancelled`, `withinDays` for `expiring`, `planIds`), + `spend` (`minCop`, `maxCop`), `received_campaign` (`except` only: `days`, + `channel`), `people` (`include` only: `emails`). +- `window`: `{ "kind": "any" }` (default), `{ "kind": "last_days", "days": 7|30|90 }` + or `{ "kind": "range", "from": "2026-09-01", "to": "2026-09-30" }` (Bogotá dates). +- Without a state condition (`purchased`, `abandoned`, `checked_in`, + `membership`, `people`) in `include`, the audience defaults to confirmed + buyers plus active members. + +### `campaign.json` + +```json +{ + "channel": "WHATSAPP", + "sender": { "kind": "freeticket" }, + "templateName": "promo_show", + "subject": "New date in Medellín", + "body": "We just opened a second show. Get your tickets before they are gone.", + "promotedEventId": "evt_123", + "filter": { + "version": 2, + "include": [{ "type": "purchased", "eventIds": ["evt_123"] }], + "except": [] + }, + "timing": { "mode": "batches", "firstAt": "2026-11-03T10:00:00-05:00", "batchSize": 50, "perDay": 3, "intervalMinutes": 120 } +} +``` + +- `sender`: `{ "kind": "freeticket" }` or `{ "kind": "organization", "workspaceId": "..." }`. + FreeTicket is mandatory when the scope spans the platform, several + organizations or events of more than one owner (`preview` tells you). +- WhatsApp needs an approved `templateName` (see `options`); email rejects one. + `imageUrl` for WhatsApp must come from the media library. +- `timing`: `{ "mode": "now" }` (sends on response), `{ "mode": "scheduled", "at": "" }` + or `batches` (WhatsApp only, daily cap 150 when FreeTicket signs, 200 for an + organization). WhatsApp times are moved into the 9:00-20:00 Bogotá window; + the response's `scheduledAt` is the real one. + ## Configuration `ft` resolves configuration in this precedence order: diff --git a/src/commands/admin-crm.test.ts b/src/commands/admin-crm.test.ts new file mode 100644 index 0000000..922f1b1 --- /dev/null +++ b/src/commands/admin-crm.test.ts @@ -0,0 +1,394 @@ +import { Command } from "commander"; +import { + afterEach, + beforeEach, + describe, + expect, + it, + type MockInstance, + vi, +} from "vitest"; + +const sdk = vi.hoisted(() => ({ + getCrmCampaigns: vi.fn(), + getCrmCampaignsId: vi.fn(), + getCrmEvents: vi.fn(), + getCrmEventDates: vi.fn(), + postCrmAudiencePreview: vi.fn(), + postCrmCampaigns: vi.fn(), + postCrmCampaignsIdBatchesNext: vi.fn(), +})); + +vi.mock("../admin-client/sdk.gen", async (importOriginal) => ({ + ...(await importOriginal()), + ...sdk, +})); + +const { crmErrorHint, describeWhen, parseSender, previewSummary } = + await import("./admin-crm"); +const { registerAdmin } = await import("./admin"); + +const PREVIEW = { + counts: { + matched: 120, + excludedByExcept: 5, + excludedByFrequency: 3, + suppressed: 2, + total: 110, + reachableWhatsapp: 80, + withoutPhone: 30, + }, + sample: [], + involvedWorkspaceIds: ["ws_1"], + senderChoice: { + forced: false as const, + organization: { id: "ws_1", name: "Teatro", logoUrl: null }, + }, + whatsappEstimate: { days: 2, dailyCap: 50, remainingToday: 30 }, +}; + +const CAMPAIGN = { + id: "cmp_1", + subject: "Hello", + channel: "WHATSAPP", + status: "PROCESSING", + senderName: "FreeTicket", + recipientCount: 110, + sentCount: 40, + failedCount: 0, + scheduledAt: null, + nextBatchAt: "2026-11-03T14:00:00.000Z", +}; + +const ok = (data: unknown) => ({ data: { data }, response: new Response() }); +const apiError = ( + status: number, + error: Record, + headers: Record = {}, +) => ({ + data: undefined, + error: { error: { retryable: false, ...error } }, + response: new Response(null, { status, headers }), +}); + +function build(): Command { + const program = new Command(); + program.exitOverride(); + registerAdmin(program); + return program; +} + +function crmTree(): Command { + const admin = build().commands.find((c) => c.name() === "admin") as Command; + return admin.commands.find((c) => c.name() === "crm") as Command; +} + +describe("ft admin crm command tree", () => { + it("registers every documented subcommand", () => { + const crm = crmTree(); + const names = (c: Command) => c.commands.map((s) => s.name()).sort(); + expect(names(crm)).toEqual([ + "batches", + "campaigns", + "events", + "launch", + "options", + "preview", + "quota", + ]); + const sub = (n: string) => + crm.commands.find((c) => c.name() === n) as Command; + expect(names(sub("campaigns"))).toEqual(["cancel", "get", "list"]); + expect(names(sub("batches"))).toEqual(["next", "stop"]); + expect(names(sub("events"))).toEqual(["dates", "search"]); + }); + + it("puts every write behind --yes", () => { + const crm = crmTree(); + const find = (path: string[]) => + path.reduce( + (c, n) => c.commands.find((s) => s.name() === n) as Command, + crm, + ); + for (const p of [ + ["launch"], + ["campaigns", "cancel"], + ["batches", "next"], + ["batches", "stop"], + ]) + expect(find(p).options.map((o) => o.long)).toContain("--yes"); + expect(find(["batches", "next"]).options.map((o) => o.long)).toContain( + "--ignore-window", + ); + }); +}); + +describe("ft admin crm commands", () => { + const env = { ...process.env }; + let stdout: string; + let stderr: string[]; + let exit: MockInstance; + + beforeEach(() => { + process.env.FT_ADMIN_TOKEN = "ftpat_test"; + stdout = ""; + stderr = []; + vi.spyOn(process.stdout, "write").mockImplementation( + (chunk: string | Uint8Array) => { + stdout += String(chunk); + return true; + }, + ); + vi.spyOn(console, "log").mockImplementation((...a) => { + stdout += `${a.join(" ")}\n`; + }); + vi.spyOn(console, "error").mockImplementation((...a) => { + stderr.push(a.join(" ")); + }); + exit = vi.spyOn(process, "exit").mockImplementation((() => { + throw new Error("exited"); + }) as never); + }); + + afterEach(() => { + process.env = { ...env }; + vi.restoreAllMocks(); + for (const fn of Object.values(sdk)) fn.mockReset(); + }); + + const run = (...args: string[]) => + build().parseAsync(["node", "ft", "admin", "crm", ...args]); + + it("campaigns list passes the filters through, upper-cased", async () => { + sdk.getCrmCampaigns.mockResolvedValue(ok([CAMPAIGN])); + await run( + "campaigns", + "list", + "--channel", + "whatsapp", + "--status", + "scheduled", + "--limit", + "5", + "--json", + ); + expect(sdk.getCrmCampaigns).toHaveBeenCalledWith({ + query: { channel: "WHATSAPP", status: "SCHEDULED", limit: 5 }, + }); + expect(JSON.parse(stdout)).toEqual([CAMPAIGN]); + }); + + it("events search sends query, purpose and the sender workspace", async () => { + sdk.getCrmEvents.mockResolvedValue(ok([])); + await run( + "events", + "search", + "stand up", + "--purpose", + "promote", + "--sender", + "ws_1", + "--json", + ); + expect(sdk.getCrmEvents).toHaveBeenCalledWith({ + query: { + query: "stand up", + purpose: "promote", + senderWorkspaceId: "ws_1", + }, + }); + }); + + it("events search defaults --purpose to scope", async () => { + sdk.getCrmEvents.mockResolvedValue(ok([])); + await run("events", "search", "jazz", "--json"); + expect(sdk.getCrmEvents.mock.calls[0]?.[0].query.purpose).toBe("scope"); + }); + + it("events dates joins every id (spaces or commas) into eventIds", async () => { + sdk.getCrmEventDates.mockResolvedValue(ok([])); + await run("events", "dates", "evt_1", "evt_2,evt_3", "--json"); + expect(sdk.getCrmEventDates).toHaveBeenCalledWith({ + query: { eventIds: "evt_1,evt_2,evt_3" }, + }); + }); + + it("preview maps --sender to the contract shape", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue(ok(PREVIEW)); + const filter = { version: 2, include: [], except: [] }; + await run( + "preview", + "--filter", + JSON.stringify(filter), + "--sender", + "ws_1", + "--json", + ); + expect(sdk.postCrmAudiencePreview).toHaveBeenCalledWith({ + body: { filter, sender: { kind: "organization", workspaceId: "ws_1" } }, + }); + }); + + it("launch --yes previews with the same filter and sender, then posts once", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue(ok(PREVIEW)); + sdk.postCrmCampaigns.mockResolvedValue( + ok({ id: "cmp_9", status: "APPROVED", scheduledAt: null }), + ); + const input = { + channel: "WHATSAPP", + sender: { kind: "freeticket" }, + templateName: "promo", + subject: "Hello", + body: "Hi", + filter: { + version: 2, + include: [{ type: "purchased", eventIds: ["evt_1"] }], + except: [], + }, + timing: { mode: "now" }, + }; + await run("launch", "--data", JSON.stringify(input), "--yes", "--json"); + expect(sdk.postCrmAudiencePreview).toHaveBeenCalledWith({ + body: { filter: input.filter, sender: input.sender }, + }); + expect(sdk.postCrmCampaigns).toHaveBeenCalledTimes(1); + expect(sdk.postCrmCampaigns).toHaveBeenCalledWith({ body: input }); + // Preview went to stderr; stdout is the launch result only. + expect(stderr.join("\n")).toContain("reachable by WhatsApp: 80"); + expect(stderr.join("\n")).toContain("~2 day(s)"); + expect(JSON.parse(stdout)).toEqual({ + id: "cmp_9", + status: "APPROVED", + scheduledAt: null, + }); + }); + + it("launch stops on an empty audience without posting", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue( + ok({ ...PREVIEW, counts: { ...PREVIEW.counts, total: 0 } }), + ); + await expect( + run( + "launch", + "--data", + JSON.stringify({ filter: { version: 2 } }), + "--yes", + ), + ).rejects.toThrow("exited"); + expect(sdk.postCrmCampaigns).not.toHaveBeenCalled(); + }); + + it("launch shows the existing id on DUPLICATE_CAMPAIGN and does not retry", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue(ok(PREVIEW)); + sdk.postCrmCampaigns.mockResolvedValue( + apiError(409, { + code: "DUPLICATE_CAMPAIGN", + message: "Ya lanzaste esta campaña.", + details: { existingId: "cmp_old" }, + }), + ); + await expect( + run( + "launch", + "--data", + JSON.stringify({ filter: { version: 2 }, channel: "EMAIL" }), + "--yes", + ), + ).rejects.toThrow("exited"); + expect(exit).toHaveBeenCalledWith(1); + expect(sdk.postCrmCampaigns).toHaveBeenCalledTimes(1); + const err = stderr.join("\n"); + expect(err).toContain("[DUPLICATE_CAMPAIGN]"); + expect(err).toContain("ft admin crm campaigns get cmp_old"); + }); + + it("batches next --ignore-window sends ignoreSendWindow", async () => { + sdk.getCrmCampaignsId.mockResolvedValue(ok(CAMPAIGN)); + sdk.postCrmCampaignsIdBatchesNext.mockResolvedValue(ok({ batch: 50 })); + await run("batches", "next", "cmp_1", "--ignore-window", "--yes", "--json"); + expect(sdk.postCrmCampaignsIdBatchesNext).toHaveBeenCalledWith({ + path: { id: "cmp_1" }, + body: { ignoreSendWindow: true }, + }); + }); + + it("batches next without the flag sends no body", async () => { + sdk.getCrmCampaignsId.mockResolvedValue(ok(CAMPAIGN)); + sdk.postCrmCampaignsIdBatchesNext.mockResolvedValue(ok({ batch: 50 })); + await run("batches", "next", "cmp_1", "--yes", "--json"); + expect(sdk.postCrmCampaignsIdBatchesNext).toHaveBeenCalledWith({ + path: { id: "cmp_1" }, + }); + }); + + it("OUTSIDE_SEND_WINDOW says when it opens and suggests --ignore-window, once", async () => { + sdk.getCrmCampaignsId.mockResolvedValue(ok(CAMPAIGN)); + sdk.postCrmCampaignsIdBatchesNext.mockResolvedValue( + apiError( + 409, + { + code: "OUTSIDE_SEND_WINDOW", + message: "Fuera de la ventana de envío.", + retryable: true, + }, + { "Retry-After": "3600" }, + ), + ); + await expect(run("batches", "next", "cmp_1", "--yes")).rejects.toThrow( + "exited", + ); + expect(sdk.postCrmCampaignsIdBatchesNext).toHaveBeenCalledTimes(1); + const err = stderr.join("\n"); + expect(err).toContain("[OUTSIDE_SEND_WINDOW]"); + expect(err).toContain("opens"); + expect(err).toContain("in 1h 0m"); + expect(err).toContain("--ignore-window"); + }); + + it("422 lists details[].path", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue( + apiError(422, { + code: "VALIDATION_ERROR", + message: "Filtro inválido.", + details: [{ path: "filter.scope.level", message: "Invalid input" }], + }), + ); + await expect( + run("preview", "--filter", '{"version":2,"scope":{"level":"x"}}'), + ).rejects.toThrow("exited"); + expect(stderr.join("\n")).toContain("· filter.scope.level: Invalid input"); + }); +}); + +describe("helpers", () => { + it("parseSender", () => { + expect(parseSender("freeticket")).toEqual({ kind: "freeticket" }); + expect(parseSender("FreeTicket")).toEqual({ kind: "freeticket" }); + expect(parseSender("ws_1")).toEqual({ + kind: "organization", + workspaceId: "ws_1", + }); + }); + + it("describeWhen renders Bogotá time and the delay", () => { + const now = Date.parse("2026-11-03T02:00:00.000Z"); // 21:00 Bogotá + const s = describeWhen(12 * 3600, now); // 09:00 Bogotá + expect(s).toContain("9:00 AM (Bogotá)"); + expect(s).toContain("in 12h 0m"); + expect(s).toContain("2026-11-03T14:00:00.000Z"); + }); + + it("crmErrorHint names QUOTA_EXHAUSTED and leaves unknown codes alone", () => { + expect(crmErrorHint({ code: "QUOTA_EXHAUSTED" }, 60)).toContain( + "quota is used up", + ); + expect(crmErrorHint({ code: "NOT_FOUND" }, undefined)).toBeNull(); + }); + + it("previewSummary leaves out the WhatsApp estimate for email", () => { + const email = previewSummary(PREVIEW, "EMAIL").join("\n"); + expect(email).toContain("110 people"); + expect(email).not.toContain("day(s)"); + expect(email).toContain("Teatro (ws_1)"); + }); +}); diff --git a/src/commands/admin-crm.ts b/src/commands/admin-crm.ts new file mode 100644 index 0000000..dbd5bdf --- /dev/null +++ b/src/commands/admin-crm.ts @@ -0,0 +1,536 @@ +import chalk from "chalk"; +import type { Command } from "commander"; +import { + getCrmCampaigns, + getCrmCampaignsId, + getCrmEventDates, + getCrmEvents, + getCrmOptions, + getCrmQuota, + postCrmAudiencePreview, + postCrmCampaigns, + postCrmCampaignsIdBatchesNext, + postCrmCampaignsIdBatchesStop, + postCrmCampaignsIdCancel, +} from "../admin-client/sdk.gen"; +import type { + AdminCrmAudienceFilter, + AdminCrmAudiencePreview, + AdminCrmCampaignDetail, + AdminCrmLaunchInput, + AdminCrmSender, +} from "../admin-client/types.gen"; +import { configureAdminClient, fail, unwrap } from "../lib/api"; +import { confirmOrExit, parseData } from "../lib/input"; +import { print, resolveColumns, toCsv } from "../lib/output"; + +/** + * `ft admin crm …` — the master CRM (/api/admin/crm) for the internal team. + * + * Every write sends real messages to real customers, so: + * - each one shows what it is about to touch (audience preview for `launch`, + * the campaign for `cancel` / `batches`) and then goes through + * `confirmOrExit` — no TTY and no `--yes` is a hard stop; + * - POSTs are never retried by the CLI. A timeout on `launch` may still have + * created the campaign; the backend's DUPLICATE_CAMPAIGN guard (same + * channel, sender and subject within 10 minutes) is the safety net, and the + * error points at the existing id. + */ + +const CAMPAIGN_COLUMNS = [ + "id", + "subject", + "channel", + "status", + "senderName", + "recipientCount", + "sentCount", + "failedCount", + "scheduledAt", + "nextBatchAt", + "createdAt", +]; + +const EVENT_COLUMNS = [ + "id", + "name", + "orgName", + "status", + "city", + "dateCount", + "nextAt", + "lastAt", +]; + +const DATE_COLUMNS = [ + "id", + "eventId", + "startsAt", + "label", + "status", + "venueName", + "city", + "past", + "buyers", +]; + +type SdkResult = { data?: T; error?: unknown; response: Response }; + +type CrmError = { + code?: string; + message?: string; + retryable?: boolean; + details?: unknown; +}; + +/** `Retry-After` (seconds) of a response, if the backend sent one. */ +function retryAfterSeconds(res: Response | undefined): number | undefined { + const raw = res?.headers.get("retry-after"); + if (!raw) return undefined; + const n = Number(raw); + if (Number.isFinite(n)) return n; + const at = Date.parse(raw); + return Number.isNaN(at) + ? undefined + : Math.max(0, Math.round((at - Date.now()) / 1000)); +} + +/** "Nov 3, 7:00 PM (Bogotá), in 2h 15m" for a delay in seconds. */ +export function describeWhen(seconds: number, now = Date.now()): string { + const at = new Date(now + seconds * 1000); + const local = at.toLocaleString("en-US", { + timeZone: "America/Bogota", + month: "short", + day: "numeric", + hour: "numeric", + minute: "2-digit", + }); + const mins = Math.ceil(seconds / 60); + const h = Math.floor(mins / 60); + const m = mins % 60; + const rel = h > 0 ? `${h}h ${m}m` : `${m}m`; + return `${local} (Bogotá), in ${rel} — ${at.toISOString()}`; +} + +/** + * The error message + next step for the CRM's named errors. `null` when the + * code is not one of them (the generic `unwrap` handles it). + */ +export function crmErrorHint( + err: CrmError, + retryAfter: number | undefined, +): string | null { + switch (err.code) { + case "OUTSIDE_SEND_WINDOW": + return [ + retryAfter !== undefined + ? `The WhatsApp send window (9:00-20:00 Bogotá) opens ${describeWhen(retryAfter)}.` + : "The WhatsApp send window (9:00-20:00 Bogotá) is closed.", + "Retry then, or pass --ignore-window to send this batch now.", + ].join("\n"); + case "DUPLICATE_CAMPAIGN": { + const id = (err.details as { existingId?: string } | undefined) + ?.existingId; + return id + ? `A campaign with the same channel, sender and subject was launched less than 10 minutes ago: ${id}\nSee it with \`ft admin crm campaigns get ${id}\`. Change the subject if this one is really different.` + : "A campaign with the same channel, sender and subject was launched less than 10 minutes ago. Check `ft admin crm campaigns list`."; + } + case "QUOTA_EXHAUSTED": + return retryAfter !== undefined + ? `The daily WhatsApp quota is used up. It frees up ${describeWhen(retryAfter)}. See \`ft admin crm quota\`.` + : "The daily WhatsApp quota is used up. See `ft admin crm quota`."; + case "INVALID_STATE": + return "The campaign does not allow this right now (already sent, a batch is going out, or nothing is pending). Check it with `ft admin crm campaigns get `."; + case "EMPTY_AUDIENCE": + return "The filter matches nobody. Adjust it and check with `ft admin crm preview`."; + case "WHATSAPP_BLOCKED": + return "WhatsApp sending is blocked for this template or sender. See `whatsappBlockedReason` in `ft admin crm options`."; + case "WHATSAPP_UNAVAILABLE": + return "The WhatsApp provider did not answer. Safe to retry by hand in a moment - the CLI never retries a write on its own."; + default: + return null; + } +} + +/** + * `unwrap` plus the CRM's named errors. Formats the envelope itself because + * `details` is not always a list here (`{ existingId }` on a duplicate). + */ +function crmUnwrap(res: SdkResult): T { + if (res.data !== undefined) return res.data; + const err = (res.error as { error?: CrmError } | undefined)?.error; + if (!err) return unwrap(res); + const status = res.response?.status; + const lines = [ + `Error ${status ?? ""} [${err.code ?? "?"}]: ${err.message ?? "unknown failure"}`, + ]; + if (Array.isArray(err.details)) { + for (const d of err.details as { path?: unknown; message?: string }[]) { + const path = Array.isArray(d.path) ? d.path.join(".") : (d.path ?? ""); + lines.push(` · ${path}: ${d.message ?? ""}`.trimEnd()); + } + } + const hint = crmErrorHint(err, retryAfterSeconds(res.response)); + if (hint) fail(lines.join("\n"), hint); + return unwrap(res); +} + +/** `--sender freeticket|` → the contract's `sender`. */ +export function parseSender(value: string): AdminCrmSender { + const v = value.trim(); + if (!v) fail("Empty --sender. Use `freeticket` or a workspace id."); + return v.toLowerCase() === "freeticket" + ? { kind: "freeticket" } + : { kind: "organization", workspaceId: v }; +} + +function senderLabel(sender: AdminCrmSender | undefined): string { + if (!sender) return "(not set)"; + return sender.kind === "freeticket" + ? "FreeTicket" + : `organization ${sender.workspaceId}`; +} + +/** + * Human summary of a preview, on stderr so `--json` stays clean on stdout. + * Exported for tests. + */ +export function previewSummary( + p: AdminCrmAudiencePreview, + channel?: string, +): string[] { + const c = p.counts; + const lines = [ + `${chalk.bold("Audience")}: ${c.total} people`, + ` matched ${c.matched} · excluded by "except" ${c.excludedByExcept} · by frequency ${c.excludedByFrequency} · unsubscribed ${c.suppressed}`, + ` with email: ${c.total} · reachable by WhatsApp: ${c.reachableWhatsapp} · without phone: ${c.withoutPhone}`, + ]; + if (p.whatsappEstimate && channel !== "EMAIL") { + const e = p.whatsappEstimate; + lines.push( + ` WhatsApp: ~${e.days} day(s) to reach everyone (cap ${e.dailyCap}/day, ${e.remainingToday} left today)`, + ); + } + if (p.senderChoice?.forced) { + lines.push( + " sender: must be FreeTicket (the scope spans several organizations)", + ); + } else if (p.senderChoice && "organization" in p.senderChoice) { + const o = p.senderChoice.organization; + lines.push(` sender: can sign as FreeTicket or ${o.name} (${o.id})`); + } + return lines; +} + +/** Shows a campaign before a write on it, and returns it. */ +async function showCampaign(id: string): Promise { + const c = crmUnwrap(await getCrmCampaignsId({ path: { id } })).data; + console.error( + [ + `${chalk.bold(c.subject)} (${c.id})`, + ` ${c.channel} · ${c.status} · sender ${c.senderName}`, + ` recipients ${c.recipientCount ?? "?"} · sent ${c.sentCount ?? 0} · failed ${c.failedCount ?? 0}`, + c.scheduledAt ? ` scheduled at ${c.scheduledAt}` : null, + c.nextBatchAt ? ` next batch at ${c.nextBatchAt}` : null, + ] + .filter(Boolean) + .join("\n"), + ); + return c; +} + +type TableOpts = { + json?: boolean; + csv?: boolean; + columns?: string; + full?: boolean; +}; + +function printRows(rows: unknown[], opts: TableOpts, fallback: string[]): void { + const columns = resolveColumns(opts, fallback); + if (opts.csv) { + process.stdout.write(`${toCsv(rows, columns)}\n`); + return; + } + print(rows, { + json: opts.json, + columns, + columnsExplicit: Boolean(opts.columns), + }); +} + +function tableOptions(cmd: Command): Command { + return cmd + .option("--columns ", "comma-separated columns to display") + .option("--full", "show every field instead of the curated columns") + .option("--csv", "CSV output") + .option("--json", "raw JSON output"); +} + +export function registerAdminCrm(admin: Command): void { + const crm = admin + .command("crm") + .description( + "Master CRM: email / WhatsApp campaigns to buyers (writes send real messages)", + ); + + // ---------------------------------------------------------------- campaigns + const campaigns = crm.command("campaigns").description("CRM campaigns"); + + tableOptions( + campaigns + .command("list") + .description("List campaigns, newest first") + .option("--channel ", "EMAIL | WHATSAPP") + .option( + "--status ", + "SENT | FAILED | DENIED | PROCESSING | APPROVED | SCHEDULED | CANCELLED", + ) + .option("--limit ", "max results (server default 50)"), + ).action(async (opts) => { + configureAdminClient(); + const query: Record = {}; + if (opts.channel) query.channel = String(opts.channel).toUpperCase(); + if (opts.status) query.status = String(opts.status).toUpperCase(); + if (opts.limit !== undefined) query.limit = Number(opts.limit); + const body = crmUnwrap(await getCrmCampaigns({ query: query as never })); + printRows(body.data, opts, CAMPAIGN_COLUMNS); + }); + + campaigns + .command("get ") + .description("Campaign detail: deliveries, errors, conversions") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + const body = crmUnwrap(await getCrmCampaignsId({ path: { id } })); + print(body.data, { json: opts.json }); + }); + + campaigns + .command("cancel ") + .description("Cancel a SCHEDULED campaign so it never goes out") + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + await showCampaign(id); + await confirmOrExit( + `Cancel campaign ${id}? It will not be sent`, + opts.yes, + ); + const body = crmUnwrap(await postCrmCampaignsIdCancel({ path: { id } })); + print(body.data, { json: opts.json }); + }); + + // ------------------------------------------------------------------ batches + const batches = crm + .command("batches") + .description("WhatsApp batch sending of a campaign"); + + batches + .command("next ") + .description("Send the next batch of pending recipients now") + .option("--ignore-window", "send even outside the 9:00-20:00 Bogotá window") + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + await showCampaign(id); + await confirmOrExit( + `Send the next batch of campaign ${id}${opts.ignoreWindow ? " (ignoring the send window)" : ""}?`, + opts.yes, + ); + const body = crmUnwrap( + await postCrmCampaignsIdBatchesNext({ + path: { id }, + ...(opts.ignoreWindow ? { body: { ignoreSendWindow: true } } : {}), + }), + ); + print(body.data, { json: opts.json }); + }); + + batches + .command("stop ") + .description( + "Stop batch sending: pending recipients are skipped (irreversible)", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + await showCampaign(id); + await confirmOrExit( + `Stop campaign ${id}? Pending recipients will never be sent (irreversible)`, + opts.yes, + ); + const body = crmUnwrap( + await postCrmCampaignsIdBatchesStop({ path: { id } }), + ); + print(body.data, { json: opts.json }); + }); + + // ------------------------------------------------------------------- events + const events = crm + .command("events") + .description("Find shows and dates for a filter"); + + tableOptions( + events + .command("search ") + .description("Search shows by name") + .option( + "--purpose

", + "scope | promote | except (promote = published shows only)", + "scope", + ) + .option( + "--sender ", + "with --purpose promote: only shows of this organization", + ), + ).action(async (query, opts) => { + configureAdminClient(); + const purpose = String(opts.purpose); + if (!["scope", "promote", "except"].includes(purpose)) + fail(`Invalid --purpose: ${purpose}. Use scope, promote or except.`); + const body = crmUnwrap( + await getCrmEvents({ + query: { + query, + purpose: purpose as "scope" | "promote" | "except", + ...(opts.sender ? { senderWorkspaceId: opts.sender } : {}), + }, + }), + ); + printRows(body.data, opts, EVENT_COLUMNS); + }); + + tableOptions( + events + .command("dates ") + .description("Dates (functions) of one or more shows, with buyer counts"), + ).action(async (eventIds: string[], opts) => { + configureAdminClient(); + const ids = eventIds + .flatMap((v) => v.split(",")) + .map((v) => v.trim()) + .filter(Boolean); + const body = crmUnwrap( + await getCrmEventDates({ query: { eventIds: ids.join(",") } }), + ); + printRows(body.data, opts, DATE_COLUMNS); + }); + + // ------------------------------------------------------------ options/quota + crm + .command("options") + .description("Cities, genres/formats, plans and WhatsApp templates") + .option("--json", "raw JSON output") + .action(async (opts) => { + configureAdminClient(); + print(crmUnwrap(await getCrmOptions({})).data, { json: opts.json }); + }); + + crm + .command("quota") + .description("WhatsApp daily quota: used, remaining, committed batches") + .option("--json", "raw JSON output") + .action(async (opts) => { + configureAdminClient(); + print(crmUnwrap(await getCrmQuota({})).data, { json: opts.json }); + }); + + // ------------------------------------------------------------------ preview + crm + .command("preview") + .description("Count an audience without creating anything") + .requiredOption( + "--filter ", + "audience filter v2 (inline JSON or @filter.json)", + ) + .option("--sender ", "freeticket | ") + .option("--json", "raw JSON output") + .action(async (opts) => { + configureAdminClient(); + const filter = parseData(opts.filter) as AdminCrmAudienceFilter; + const body = crmUnwrap( + await postCrmAudiencePreview({ + body: { + filter, + ...(opts.sender ? { sender: parseSender(opts.sender) } : {}), + }, + }), + ); + if (opts.json) { + print(body.data, { json: true }); + return; + } + console.log(previewSummary(body.data).join("\n")); + if (body.data.sample.length > 0) { + console.log(chalk.dim("\nSample (masked):")); + print(body.data.sample, {}); + } + }); + + // ------------------------------------------------------------------- launch + crm + .command("launch") + .description( + "Create an approved campaign (timing.mode now sends right away). Previews the audience first", + ) + .requiredOption( + "--data ", + "campaign JSON: channel, sender, subject, body, filter, timing (inline or @campaign.json)", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (opts) => { + configureAdminClient(); + const input = parseData(opts.data) as AdminCrmLaunchInput; + if (!input || typeof input !== "object" || !input.filter) + fail( + "--data needs a `filter` (and channel, sender, subject, body, timing).", + "See the `ft admin crm` section of the README for a campaign.json example.", + ); + // Same filter and sender the launch will use: what you confirm is what + // the backend resolves. + const preview = crmUnwrap( + await postCrmAudiencePreview({ + body: { + filter: input.filter, + ...(input.sender ? { sender: input.sender } : {}), + }, + }), + ).data; + console.error( + [ + `${chalk.bold(input.subject ?? "(no subject)")} · ${input.channel ?? "?"} · sender ${senderLabel(input.sender)} · timing ${input.timing?.mode ?? "?"}`, + ...previewSummary(preview, input.channel), + ].join("\n"), + ); + if (preview.counts.total === 0) + fail("The audience is empty: nothing to launch."); + const reach = + input.channel === "WHATSAPP" + ? preview.counts.reachableWhatsapp + : preview.counts.total; + const when = + input.timing?.mode === "now" + ? "right now" + : input.timing?.mode === "batches" + ? "in batches" + : "on schedule"; + await confirmOrExit( + `Launch to ${reach} people by ${input.channel ?? "?"}, sending ${when}?`, + opts.yes, + ); + const body = crmUnwrap(await postCrmCampaigns({ body: input })); + print(body.data, { json: opts.json }); + if (!opts.json) + console.error( + chalk.dim( + `\nFollow it with \`ft admin crm campaigns get ${body.data.id}\``, + ), + ); + }); +} diff --git a/src/commands/admin.ts b/src/commands/admin.ts index fd99a4e..b417be7 100644 --- a/src/commands/admin.ts +++ b/src/commands/admin.ts @@ -32,6 +32,7 @@ import { configureAdminClient, unwrap } from "../lib/api"; import { CONFIG_PATH, loadConfig, saveConfig } from "../lib/config"; import { confirmOrExit, parseData, parseLimit } from "../lib/input"; import { print, printNextCursor, resolveColumns, toCsv } from "../lib/output"; +import { registerAdminCrm } from "./admin-crm"; type SdkFn = ( opts: any, @@ -298,6 +299,8 @@ export function registerAdmin(program: Command): void { ]; for (const spec of resources) registerAdminResource(admin, spec); + + registerAdminCrm(admin); } function registerAdminResource(parent: Command, spec: AdminResource): void { diff --git a/src/destructive-confirm.test.ts b/src/destructive-confirm.test.ts index e6a6e61..507ea96 100644 --- a/src/destructive-confirm.test.ts +++ b/src/destructive-confirm.test.ts @@ -17,8 +17,44 @@ const sdk = vi.hoisted(() => ({ postEventsIdCancel: vi.fn(), deleteStaffId: vi.fn(), deleteWorkspacesId: vi.fn(), + // CRM writes, plus the reads they show before confirming. + postCrmCampaigns: vi.fn(), + postCrmCampaignsIdCancel: vi.fn(), + postCrmCampaignsIdBatchesNext: vi.fn(), + postCrmCampaignsIdBatchesStop: vi.fn(), + postCrmAudiencePreview: vi.fn(), + getCrmCampaignsId: vi.fn(), })); +const PREVIEW = { + counts: { + matched: 12, + excludedByExcept: 1, + excludedByFrequency: 0, + suppressed: 1, + total: 10, + reachableWhatsapp: 7, + withoutPhone: 3, + }, + sample: [], + involvedWorkspaceIds: ["ws_1"], + senderChoice: { forced: true }, + whatsappEstimate: { days: 1, dailyCap: 150, remainingToday: 150 }, +}; + +const CAMPAIGN = { + id: "cmp_1", + subject: "Hello", + channel: "WHATSAPP", + status: "SCHEDULED", + senderName: "FreeTicket", + recipientCount: 10, + sentCount: 0, + failedCount: 0, + scheduledAt: null, + nextBatchAt: null, +}; + vi.mock("./client/sdk.gen", async (importOriginal) => ({ ...(await importOriginal()), postEventsIdCancel: sdk.postEventsIdCancel, @@ -28,6 +64,12 @@ vi.mock("./client/sdk.gen", async (importOriginal) => ({ vi.mock("./admin-client/sdk.gen", async (importOriginal) => ({ ...(await importOriginal()), deleteWorkspacesId: sdk.deleteWorkspacesId, + postCrmCampaigns: sdk.postCrmCampaigns, + postCrmCampaignsIdCancel: sdk.postCrmCampaignsIdCancel, + postCrmCampaignsIdBatchesNext: sdk.postCrmCampaignsIdBatchesNext, + postCrmCampaignsIdBatchesStop: sdk.postCrmCampaignsIdBatchesStop, + postCrmAudiencePreview: sdk.postCrmAudiencePreview, + getCrmCampaignsId: sdk.getCrmCampaignsId, })); const { program } = await import("./program"); @@ -71,3 +113,88 @@ describe("destructive commands refuse without a TTY and without --yes", () => { expect(fn).not.toHaveBeenCalled(); }); }); + +describe("ft admin crm writes refuse without a TTY and without --yes", () => { + const tty = process.stdin.isTTY; + const env = { ...process.env }; + let exit: MockInstance; + let stderr: MockInstance; + + beforeEach(() => { + Object.defineProperty(process.stdin, "isTTY", { + value: false, + configurable: true, + }); + // The CRM shows what it is about to touch before asking, so it needs a + // credential to get that far. The reads are mocked; nothing leaves. + process.env.FT_ADMIN_TOKEN = "ftpat_test"; + sdk.postCrmAudiencePreview.mockResolvedValue({ + data: { data: PREVIEW }, + response: new Response(), + }); + sdk.getCrmCampaignsId.mockResolvedValue({ + data: { data: CAMPAIGN }, + response: new Response(), + }); + stderr = vi.spyOn(console, "error").mockImplementation(() => {}); + exit = vi.spyOn(process, "exit").mockImplementation((() => { + throw new Error("exited"); + }) as never); + }); + + afterEach(() => { + Object.defineProperty(process.stdin, "isTTY", { + value: tty, + configurable: true, + }); + process.env = { ...env }; + vi.restoreAllMocks(); + for (const fn of Object.values(sdk)) fn.mockReset(); + }); + + const campaign = JSON.stringify({ + channel: "WHATSAPP", + sender: { kind: "freeticket" }, + templateName: "promo", + subject: "Hello", + body: "Hi", + filter: { version: 2, include: [], except: [] }, + timing: { mode: "now" }, + }); + + it.each([ + [ + ["launch", "--data", campaign], + sdk.postCrmCampaigns, + sdk.postCrmAudiencePreview, + ], + [ + ["campaigns", "cancel", "cmp_1"], + sdk.postCrmCampaignsIdCancel, + sdk.getCrmCampaignsId, + ], + [ + ["batches", "next", "cmp_1"], + sdk.postCrmCampaignsIdBatchesNext, + sdk.getCrmCampaignsId, + ], + [ + ["batches", "stop", "cmp_1"], + sdk.postCrmCampaignsIdBatchesStop, + sdk.getCrmCampaignsId, + ], + ])("ft admin crm %j exits 1 and never calls the write", async (args, write, read) => { + await expect( + program.parseAsync(["node", "ft", "admin", "crm", ...(args as string[])]), + ).rejects.toThrow("exited"); + expect(exit).toHaveBeenCalledWith(1); + // It got as far as showing the target (preview / campaign)... + expect(read).toHaveBeenCalledTimes(1); + // ...and the exit is the confirmation gate, not anything earlier. + const messages = stderr.mock.calls.map((c) => String(c[0])); + expect(messages.some((m) => /^Refusing: .*no TTY to confirm/.test(m))).toBe( + true, + ); + expect(write).not.toHaveBeenCalled(); + }); +}); diff --git a/src/lib/api.ts b/src/lib/api.ts index db9dc60..c74a6d1 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -154,7 +154,9 @@ export function unwrap(res: { const lines = [ `Error ${status ?? ""} [${err.code ?? "?"}]: ${err.message ?? "unknown failure"}`.trim(), ]; - for (const d of err.details ?? []) + // `details` is a list of field errors on a 422, but an object elsewhere + // (e.g. `{ existingId }` on a duplicate): only the list is printable. + for (const d of Array.isArray(err.details) ? err.details : []) lines.push(` · ${d.path ?? ""}: ${d.message ?? ""}`.trimEnd()); fail(lines.join("\n"), hintFor(status)); } diff --git a/src/program.test.ts b/src/program.test.ts index 195d221..4cd88c5 100644 --- a/src/program.test.ts +++ b/src/program.test.ts @@ -55,3 +55,21 @@ test("contract 1.24: waitlist list/create are wired, list filters by --city", () expect(longs).toContain("--city"); expect(longs).toContain("--account"); }); + +test("admin 1.7 CRM commands are wired under `ft admin crm`", () => { + const tree = new Map(walk(program)); + const expected = [ + "admin crm campaigns list", + "admin crm campaigns get", + "admin crm campaigns cancel", + "admin crm batches next", + "admin crm batches stop", + "admin crm events search", + "admin crm events dates", + "admin crm options", + "admin crm quota", + "admin crm preview", + "admin crm launch", + ]; + expect(expected.filter((p) => !tree.has(p))).toEqual([]); +}); From e65883d3891d3f40654bcb9120c4933f446539d6 Mon Sep 17 00:00:00 2001 From: Lucas-FullStackX Date: Thu, 22 Oct 2026 13:17:07 -0500 Subject: [PATCH 3/5] feat(admin): ft admin crm launch --ignore-window and 413 handling Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fo7cm88pv5nC6H9aXKtwc1 --- .changeset/admin-crm.md | 2 +- README.md | 11 ++-- src/commands/admin-crm.test.ts | 98 ++++++++++++++++++++++++++++++++-- src/commands/admin-crm.ts | 23 ++++++-- 4 files changed, 124 insertions(+), 10 deletions(-) diff --git a/.changeset/admin-crm.md b/.changeset/admin-crm.md index 4e4d6d6..b42562a 100644 --- a/.changeset/admin-crm.md +++ b/.changeset/admin-crm.md @@ -2,4 +2,4 @@ "@freeticket/cli": minor --- -New `ft admin crm` commands for the master CRM (admin contract 1.7.0): list and inspect campaigns, search shows and dates, read options and the WhatsApp quota, preview an audience, launch a campaign, send or stop WhatsApp batches and cancel a scheduled campaign. Every write previews its target and asks for confirmation (`--yes` in scripts), and none is retried automatically. +New `ft admin crm` commands for the master CRM (admin contract 1.7.0): list and inspect campaigns, search shows and dates, read options and the WhatsApp quota, preview an audience, launch a campaign (`--ignore-window` to send WhatsApp now outside 9:00-20:00), send or stop WhatsApp batches and cancel a scheduled campaign. Every write previews its target and asks for confirmation (`--yes` in scripts), none is retried automatically, and `PAYLOAD_TOO_LARGE` (413) is explained. diff --git a/README.md b/README.md index c6bdf8e..1ba0146 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ ft admin crm events dates ft admin crm options ft admin crm quota ft admin crm preview --filter @filter.json [--sender freeticket|] -ft admin crm launch --data @campaign.json [--yes] +ft admin crm launch --data @campaign.json [--ignore-window] [--yes] ``` **Writes send real messages.** `launch`, `campaigns cancel`, `batches next` and @@ -180,9 +180,11 @@ the same channel + sender + subject within 10 minutes with `DUPLICATE_CAMPAIGN` and prints the existing id). Named errors get a next step: `OUTSIDE_SEND_WINDOW` (WhatsApp sends only -9:00-20:00 Bogotá) prints when the window opens and suggests `--ignore-window`; +9:00-20:00 Bogotá) prints when the window opens and suggests `--ignore-window` (on `batches next`, and on a +`launch` by WhatsApp with `timing.mode` `now`); `QUOTA_EXHAUSTED` prints when the quota frees up; `INVALID_STATE` means the -campaign no longer allows that action; a 422 lists each `details[].path`. +campaign no longer allows that action; a 422 lists each `details[].path`; a 413 `PAYLOAD_TOO_LARGE` means the body is over +256 KB. Find the ids for a filter with `events search` and `events dates`, and the cities, genre/format codes, plans and WhatsApp templates with `options`. @@ -242,6 +244,9 @@ cities, genre/format codes, plans and WhatsApp templates with `options`. organizations or events of more than one owner (`preview` tells you). - WhatsApp needs an approved `templateName` (see `options`); email rejects one. `imageUrl` for WhatsApp must come from the media library. +- `ignoreSendWindow` (or `--ignore-window`): WhatsApp with `timing.mode` `now` + only; sends even outside 9:00-20:00 Bogotá instead of failing with + `OUTSIDE_SEND_WINDOW`. - `timing`: `{ "mode": "now" }` (sends on response), `{ "mode": "scheduled", "at": "" }` or `batches` (WhatsApp only, daily cap 150 when FreeTicket signs, 200 for an organization). WhatsApp times are moved into the 9:00-20:00 Bogotá window; diff --git a/src/commands/admin-crm.test.ts b/src/commands/admin-crm.test.ts index 922f1b1..a41aa81 100644 --- a/src/commands/admin-crm.test.ts +++ b/src/commands/admin-crm.test.ts @@ -117,9 +117,8 @@ describe("ft admin crm command tree", () => { ["batches", "stop"], ]) expect(find(p).options.map((o) => o.long)).toContain("--yes"); - expect(find(["batches", "next"]).options.map((o) => o.long)).toContain( - "--ignore-window", - ); + for (const p of [["batches", "next"], ["launch"]]) + expect(find(p).options.map((o) => o.long)).toContain("--ignore-window"); }); }); @@ -302,6 +301,99 @@ describe("ft admin crm commands", () => { expect(err).toContain("ft admin crm campaigns get cmp_old"); }); + const nowInput = { + channel: "WHATSAPP", + sender: { kind: "freeticket" }, + templateName: "promo", + subject: "Hello", + body: "Hi", + filter: { version: 2, include: [], except: [] }, + timing: { mode: "now" }, + }; + + it("launch --ignore-window sends ignoreSendWindow in the body", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue(ok(PREVIEW)); + sdk.postCrmCampaigns.mockResolvedValue( + ok({ id: "cmp_9", status: "APPROVED", scheduledAt: null }), + ); + await run( + "launch", + "--data", + JSON.stringify(nowInput), + "--ignore-window", + "--yes", + "--json", + ); + expect(sdk.postCrmCampaigns).toHaveBeenCalledWith({ + body: { ...nowInput, ignoreSendWindow: true }, + }); + }); + + it("launch without the flag does not add ignoreSendWindow", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue(ok(PREVIEW)); + sdk.postCrmCampaigns.mockResolvedValue( + ok({ id: "cmp_9", status: "APPROVED", scheduledAt: null }), + ); + await run("launch", "--data", JSON.stringify(nowInput), "--yes", "--json"); + expect(sdk.postCrmCampaigns.mock.calls[0]?.[0].body).not.toHaveProperty( + "ignoreSendWindow", + ); + }); + + it("launch on OUTSIDE_SEND_WINDOW says when it opens and suggests --ignore-window, once", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue(ok(PREVIEW)); + sdk.postCrmCampaigns.mockResolvedValue( + apiError( + 409, + { + code: "OUTSIDE_SEND_WINDOW", + message: "Fuera de la ventana de envío.", + retryable: true, + }, + { "Retry-After": "5400" }, + ), + ); + await expect( + run("launch", "--data", JSON.stringify(nowInput), "--yes"), + ).rejects.toThrow("exited"); + expect(sdk.postCrmCampaigns).toHaveBeenCalledTimes(1); + const err = stderr.join("\n"); + expect(err).toContain("[OUTSIDE_SEND_WINDOW]"); + expect(err).toContain("in 1h 30m"); + expect(err).toContain("--ignore-window"); + }); + + it("413 PAYLOAD_TOO_LARGE with the envelope explains the limit", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue( + apiError(413, { + code: "PAYLOAD_TOO_LARGE", + message: "El cuerpo supera el máximo de 256 KB.", + }), + ); + await expect(run("preview", "--filter", '{"version":2}')).rejects.toThrow( + "exited", + ); + const err = stderr.join("\n"); + expect(err).toContain("Error 413 [PAYLOAD_TOO_LARGE]"); + expect(err).toContain("256 KB"); + }); + + it("413 without a JSON body (proxy) still reads as PAYLOAD_TOO_LARGE", async () => { + sdk.postCrmAudiencePreview.mockResolvedValue(ok(PREVIEW)); + sdk.postCrmCampaigns.mockResolvedValue({ + data: undefined, + error: "Request Entity Too Large", + response: new Response(null, { status: 413 }), + }); + await expect( + run("launch", "--data", JSON.stringify(nowInput), "--yes"), + ).rejects.toThrow("exited"); + expect(exit).toHaveBeenCalledWith(1); + const err = stderr.join("\n"); + expect(err).toContain("[PAYLOAD_TOO_LARGE]"); + expect(err).toContain("Trim the JSON"); + }); + it("batches next --ignore-window sends ignoreSendWindow", async () => { sdk.getCrmCampaignsId.mockResolvedValue(ok(CAMPAIGN)); sdk.postCrmCampaignsIdBatchesNext.mockResolvedValue(ok({ batch: 50 })); diff --git a/src/commands/admin-crm.ts b/src/commands/admin-crm.ts index dbd5bdf..420886e 100644 --- a/src/commands/admin-crm.ts +++ b/src/commands/admin-crm.ts @@ -112,6 +112,9 @@ export function describeWhen(seconds: number, now = Date.now()): string { return `${local} (Bogotá), in ${rel} — ${at.toISOString()}`; } +const PAYLOAD_HINT = + "The request body is over the backend limit (256 KB). Trim the JSON: long `people` email lists, a huge `body`, or ids that could be a scope instead."; + /** * The error message + next step for the CRM's named errors. `null` when the * code is not one of them (the generic `unwrap` handles it). @@ -126,7 +129,7 @@ export function crmErrorHint( retryAfter !== undefined ? `The WhatsApp send window (9:00-20:00 Bogotá) opens ${describeWhen(retryAfter)}.` : "The WhatsApp send window (9:00-20:00 Bogotá) is closed.", - "Retry then, or pass --ignore-window to send this batch now.", + "Retry then, or pass --ignore-window to send now.", ].join("\n"); case "DUPLICATE_CAMPAIGN": { const id = (err.details as { existingId?: string } | undefined) @@ -145,6 +148,8 @@ export function crmErrorHint( return "The filter matches nobody. Adjust it and check with `ft admin crm preview`."; case "WHATSAPP_BLOCKED": return "WhatsApp sending is blocked for this template or sender. See `whatsappBlockedReason` in `ft admin crm options`."; + case "PAYLOAD_TOO_LARGE": + return PAYLOAD_HINT; case "WHATSAPP_UNAVAILABLE": return "The WhatsApp provider did not answer. Safe to retry by hand in a moment - the CLI never retries a write on its own."; default: @@ -159,8 +164,13 @@ export function crmErrorHint( function crmUnwrap(res: SdkResult): T { if (res.data !== undefined) return res.data; const err = (res.error as { error?: CrmError } | undefined)?.error; - if (!err) return unwrap(res); const status = res.response?.status; + if (!err && status === 413) + fail( + "Error 413 [PAYLOAD_TOO_LARGE]: request body too large.", + PAYLOAD_HINT, + ); + if (!err) return unwrap(res); const lines = [ `Error ${status ?? ""} [${err.code ?? "?"}]: ${err.message ?? "unknown failure"}`, ]; @@ -482,11 +492,18 @@ export function registerAdminCrm(admin: Command): void { "--data ", "campaign JSON: channel, sender, subject, body, filter, timing (inline or @campaign.json)", ) + .option( + "--ignore-window", + "WhatsApp with timing.mode now: send even outside the 9:00-20:00 Bogotá window", + ) .option("--yes", "skip confirmation") .option("--json", "raw JSON output") .action(async (opts) => { configureAdminClient(); const input = parseData(opts.data) as AdminCrmLaunchInput; + // The flag wins over the file, so the confirmation below tells the truth. + if (opts.ignoreWindow && input && typeof input === "object") + input.ignoreSendWindow = true; if (!input || typeof input !== "object" || !input.filter) fail( "--data needs a `filter` (and channel, sender, subject, body, timing).", @@ -521,7 +538,7 @@ export function registerAdminCrm(admin: Command): void { ? "in batches" : "on schedule"; await confirmOrExit( - `Launch to ${reach} people by ${input.channel ?? "?"}, sending ${when}?`, + `Launch to ${reach} people by ${input.channel ?? "?"}, sending ${when}${input.ignoreSendWindow ? " (ignoring the send window)" : ""}?`, opts.yes, ); const body = crmUnwrap(await postCrmCampaigns({ body: input })); From 8771411f030ea529eea9307bb4765f72df5513e5 Mon Sep 17 00:00:00 2001 From: Lucas-FullStackX Date: Mon, 23 Nov 2026 13:50:48 -0500 Subject: [PATCH 4/5] feat(contract): sync v1 1.55.0 and admin 1.9.0 (settlements and CRM) Adds ft admin settlements (list, get, upload, create, regenerate, attach, send, mark-paid, delete), the remaining ft admin crm commands, ft courtesy-requests create and ft settlements list --kind. Fixes admin list filters that read the query name instead of the flag name. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fo7cm88pv5nC6H9aXKtwc1 --- .changeset/contract-1-55-admin-1-9.md | 5 + README.md | 52 +- admin-openapi.json | 4277 ++++- openapi.json | 21281 ++++++++++++++--------- src/commands/admin-crm.test.ts | 126 + src/commands/admin-crm.ts | 189 +- src/commands/admin-settlements.test.ts | 443 + src/commands/admin-settlements.ts | 380 + src/commands/admin.ts | 44 +- src/destructive-confirm.test.ts | 116 + src/program.test.ts | 25 + src/program.ts | 29 +- 12 files changed, 17725 insertions(+), 9242 deletions(-) create mode 100644 .changeset/contract-1-55-admin-1-9.md create mode 100644 src/commands/admin-settlements.test.ts create mode 100644 src/commands/admin-settlements.ts diff --git a/.changeset/contract-1-55-admin-1-9.md b/.changeset/contract-1-55-admin-1-9.md new file mode 100644 index 0000000..3563c84 --- /dev/null +++ b/.changeset/contract-1-55-admin-1-9.md @@ -0,0 +1,5 @@ +--- +"@freeticket/cli": minor +--- + +Contract sync to v1 1.55.0 and admin 1.9.0. New `ft admin settlements` (list, get, upload, create, regenerate, attach, send, mark-paid, delete) for organizer settlements across workspaces; every write shows the settlement, asks for confirmation (`--yes` in scripts) and sends `confirm: true`. New `ft admin crm test-send`, `suppressions list|add|remove`, `organizations` and `people search`. New `ft courtesy-requests create` for enterprise landings, and `ft settlements list --kind EVENT|MEMBERSHIP` with a `kind` column. Fixes `ft admin users list --workspace` and `ft admin audit-log list --actor`, which were silently ignored. diff --git a/README.md b/README.md index 1ba0146..11c3682 100644 --- a/README.md +++ b/README.md @@ -119,16 +119,18 @@ ft sales list --status CONFIRMED --json | `ft reports by-event` · `timeseries` · `inventory` | Revenue/tickets by event, over time, and capacity/availability | VIEWER | | `ft reports export buyers\|attendees\|subscribers\|reconciliation` | Exports as CSV (filters `--event` `--event-date` `--from` `--to` `--status`) | ADMIN | | `ft reports reconciliation` · `financials` | CFO reconciliation (Mercado Pago vs sale vs Siigo invoice) · per-function P&L | ADMIN | -| `ft settlements list` · `get ` · `document ` | Settlements paid to the organizer · signed download URL for the PDF, 5 min TTL (`--proof ` for a payment proof) | ADMIN | +| `ft settlements list` · `get ` · `document ` | Settlements paid to the organizer (`--kind EVENT\|MEMBERSHIP`, `--event`, `--status`; membership rows carry `period` / `membershipPlan`) · signed download URL for the PDF, 5 min TTL (`--proof ` for a payment proof) | ADMIN | | `ft content-videos list` · `content-posts list\|create` · `content-lives list\|get\|playback-token` | Organization content; `content-posts create --data` publishes a post or article | ADMIN | | `ft waitlist list [--city ]` · `waitlist create --data` | Per-city waitlist of an enterprise landing (export with personal data); `create` needs an enterprise service key | ADMIN | +| `ft courtesy-requests create --data '{"fullName":"…","email":"…","companion":{"fullName":"…"}}'` | Courtesy invitation request from an enterprise landing (enterprise service key; one per email, a resubmit is 409). The list lives in the dashboard (`/dashboard/cortesias`) | service key | | `ft merch products list` | Merch store products of the workspace's organization, DRAFT and PUBLISHED, with variants (Legend plan) | ADMIN / MERCH_MANAGER | | `ft merch products create` | Create product(s) as DRAFT: `--name` `--price ` `--sizes XS,S,M` `--stock ` `--image ` (repeatable, uploaded through a signed URL) `--publish`; `--from-json ` for several (image paths relative to the file, no symlinks). The whole batch is validated first; `--json` prints `{ created, failed }` | ADMIN / MERCH_MANAGER | | `ft merch products images --image …` | Replace a product's photos with local files (repairs a partial `create`) | ADMIN / MERCH_MANAGER | | `ft merch products publish ` · `unpublish ` | Show / hide a product in the store (publishing needs the store setup done and an active variant) | ADMIN / MERCH_MANAGER | | `ft api-keys create ` · `list` · `revoke ` | Self-service API keys (the secret is shown once, never stored) | ADMIN | | `ft admin login` · `me` · `workspaces` · `users` · `plans` · `feature-flags` · `tokens` · `audit-log` | Superadmin, cross-tenant — needs a SUPER_ADMIN session, not an API key. Includes `admin workspaces plan ` (assisted plan assignment), `plan-show ` (current plan) and `delete ` (soft delete; suspend first) and `webTemplate` / `customDomain` on `update` | SUPER_ADMIN | -| `ft admin crm campaigns` · `batches` · `events` · `options` · `quota` · `preview` · `launch` | Master CRM: email / WhatsApp campaigns to buyers across workspaces. See [`ft admin crm`](#ft-admin-crm) | SUPER_ADMIN | +| `ft admin settlements list` · `get` · `upload` · `create` · `regenerate` · `attach` · `send` · `mark-paid` · `delete` | Organizer settlements across workspaces: create, send, mark as paid. See [`ft admin settlements`](#ft-admin-settlements) | SUPER_ADMIN | +| `ft admin crm campaigns` · `batches` · `events` · `options` · `quota` · `preview` · `launch` · `test-send` · `suppressions` · `organizations` · `people search` | Master CRM: email / WhatsApp campaigns to buyers across workspaces. See [`ft admin crm`](#ft-admin-crm) | SUPER_ADMIN | > **Write operations** (`create`/`update`/`delete` and actions like `publish`, > `cancel`, `refund`) send a JSON body via `--data ` or @@ -167,8 +169,24 @@ ft admin crm options ft admin crm quota ft admin crm preview --filter @filter.json [--sender freeticket|] ft admin crm launch --data @campaign.json [--ignore-window] [--yes] +ft admin crm test-send --data @message.json [--sender freeticket|] [--yes] +ft admin crm suppressions list [--query ] [--scope global|all] [--limit 1-500] +ft admin crm suppressions add +ft admin crm suppressions remove [--yes] +ft admin crm organizations [query] +ft admin crm people search [--scope '{"level":"orgs","workspaceIds":["…"]}'] ``` +`test-send` sends the composed message, with subject `[Prueba]`, to **you**: +your email, or by WhatsApp the phone on your staff profile (it uses 1 of the +daily WhatsApp quota). It takes the same fields as `launch` minus the filter +and timing, asks first and sends `confirm: true`. `suppressions add` stops a +person from getting master CRM campaigns (idempotent; it does not touch an +organizer's own campaigns); `suppressions remove` re-enables them, asks first, +and only works on unsubscribes the team added (`reason: admin`). `people +search` returns the full email (what the filter's `people` condition takes); +`organizations` gives ids for `scope.level: "orgs"` or `sender.workspaceId`. + **Writes send real messages.** `launch`, `campaigns cancel`, `batches next` and `batches stop` first show what they are about to touch — `launch` runs the audience preview with the same filter and sender (total, how many have email @@ -252,6 +270,36 @@ cities, genre/format codes, plans and WhatsApp templates with `options`. organization). WhatsApp times are moved into the 9:00-20:00 Bogotá window; the response's `scheduledAt` is the real one. +## `ft admin settlements` + +Settlements of every organization for the internal team, against +`/api/admin/settlements` (admin contract 1.9). Same SUPER_ADMIN credential as +`ft admin crm`. `list` shows EVENT settlements only, like the panel. + +```bash +ft admin settlements list [--status S] [--organization ] [--all] +ft admin settlements get +ft admin settlements upload --organization # prints storagePath +ft admin settlements create --data '{"mode":"auto","eventDateId":"…"}' [--yes] +ft admin settlements create --data @manual.json --pdf liquidacion.pdf [--yes] +ft admin settlements regenerate [--commission-rate 2.9916] [--fixed-fee 500] [--yes] +ft admin settlements attach --pdf [--amount N] [--yes] # legacy DRAFT → GENERATED +ft admin settlements send [--yes] # GENERATED → SENT, emails the organizer +ft admin settlements mark-paid --proof a.pdf --proof b.pdf [--yes] # AWAITING_PAYMENT → PAID +ft admin settlements delete [--yes] +``` + +**Every write moves money or notifies the organizer.** Each one shows the +settlement (or the body it will create) and asks; without a TTY it refuses +unless you pass `--yes`. `send`, `mark-paid` and `delete` send the contract's +`confirm: true` (`attach` only with `--amount`). PDFs (max 3 MB, checked for +`%PDF` locally) go up with `POST /settlements/files` after you confirm; +`--pdf` / `--proof` do that for you, or pass an already uploaded `storagePath` +(`attach --storage-path`, `mark-paid --proofs '[{"storagePath":…,"fileName":…}]'`). +`create` starts in GENERATED and does not notify anyone; a function with an +active settlement answers `DUPLICATE_SETTLEMENT` with the existing id. Nothing +is retried automatically. + ## Configuration `ft` resolves configuration in this precedence order: diff --git a/admin-openapi.json b/admin-openapi.json index 9bade83..480d9ee 100644 --- a/admin-openapi.json +++ b/admin-openapi.json @@ -2,7 +2,7 @@ "openapi": "3.1.0", "info": { "title": "FreeTicket Admin API", - "version": "1.8.0", + "version": "1.9.0", "description": "API REST de superadmin de FreeTicket (cross-tenant). Autenticación por sesión de plataforma (staff con rol SUPER_ADMIN) o por service token (PAT) vía `Authorization: Bearer ` — NO usa API key de tenant. Aislada del contrato B2B /api/v1." }, "servers": [ @@ -3552,6 +3552,1854 @@ } } } + }, + "/crm/suppressions": { + "get": { + "operationId": "getCrmSuppressions", + "tags": [ + "crm" + ], + "summary": "Listar las bajas del CRM", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. Las bajas más recientes primero. `scope=global` (por defecto): solo las globales (workspace de plataforma); `all`: también las de cada organización. Los correos van enmascarados; `query` busca por el correo completo o una parte.", + "security": [ + { + "session": [] + } + ], + "parameters": [ + { + "name": "query", + "in": "query", + "required": false, + "description": "Parte del correo (hasta 254).", + "schema": { + "type": "string" + } + }, + { + "name": "scope", + "in": "query", + "required": false, + "description": "`global` o `all`.", + "schema": { + "type": "string", + "enum": [ + "global", + "all" + ], + "default": "global" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "1–500 (por defecto 100).", + "schema": { + "type": "integer", + "default": 100 + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AdminCrmSuppression" + } + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "operationId": "postCrmSuppressions", + "tags": [ + "crm" + ], + "summary": "Agregar una baja global (ESCRITURA)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA: la persona deja de recibir campañas del CRM maestro (no frena las campañas propias de un organizador). Queda con motivo `admin`. Idempotente: si ya estaba dada de baja (por cualquier motivo) no cambia nada y responde igual. 429 con `Retry-After`. No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `crm_suppression.add` (con el correo enmascarado).", + "security": [ + { + "session": [] + } + ], + "x-ft-mcp": { + "expose": false, + "reason": "Escritura del CRM maestro: dispara o frena envíos reales a clientes. Solo por el CLI (`ft admin crm`) o el panel, no por un agente MCP." + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminCrmSuppressionInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminCrmSuppressionResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteCrmSuppressions", + "tags": [ + "crm" + ], + "summary": "Quitar una baja global que puso el equipo (ESCRITURA)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA: la persona vuelve a recibir campañas del CRM. Exige `{ \"email\": …, \"confirm\": true }`; sin `confirm`, 422 `CONFIRMATION_REQUIRED` y no se quita nada. Solo las que puso el equipo (motivo `admin`): la que pidió la persona desde el enlace de baja, un rebote o una queja responden 404 y siguen vigentes. 429 con `Retry-After`. No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `crm_suppression.remove`.", + "security": [ + { + "session": [] + } + ], + "x-ft-mcp": { + "expose": false, + "reason": "Escritura del CRM maestro: dispara o frena envíos reales a clientes. Solo por el CLI (`ft admin crm`) o el panel, no por un agente MCP." + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminCrmSuppressionRemoveInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminCrmSuppressionResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/crm/test-send": { + "post": { + "operationId": "postCrmTestSend", + "tags": [ + "crm" + ], + "summary": "Enviar una prueba de la campaña a uno mismo (ESCRITURA: envía)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA: manda el mensaje armado tal como saldría, con asunto `[Prueba]`, a QUIEN LLAMA — su correo, o por WhatsApp el teléfono de su perfil de staff — nunca a un destino del body. Exige `{ \"confirm\": true }`; sin él, 422 `CONFIRMATION_REQUIRED` y no sale nada. Por WhatsApp consume 1 del cupo de Meta. Mismas reglas de canal y remitente que el lanzamiento (422 con `details[].path`). 429 `RATE_LIMITED` con `Retry-After` (5 cada 10 min por persona, compartido con el panel). 409 `WHATSAPP_BLOCKED` / 503 `WHATSAPP_UNAVAILABLE`; 502 `SEND_FAILED` si el proveedor rechazó el envío. No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `crm_campaign.test`.", + "security": [ + { + "session": [] + } + ], + "x-ft-mcp": { + "expose": false, + "reason": "Escritura del CRM maestro: dispara o frena envíos reales a clientes. Solo por el CLI (`ft admin crm`) o el panel, no por un agente MCP." + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminCrmTestSendInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminCrmTestSendResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/crm/organizations": { + "get": { + "operationId": "getCrmOrganizations", + "tags": [ + "crm" + ], + "summary": "Buscar organizaciones para una campaña del CRM", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. Organizaciones activas (sin la de plataforma) por nombre o slug: hasta 10 con `query`, las primeras 20 por nombre sin ella. Sirven para `scope.level: \"orgs\"` del filtro o para `sender.workspaceId`.", + "security": [ + { + "session": [] + } + ], + "parameters": [ + { + "name": "query", + "in": "query", + "required": false, + "description": "Texto (hasta 120 caracteres).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AdminCrmOrganizationOption" + } + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/crm/people/search": { + "post": { + "operationId": "postCrmPeopleSearch", + "tags": [ + "crm" + ], + "summary": "Buscar personas del alcance para una campaña del CRM", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. Lectura (POST porque el alcance es un objeto; no escribe nada). Personas del alcance —el mismo universo del resolver: a quien aparece le puede llegar— por correo o nombre, desde 2 caracteres. Devuelve el correo COMPLETO (es lo que lleva la condición `people` del filtro), del nombre solo la inicial y el teléfono enmascarado. Por eso no la expone el MCP (`x-ft-mcp`).", + "security": [ + { + "session": [] + } + ], + "x-ft-mcp": { + "expose": false, + "reason": "Devuelve correos completos de compradores: solo por el CLI (`ft admin crm`) o el panel, no al contexto de un agente MCP." + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminCrmPeopleSearchInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AdminCrmPersonOption" + } + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/settlements": { + "get": { + "operationId": "getSettlements", + "tags": [ + "settlements" + ], + "summary": "Listar liquidaciones (todas las organizaciones)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. Las liquidaciones de EVENTOS de todas las organizaciones, las más nuevas primero (las de membresías no se listan acá, igual que en el panel). Paginada por cursor (`limit`, `cursor`). Del reparto solo viajan los últimos 4 dígitos de cada cuenta.", + "security": [ + { + "session": [] + } + ], + "parameters": [ + { + "name": "status", + "in": "query", + "required": false, + "description": "Solo las de ese estado.", + "schema": { + "type": "string", + "enum": [ + "DRAFT", + "GENERATED", + "SENT", + "AWAITING_PAYMENT", + "PAID", + "REQUESTED", + "PENDING", + "REJECTED" + ] + } + }, + { + "name": "organizationId", + "in": "query", + "required": false, + "description": "Solo las de esa organización.", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Tamaño de página (1–100, por defecto 20).", + "schema": { + "type": "integer" + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "`page.nextCursor` de la página anterior.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AdminSettlement" + } + }, + "page": { + "$ref": "#/components/schemas/Page" + } + }, + "required": [ + "data", + "page" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "operationId": "postSettlements", + "tags": [ + "settlements" + ], + "summary": "Crear una liquidación, manual o automática (ESCRITURA: dinero)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA (`x-ft-destructive`). `mode: manual` registra un PDF ya subido con `POST /settlements/files` y el monto digitado (máx. dos decimales); `mode: auto` calcula el borrador de la función y adjunta el PDF generado (monto = saldo final, puede ser negativo). Nace en `GENERATED` y NO notifica al organizador. 409 `DUPLICATE_SETTLEMENT` (con `details.existingId` cuando se conoce) si la función ya tiene una liquidación activa — reintentar con el mismo body no crea otra. 422 si el archivo no es de la organización, o el evento/función no le pertenecen. 503 `STORAGE_UNAVAILABLE` / 502 `UPLOAD_FAILED` / 500 `DRAFT_FAILED` en la automática. No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `settlement.create` / `settlement.create_auto`.", + "security": [ + { + "session": [] + } + ], + "x-ft-destructive": true, + "x-ft-mcp": { + "expose": false, + "reason": "Escritura de liquidaciones (dinero de los organizadores): solo por el CLI (`ft admin settlements`) o el panel, no por un agente MCP." + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminSettlementCreateInput" + } + } + } + }, + "responses": { + "201": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlementCreateResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/settlements/files": { + "post": { + "operationId": "postSettlementsFiles", + "tags": [ + "settlements" + ], + "summary": "Subir el PDF de una liquidación o de un comprobante (ESCRITURA)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA (`x-ft-destructive`): sube un PDF (en `contentBase64`, máx. 3 MB decodificado; se verifican los bytes `%PDF`) al bucket privado de liquidaciones de la organización y devuelve su `storagePath`. No crea ni cambia ninguna liquidación: ese `storagePath` se usa en `POST /settlements` (`mode: manual`), `POST /settlements/{id}/proofs` y `POST /settlements/{id}/mark-paid`. Nunca devuelve una URL pública. 422 si no es un PDF o la organización no existe; 413 si pasa el tope; 503 `STORAGE_UNAVAILABLE` / 502 `UPLOAD_FAILED`. No expuesta por el MCP (`x-ft-mcp`).", + "security": [ + { + "session": [] + } + ], + "x-ft-destructive": true, + "x-ft-mcp": { + "expose": false, + "reason": "Escritura de liquidaciones (dinero de los organizadores): solo por el CLI (`ft admin settlements`) o el panel, no por un agente MCP." + }, + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminSettlementFileUploadInput" + } + } + } + }, + "responses": { + "201": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlementFile" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/settlements/{id}": { + "get": { + "operationId": "getSettlementsId", + "tags": [ + "settlements" + ], + "summary": "Ver una liquidación", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`.", + "security": [ + { + "session": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlement" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteSettlementsId", + "tags": [ + "settlements" + ], + "summary": "Borrar una liquidación (ESCRITURA: dinero, irreversible)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA IRREVERSIBLE (`x-ft-destructive`): exige `{ \"confirm\": true }` en el cuerpo; sin él responde 422 `CONFIRMATION_REQUIRED` y no borra nada. Igual que el panel, una liquidación de EVENTO se puede borrar en cualquier estado (incluida una `PAID`). Una de MEMBRESÍAS solo en `DRAFT` o `GENERATED`: al borrarla sus cobros vuelven a quedar pendientes, en la misma transacción; si ya se envió, 409 `INVALID_STATE` y no se toca nada. El estado previo completo queda en `GET /audit-log` como `settlement.delete`. El PDF queda en el bucket. 404 si no existe. No expuesta por el MCP (`x-ft-mcp`).", + "security": [ + { + "session": [] + } + ], + "x-ft-destructive": true, + "x-ft-mcp": { + "expose": false, + "reason": "Escritura de liquidaciones (dinero de los organizadores): solo por el CLI (`ft admin settlements`) o el panel, no por un agente MCP." + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminSettlementConfirmInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlementDeleteResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/settlements/{id}/regenerate": { + "post": { + "operationId": "postSettlementsIdRegenerate", + "tags": [ + "settlements" + ], + "summary": "Regenerar el PDF con el reparto bancario (ESCRITURA: dinero)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA (`x-ft-destructive`): reemplaza el PDF de una liquidación en `AWAITING_PAYMENT` por el definitivo, con las cuentas y montos del reparto del organizador. Usa la misma comisión y costo fijo que la generación automática (`commissionRate` en %, `fixedFee` base sin IVA). No cambia el monto: si el saldo recalculado no coincide con él responde 409 `AMOUNT_MISMATCH` y no escribe nada (hay que generar la liquidación desde cero). 409 `INVALID_STATE` si no es de EVENTO (una de membresías no se regenera), no está esperando el pago, no tiene reparto o no está asociada a una función. 404 si no existe. 503 `STORAGE_UNAVAILABLE` / 502 `UPLOAD_FAILED` / 500 `DRAFT_FAILED`. No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `settlement.regenerate`.", + "security": [ + { + "session": [] + } + ], + "x-ft-destructive": true, + "x-ft-mcp": { + "expose": false, + "reason": "Escritura de liquidaciones (dinero de los organizadores): solo por el CLI (`ft admin settlements`) o el panel, no por un agente MCP." + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminSettlementRegenerateInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlementTransition" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "500": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/settlements/{id}/send": { + "post": { + "operationId": "postSettlementsIdSend", + "tags": [ + "settlements" + ], + "summary": "Enviar una liquidación al organizador (ESCRITURA: envía correo)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA (`x-ft-destructive`): `GENERATED` → `SENT`; desde acá el organizador la ve, puede repartir el pago y recibe un correo (best-effort: si el correo falla, el envío queda hecho). Exige `{ \"confirm\": true }`; sin él, 422 `CONFIRMATION_REQUIRED` y no pasa nada. 409 `INVALID_STATE` si no está en `GENERATED` (ya enviada, o en otro estado): reintentar no re-notifica. 404 si no existe. 429 con `Retry-After` (20 cada 10 min por usuario). No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `settlement.send`.", + "security": [ + { + "session": [] + } + ], + "x-ft-destructive": true, + "x-ft-mcp": { + "expose": false, + "reason": "Escritura de liquidaciones (dinero de los organizadores): solo por el CLI (`ft admin settlements`) o el panel, no por un agente MCP." + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminSettlementConfirmInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlementTransition" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/settlements/{id}/mark-paid": { + "post": { + "operationId": "postSettlementsIdMarkPaid", + "tags": [ + "settlements" + ], + "summary": "Marcar una liquidación como pagada (ESCRITURA: dinero)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA (`x-ft-destructive`): `AWAITING_PAYMENT` → `PAID`, guarda los comprobantes de la transferencia (`proofs`, subidos antes con `POST /settlements/files`; cada `storagePath` tiene que ser de la organización de la liquidación, si no 422) y le manda un correo al organizador (best-effort). Exige `{ \"confirm\": true }`; sin él, 422 `CONFIRMATION_REQUIRED` y no se registra nada. 409 `INVALID_STATE` si no está esperando el pago (ya pagada incluida): reintentar no paga ni notifica dos veces. 404 si no existe. 429 con `Retry-After`. No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `settlement.mark_paid`.", + "security": [ + { + "session": [] + } + ], + "x-ft-destructive": true, + "x-ft-mcp": { + "expose": false, + "reason": "Escritura de liquidaciones (dinero de los organizadores): solo por el CLI (`ft admin settlements`) o el panel, no por un agente MCP." + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminSettlementMarkPaidInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlementTransition" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/settlements/{id}/proofs": { + "post": { + "operationId": "postSettlementsIdProofs", + "tags": [ + "settlements" + ], + "summary": "Adjuntar el PDF a una liquidación por enviar (ESCRITURA: dinero)", + "description": "Requiere sesión de plataforma con rol `SUPER_ADMIN`. ESCRITURA (`x-ft-destructive`): `DRAFT` → `GENERATED` con el PDF subido antes por `POST /settlements/files` (tiene que ser de la organización de la liquidación, si no 422) y, opcional, un monto nuevo (máx. dos decimales); con `amount` exige `{ \"confirm\": true }`, sin él 422 `CONFIRMATION_REQUIRED` y no se toca nada. Solo filas legado: lo que se crea hoy ya nace en `GENERATED`. No notifica al organizador. 409 `INVALID_STATE` si ya tiene comprobante. 404 si no existe. Los comprobantes de la TRANSFERENCIA van en `mark-paid`, no acá. No expuesta por el MCP (`x-ft-mcp`). Queda en `GET /audit-log` como `settlement.attach_proof`.", + "security": [ + { + "session": [] + } + ], + "x-ft-destructive": true, + "x-ft-mcp": { + "expose": false, + "reason": "Escritura de liquidaciones (dinero de los organizadores): solo por el CLI (`ft admin settlements`) o el panel, no por un agente MCP." + }, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AdminSettlementAttachProofInput" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/AdminSettlementTransition" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "413": { + "description": "Payload too large: the request body exceeds the maximum size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } } }, "components": { @@ -4626,74 +6474,220 @@ "enum": [ 2 ] - } - }, - "required": [ - "version" - ], - "additionalProperties": true, - "examples": [ - { - "version": 2, - "scope": { - "level": "platform" - }, - "include": [ + } + }, + "required": [ + "version" + ], + "additionalProperties": true, + "examples": [ + { + "version": 2, + "scope": { + "level": "platform" + }, + "include": [ + { + "type": "purchased", + "window": { + "kind": "last_days", + "days": 90 + } + } + ], + "except": [ + { + "type": "received_campaign", + "days": 7 + } + ] + } + ] + }, + "AdminCrmSender": { + "oneOf": [ + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "freeticket" + } + }, + "required": [ + "kind" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "organization" + }, + "workspaceId": { + "type": "string", + "minLength": 1, + "maxLength": 64 + } + }, + "required": [ + "kind", + "workspaceId" + ], + "additionalProperties": false + } + ], + "description": "Quién firma. `freeticket` es obligatorio si el alcance es la plataforma, varias organizaciones o eventos de más de un dueño: el servidor RECHAZA otra firma (422), no la corrige." + }, + "AdminCrmCampaign": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "subject": { + "type": "string" + }, + "channel": { + "$ref": "#/components/schemas/AdminCrmChannel" + }, + "status": { + "type": "string", + "description": "`BroadcastStatus`" + }, + "senderName": { + "type": "string" + }, + "isPlatform": { + "type": "boolean" + }, + "audienceLabel": { + "type": "string" + }, + "createdAt": { + "type": "string", + "description": "ISO 8601" + }, + "scheduledAt": { + "anyOf": [ + { + "type": "string", + "description": "ISO 8601" + }, + { + "type": "null" + } + ] + }, + "nextBatchAt": { + "anyOf": [ + { + "type": "string", + "description": "ISO 8601" + }, + { + "type": "null" + } + ] + }, + "recipientCount": { + "anyOf": [ { - "type": "purchased", - "window": { - "kind": "last_days", - "days": 90 - } + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" } - ], - "except": [ + ] + }, + "sentCount": { + "anyOf": [ { - "type": "received_campaign", - "days": 7 + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" } ] - } - ] - }, - "AdminCrmSender": { - "oneOf": [ - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "const": "freeticket" + }, + "failedCount": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" } - }, - "required": [ - "kind" - ], - "additionalProperties": false + ] }, - { + "deliveredCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "readCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "deferredCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "attributed": { "type": "object", "properties": { - "kind": { - "type": "string", - "const": "organization" + "sales": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "workspaceId": { - "type": "string", - "minLength": 1, - "maxLength": 64 + "revenueCop": { + "type": "number" + }, + "feeCop": { + "type": "number" } }, "required": [ - "kind", - "workspaceId" + "sales", + "revenueCop", + "feeCop" ], "additionalProperties": false } + }, + "required": [ + "id", + "subject", + "channel", + "status", + "senderName", + "isPlatform", + "audienceLabel", + "createdAt", + "scheduledAt", + "nextBatchAt", + "recipientCount", + "sentCount", + "failedCount", + "deliveredCount", + "readCount", + "deferredCount", + "attributed" ], - "description": "Quién firma. `freeticket` es obligatorio si el alcance es la plataforma, varias organizaciones o eventos de más de un dueño: el servidor RECHAZA otra firma (422), no la corrige." + "additionalProperties": false }, - "AdminCrmCampaign": { + "AdminCrmCampaignDetail": { "type": "object", "properties": { "id": { @@ -4803,19 +6797,193 @@ "minimum": -9007199254740991, "maximum": 9007199254740991 }, - "revenueCop": { - "type": "number" + "revenueCop": { + "type": "number" + }, + "feeCop": { + "type": "number" + } + }, + "required": [ + "sales", + "revenueCop", + "feeCop" + ], + "additionalProperties": false + }, + "body": { + "type": "string" + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "templateName": { + "type": [ + "string", + "null" + ] + }, + "promotedEvent": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "slug" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "filter": { + "anyOf": [ + { + "$ref": "#/components/schemas/AdminCrmAudienceFilter" + }, + { + "type": "null" + } + ], + "description": "null = campaña v1 (segmento previo al CRM v2)." + }, + "batchPlan": { + "anyOf": [ + { + "type": "object", + "properties": { + "batchSize": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "perDay": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "intervalMinutes": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "batchSize", + "perDay", + "intervalMinutes" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "deliveriesByStatus": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "topErrors": { + "type": "array", + "items": { + "type": "object", + "properties": { + "error": { + "type": "string" + }, + "count": { + "type": "number" + } + }, + "required": [ + "error", + "count" + ], + "additionalProperties": false + } + }, + "sentByHour": { + "type": "array", + "items": { + "type": "object", + "properties": { + "hour": { + "type": "string", + "description": "ISO 8601" + }, + "count": { + "type": "number" + } + }, + "required": [ + "hour", + "count" + ], + "additionalProperties": false + } + }, + "conversions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "reference": { + "type": "string" + }, + "total": { + "type": "number" + }, + "createdAt": { + "type": "string", + "description": "ISO 8601" + }, + "eventName": { + "type": [ + "string", + "null" + ] + }, + "utmSource": { + "type": [ + "string", + "null" + ] + } }, - "feeCop": { - "type": "number" - } - }, - "required": [ - "sales", - "revenueCop", - "feeCop" - ], - "additionalProperties": false + "required": [ + "reference", + "total", + "createdAt", + "eventName", + "utmSource" + ], + "additionalProperties": false + } } }, "required": [ @@ -4835,212 +7003,216 @@ "deliveredCount", "readCount", "deferredCount", - "attributed" + "attributed", + "body", + "imageUrl", + "templateName", + "promotedEvent", + "filter", + "batchPlan", + "deliveriesByStatus", + "topErrors", + "sentByHour", + "conversions" ], "additionalProperties": false }, - "AdminCrmCampaignDetail": { + "AdminCrmPreviewInput": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "subject": { - "type": "string" - }, - "channel": { - "$ref": "#/components/schemas/AdminCrmChannel" - }, - "status": { - "type": "string", - "description": "`BroadcastStatus`" - }, - "senderName": { - "type": "string" - }, - "isPlatform": { - "type": "boolean" - }, - "audienceLabel": { - "type": "string" - }, - "createdAt": { - "type": "string", - "description": "ISO 8601" - }, - "scheduledAt": { - "anyOf": [ - { - "type": "string", - "description": "ISO 8601" - }, - { - "type": "null" - } - ] + "filter": { + "$ref": "#/components/schemas/AdminCrmAudienceFilter" }, - "nextBatchAt": { - "anyOf": [ - { - "type": "string", - "description": "ISO 8601" + "sender": { + "description": "Opcional. Solo SUMA bajas (las del remitente): uno que no corresponda al alcance recorta de más, nunca agrega gente.", + "$ref": "#/components/schemas/AdminCrmSender" + } + }, + "required": [ + "filter" + ], + "additionalProperties": false + }, + "AdminCrmAudiencePreview": { + "type": "object", + "properties": { + "counts": { + "type": "object", + "properties": { + "matched": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - { - "type": "null" - } - ] - }, - "recipientCount": { - "anyOf": [ - { + "excludedByExcept": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, - { - "type": "null" - } - ] - }, - "sentCount": { - "anyOf": [ - { + "excludedByFrequency": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, - { - "type": "null" - } - ] - }, - "failedCount": { - "anyOf": [ - { + "suppressed": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, - { - "type": "null" - } - ] - }, - "deliveredCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "readCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "deferredCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "attributed": { - "type": "object", - "properties": { - "sales": { + "total": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, - "revenueCop": { - "type": "number" + "reachableWhatsapp": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "feeCop": { - "type": "number" + "withoutPhone": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 } }, "required": [ - "sales", - "revenueCop", - "feeCop" + "matched", + "excludedByExcept", + "excludedByFrequency", + "suppressed", + "total", + "reachableWhatsapp", + "withoutPhone" ], "additionalProperties": false }, - "body": { - "type": "string" - }, - "imageUrl": { - "type": [ - "string", - "null" - ] + "sample": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": [ + "string", + "null" + ] + }, + "emailMasked": { + "type": "string" + }, + "phoneMasked": { + "type": [ + "string", + "null" + ] + }, + "lastPurchaseAt": { + "anyOf": [ + { + "type": "string", + "description": "ISO 8601" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "name", + "emailMasked", + "phoneMasked", + "lastPurchaseAt" + ], + "additionalProperties": false + }, + "description": "Hasta 10 personas, enmascaradas en el servidor." }, - "templateName": { - "type": [ - "string", - "null" - ] + "involvedWorkspaceIds": { + "type": "array", + "items": { + "type": "string" + } }, - "promotedEvent": { + "senderChoice": { "anyOf": [ { "type": "object", "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "slug": { - "type": "string" + "forced": { + "type": "boolean", + "const": true } }, "required": [ - "id", - "name", - "slug" + "forced" ], "additionalProperties": false }, { - "type": "null" + "type": "object", + "properties": { + "forced": { + "type": "boolean", + "const": false + }, + "organization": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "logoUrl": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "logoUrl" + ], + "additionalProperties": false + } + }, + "required": [ + "forced", + "organization" + ], + "additionalProperties": false } ] }, - "filter": { - "anyOf": [ - { - "$ref": "#/components/schemas/AdminCrmAudienceFilter" - }, - { - "type": "null" - } - ], - "description": "null = campaña v1 (segmento previo al CRM v2)." - }, - "batchPlan": { + "whatsappEstimate": { "anyOf": [ { "type": "object", "properties": { - "batchSize": { + "days": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, - "perDay": { + "dailyCap": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, - "intervalMinutes": { + "remainingToday": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 } }, "required": [ - "batchSize", - "perDay", - "intervalMinutes" + "days", + "dailyCap", + "remainingToday" ], "additionalProperties": false }, @@ -5048,79 +7220,192 @@ "type": "null" } ] + } + }, + "required": [ + "counts", + "sample", + "involvedWorkspaceIds", + "senderChoice", + "whatsappEstimate" + ], + "additionalProperties": false + }, + "AdminCrmQuotaOutlook": { + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "deliveriesByStatus": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - } + "used": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "topErrors": { + "remaining": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "nextFreeAt": { + "anyOf": [ + { + "type": "string", + "description": "ISO 8601" + }, + { + "type": "null" + } + ] + }, + "platformDailyShare": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "committed": { "type": "array", "items": { "type": "object", "properties": { - "error": { - "type": "string" + "at": { + "type": "string", + "description": "ISO 8601" }, - "count": { - "type": "number" + "size": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "messageId": { + "type": "string" } }, "required": [ - "error", - "count" + "at", + "size", + "messageId" ], "additionalProperties": false } + } + }, + "required": [ + "limit", + "used", + "remaining", + "nextFreeAt", + "platformDailyShare", + "committed" + ], + "additionalProperties": false + }, + "AdminCrmWizardOptions": { + "type": "object", + "properties": { + "cities": { + "type": "array", + "items": { + "type": "string" + } }, - "sentByHour": { + "facets": { + "type": "object", + "properties": { + "genre": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "code", + "label" + ], + "additionalProperties": false + } + }, + "format": { + "type": "array", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "label": { + "type": "string" + } + }, + "required": [ + "code", + "label" + ], + "additionalProperties": false + } + } + }, + "required": [ + "genre", + "format" + ], + "additionalProperties": false + }, + "plans": { "type": "array", "items": { "type": "object", "properties": { - "hour": { - "type": "string", - "description": "ISO 8601" + "id": { + "type": "string" }, - "count": { - "type": "number" + "name": { + "type": "string" + }, + "orgName": { + "type": "string" } }, "required": [ - "hour", - "count" + "id", + "name", + "orgName" ], "additionalProperties": false } }, - "conversions": { + "templates": { "type": "array", "items": { "type": "object", "properties": { - "reference": { + "name": { "type": "string" }, - "total": { - "type": "number" + "language": { + "type": "string" }, - "createdAt": { - "type": "string", - "description": "ISO 8601" + "hasImageHeader": { + "type": "boolean" }, - "eventName": { + "body": { + "type": "string" + }, + "footerText": { "type": [ "string", "null" ] }, - "utmSource": { + "urlButtonText": { "type": [ "string", "null" @@ -5128,480 +7413,753 @@ } }, "required": [ - "reference", - "total", - "createdAt", - "eventName", - "utmSource" + "name", + "language", + "hasImageHeader", + "body" ], "additionalProperties": false } + }, + "whatsappBlockedReason": { + "type": [ + "string", + "null" + ] } }, "required": [ - "id", - "subject", - "channel", - "status", - "senderName", - "isPlatform", - "audienceLabel", - "createdAt", - "scheduledAt", - "nextBatchAt", - "recipientCount", - "sentCount", - "failedCount", - "deliveredCount", - "readCount", - "deferredCount", - "attributed", - "body", - "imageUrl", - "templateName", - "promotedEvent", - "filter", - "batchPlan", - "deliveriesByStatus", - "topErrors", - "sentByHour", - "conversions" + "cities", + "facets", + "plans", + "templates", + "whatsappBlockedReason" ], "additionalProperties": false }, - "AdminCrmPreviewInput": { + "AdminCrmEventOption": { "type": "object", "properties": { - "filter": { - "$ref": "#/components/schemas/AdminCrmAudienceFilter" + "id": { + "type": "string" }, - "sender": { - "description": "Opcional. Solo SUMA bajas (las del remitente): uno que no corresponda al alcance recorta de más, nunca agrega gente.", - "$ref": "#/components/schemas/AdminCrmSender" + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "startsAt": { + "anyOf": [ + { + "type": "string", + "description": "ISO 8601" + }, + { + "type": "null" + } + ] + }, + "lastAt": { + "anyOf": [ + { + "type": "string", + "description": "ISO 8601" + }, + { + "type": "null" + } + ] + }, + "nextAt": { + "anyOf": [ + { + "type": "string", + "description": "ISO 8601" + }, + { + "type": "null" + } + ] + }, + "dateCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "venueName": { + "type": [ + "string", + "null" + ] + }, + "city": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string" + }, + "orgName": { + "type": "string" } }, "required": [ - "filter" + "id", + "name", + "slug", + "startsAt", + "lastAt", + "nextAt", + "dateCount", + "venueName", + "city", + "status", + "orgName" ], "additionalProperties": false }, - "AdminCrmAudiencePreview": { + "AdminCrmEventDateOption": { "type": "object", "properties": { - "counts": { + "id": { + "type": "string" + }, + "eventId": { + "type": "string" + }, + "startsAt": { + "type": "string", + "description": "ISO 8601" + }, + "label": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string" + }, + "venueName": { + "type": [ + "string", + "null" + ] + }, + "city": { + "type": [ + "string", + "null" + ] + }, + "past": { + "type": "boolean" + }, + "buyers": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "id", + "eventId", + "startsAt", + "label", + "status", + "venueName", + "city", + "past", + "buyers" + ], + "additionalProperties": false + }, + "AdminCrmTiming": { + "oneOf": [ + { "type": "object", "properties": { - "matched": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "excludedByExcept": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "mode": { + "type": "string", + "const": "now" + } + }, + "required": [ + "mode" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "mode": { + "type": "string", + "const": "scheduled" }, - "excludedByFrequency": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "at": { + "type": "string", + "description": "ISO 8601 con offset (ej. `2026-11-03T19:00:00-05:00`)." + } + }, + "required": [ + "mode", + "at" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "mode": { + "type": "string", + "const": "batches" }, - "suppressed": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "firstAt": { + "type": "string", + "description": "ISO 8601 con offset (ej. `2026-11-03T19:00:00-05:00`)." }, - "total": { + "batchSize": { "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "minimum": 1, + "maximum": 200 }, - "reachableWhatsapp": { + "perDay": { "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "minimum": 1, + "maximum": 24 }, - "withoutPhone": { + "intervalMinutes": { "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "minimum": 15, + "maximum": 1440 } }, "required": [ - "matched", - "excludedByExcept", - "excludedByFrequency", - "suppressed", - "total", - "reachableWhatsapp", - "withoutPhone" + "mode", + "firstAt", + "batchSize", + "perDay", + "intervalMinutes" ], "additionalProperties": false + } + ], + "description": "Cuándo sale. `scheduled` y `batches` tienen que estar en el futuro. Por WhatsApp, la hora se ajusta a la ventana de 9:00–20:00 de Bogotá (la respuesta trae la real en `scheduledAt`). Lotes solo por WhatsApp, con un tope diario de 150 si firma FreeTicket y 200 si firma una organización." + }, + "AdminCrmLaunchInput": { + "type": "object", + "properties": { + "channel": { + "$ref": "#/components/schemas/AdminCrmChannel" }, - "sample": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": [ - "string", - "null" - ] - }, - "emailMasked": { - "type": "string" - }, - "phoneMasked": { - "type": [ - "string", - "null" - ] - }, - "lastPurchaseAt": { - "anyOf": [ - { - "type": "string", - "description": "ISO 8601" - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "name", - "emailMasked", - "phoneMasked", - "lastPurchaseAt" - ], - "additionalProperties": false - }, - "description": "Hasta 10 personas, enmascaradas en el servidor." + "sender": { + "$ref": "#/components/schemas/AdminCrmSender" }, - "involvedWorkspaceIds": { - "type": "array", - "items": { - "type": "string" - } + "templateName": { + "description": "Plantilla de WhatsApp aprobada (obligatoria por WhatsApp; el correo la rechaza). Ver `GET /crm/options`.", + "type": [ + "string", + "null" + ] }, - "senderChoice": { - "anyOf": [ - { - "type": "object", - "properties": { - "forced": { - "type": "boolean", - "const": true - } - }, - "required": [ - "forced" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "forced": { - "type": "boolean", - "const": false - }, - "organization": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "logoUrl": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "name", - "logoUrl" - ], - "additionalProperties": false - } - }, - "required": [ - "forced", - "organization" - ], - "additionalProperties": false - } + "subject": { + "type": "string", + "minLength": 1 + }, + "body": { + "type": "string", + "minLength": 1 + }, + "imageUrl": { + "description": "Por WhatsApp tiene que salir de la biblioteca de medios propia.", + "type": "string" + }, + "promotedEventId": { + "description": "Show PUBLICADO que se promociona (si firma una organización, uno suyo).", + "type": "string" + }, + "filter": { + "$ref": "#/components/schemas/AdminCrmAudienceFilter" + }, + "timing": { + "$ref": "#/components/schemas/AdminCrmTiming" + }, + "ignoreSendWindow": { + "description": "Solo WhatsApp con `timing.mode = now`: true = sale aunque sea fuera de las 9:00–20:00 de Bogotá. Por defecto la respeta y responde 409 `OUTSIDE_SEND_WINDOW` con `Retry-After`.", + "type": "boolean" + } + }, + "required": [ + "channel", + "sender", + "subject", + "body", + "filter", + "timing" + ], + "additionalProperties": false + }, + "AdminCrmLaunchResult": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "APPROVED", + "SCHEDULED" ] }, - "whatsappEstimate": { + "scheduledAt": { "anyOf": [ { - "type": "object", - "properties": { - "days": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "dailyCap": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "remainingToday": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - } - }, - "required": [ - "days", - "dailyCap", - "remainingToday" - ], - "additionalProperties": false + "type": "string", + "description": "ISO 8601" }, { "type": "null" } - ] + ], + "description": "Hora real de salida (ya ajustada a la ventana); null si sale ahora." + } + }, + "required": [ + "id", + "status", + "scheduledAt" + ], + "additionalProperties": false + }, + "AdminCrmBatchNextInput": { + "type": "object", + "properties": { + "ignoreSendWindow": { + "description": "true = manda aunque sea fuera de las 9:00–20:00 de Bogotá. Por defecto la respeta y responde 409 `OUTSIDE_SEND_WINDOW` con `Retry-After`.", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "AdminCrmBatchNextResult": { + "type": "object", + "properties": { + "batch": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Cuántos salen como máximo en este lote (lo envía el pipeline)." } }, "required": [ - "counts", - "sample", - "involvedWorkspaceIds", - "senderChoice", - "whatsappEstimate" + "batch" ], "additionalProperties": false }, - "AdminCrmQuotaOutlook": { + "AdminCrmBatchStopResult": { "type": "object", "properties": { - "limit": { + "skipped": { "type": "integer", "minimum": -9007199254740991, - "maximum": 9007199254740991 + "maximum": 9007199254740991, + "description": "Destinatarios pendientes que ya no se enviarán." + } + }, + "required": [ + "skipped" + ], + "additionalProperties": false + }, + "AdminCrmCancelResult": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "used": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "status": { + "type": "string", + "const": "DENIED" + } + }, + "required": [ + "id", + "status" + ], + "additionalProperties": false + }, + "AdminCrmTestSendInput": { + "type": "object", + "properties": { + "confirm": { + "type": "boolean", + "const": true, + "description": "Obligatorio y literal `true`: sin él, 422 `CONFIRMATION_REQUIRED` y no sale nada." }, - "remaining": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "channel": { + "$ref": "#/components/schemas/AdminCrmChannel" }, - "nextFreeAt": { - "anyOf": [ - { - "type": "string", - "description": "ISO 8601" - }, - { - "type": "null" - } + "sender": { + "$ref": "#/components/schemas/AdminCrmSender" + }, + "templateName": { + "description": "Plantilla de WhatsApp (obligatoria por WhatsApp).", + "type": [ + "string", + "null" ] }, - "platformDailyShare": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "subject": { + "type": "string", + "minLength": 1 }, - "committed": { - "type": "array", - "items": { - "type": "object", - "properties": { - "at": { - "type": "string", - "description": "ISO 8601" - }, - "size": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "messageId": { - "type": "string" - } - }, - "required": [ - "at", - "size", - "messageId" - ], - "additionalProperties": false - } + "body": { + "type": "string", + "minLength": 1 + }, + "imageUrl": { + "type": "string" + }, + "promotedEventId": { + "type": "string" } }, "required": [ - "limit", - "used", - "remaining", - "nextFreeAt", - "platformDailyShare", - "committed" + "confirm", + "channel", + "sender", + "subject", + "body" ], "additionalProperties": false }, - "AdminCrmWizardOptions": { + "AdminCrmTestSendResult": { "type": "object", "properties": { - "cities": { - "type": "array", - "items": { - "type": "string" - } + "to": { + "type": "string", + "description": "Destino ENMASCARADO: siempre el correo (o el teléfono del perfil) de quien llama." + } + }, + "required": [ + "to" + ], + "additionalProperties": false + }, + "AdminCrmSuppression": { + "type": "object", + "properties": { + "emailMasked": { + "type": "string" }, - "facets": { + "reason": { + "type": "string", + "description": "`admin` (la puso el equipo: se puede quitar), `unsubscribe`, `bounce`, `complaint`." + }, + "workspaceId": { + "type": "string" + }, + "isGlobal": { + "type": "boolean", + "description": "true = baja global (plataforma)." + }, + "createdAt": { + "type": "string", + "description": "ISO 8601" + } + }, + "required": [ + "emailMasked", + "reason", + "workspaceId", + "isGlobal", + "createdAt" + ], + "additionalProperties": false + }, + "AdminCrmSuppressionInput": { + "type": "object", + "properties": { + "email": { + "type": "string", + "minLength": 1, + "maxLength": 254 + } + }, + "required": [ + "email" + ], + "additionalProperties": false + }, + "AdminCrmSuppressionRemoveInput": { + "type": "object", + "properties": { + "email": { + "type": "string", + "minLength": 1, + "maxLength": 254 + }, + "confirm": { + "type": "boolean", + "const": true, + "description": "Obligatorio y literal `true`: quitar la baja vuelve a habilitar los envíos a esa persona." + } + }, + "required": [ + "email", + "confirm" + ], + "additionalProperties": false + }, + "AdminCrmSuppressionResult": { + "type": "object", + "properties": { + "emailMasked": { + "type": "string" + }, + "suppressed": { + "type": "boolean", + "description": "Cómo queda: true tras agregar, false tras quitar." + } + }, + "required": [ + "emailMasked", + "suppressed" + ], + "additionalProperties": false + }, + "AdminCrmOrganizationOption": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "logoUrl": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "slug", + "logoUrl" + ], + "additionalProperties": false + }, + "AdminCrmPeopleSearchInput": { + "type": "object", + "properties": { + "query": { + "type": "string", + "maxLength": 120, + "description": "Correo o nombre (desde 2 caracteres; menos devuelve vacío)." + }, + "scope": { + "description": "El `scope` del filtro de audiencia (`AdminCrmAudienceFilter.scope`). Sin valor: la plataforma.", "type": "object", "properties": { - "genre": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "label": { - "type": "string" - } - }, - "required": [ - "code", - "label" - ], - "additionalProperties": false - } - }, - "format": { - "type": "array", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "label": { - "type": "string" - } - }, - "required": [ - "code", - "label" - ], - "additionalProperties": false - } + "level": { + "type": "string", + "enum": [ + "platform", + "orgs", + "events" + ] } }, "required": [ - "genre", - "format" + "level" ], - "additionalProperties": false + "additionalProperties": {} + } + }, + "required": [ + "query" + ], + "additionalProperties": false + }, + "AdminCrmPersonOption": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "Completo: es lo que lleva la condición `people` del filtro." }, - "plans": { + "name": { + "description": "Solo la inicial.", + "type": [ + "string", + "null" + ] + }, + "phoneMasked": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "email", + "name", + "phoneMasked" + ], + "additionalProperties": false + }, + "AdminSettlementStatus": { + "type": "string", + "enum": [ + "DRAFT", + "GENERATED", + "SENT", + "AWAITING_PAYMENT", + "PAID", + "REQUESTED", + "PENDING", + "REJECTED" + ], + "description": "Máquina de estados: DRAFT (por enviar, legado) → GENERATED (con PDF, el organizador no la ve) → SENT (visible, el organizador reparte) → AWAITING_PAYMENT (repartida, falta transferir) → PAID. REQUESTED/PENDING/REJECTED son legado." + }, + "AdminSettlement": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "reference": { + "type": "string", + "description": "Id humano estándar: `LQ-EVT-ddmmaaaa-NOMBRE-EVENTO-FTCO`." + }, + "label": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/AdminSettlementStatus" + }, + "amount": { + "type": "number", + "description": "Monto a transferir. En un borrador automático puede ser negativo (los costos superan el recaudo)." + }, + "grossAmount": { + "type": [ + "number", + "null" + ] + }, + "unitsSold": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "currency": { + "type": "string" + }, + "notes": { + "type": [ + "string", + "null" + ] + }, + "rejectionReason": { + "type": [ + "string", + "null" + ] + }, + "hasDocument": { + "type": "boolean", + "description": "true si ya hay PDF de la liquidación." + }, + "fileName": { + "type": [ + "string", + "null" + ] + }, + "allocations": { "type": "array", "items": { "type": "object", "properties": { - "id": { + "holderName": { + "type": [ + "string", + "null" + ] + }, + "bank": { "type": "string" }, - "name": { + "accountType": { "type": "string" }, - "orgName": { + "accountLast4": { "type": "string" + }, + "percentage": { + "type": "number", + "description": "En modo AMOUNT es un derivado aproximado." + }, + "amount": { + "type": "number" + }, + "mode": { + "type": "string", + "enum": [ + "PERCENT", + "AMOUNT" + ] } }, "required": [ - "id", - "name", - "orgName" + "holderName", + "bank", + "accountType", + "accountLast4", + "percentage", + "amount", + "mode" ], "additionalProperties": false - } + }, + "description": "Reparto que confirmó el organizador (vacío = no repartió)." }, - "templates": { + "paymentProofs": { "type": "array", "items": { "type": "object", "properties": { - "name": { - "type": "string" - }, - "language": { + "fileName": { "type": "string" - }, - "hasImageHeader": { - "type": "boolean" - }, - "body": { - "type": "string" - }, - "footerText": { - "type": [ - "string", - "null" - ] - }, - "urlButtonText": { - "type": [ - "string", - "null" - ] } }, "required": [ - "name", - "language", - "hasImageHeader", - "body" + "fileName" ], "additionalProperties": false } }, - "whatsappBlockedReason": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "cities", - "facets", - "plans", - "templates", - "whatsappBlockedReason" - ], - "additionalProperties": false - }, - "AdminCrmEventOption": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "startsAt": { + "notifiedAt": { "anyOf": [ { "type": "string", @@ -5612,7 +8170,7 @@ } ] }, - "lastAt": { + "requestedAt": { "anyOf": [ { "type": "string", @@ -5623,7 +8181,7 @@ } ] }, - "nextAt": { + "paidAt": { "anyOf": [ { "type": "string", @@ -5634,131 +8192,169 @@ } ] }, - "dateCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "venueName": { - "type": [ - "string", - "null" - ] - }, - "city": { - "type": [ - "string", - "null" - ] - }, - "status": { - "type": "string" - }, - "orgName": { - "type": "string" - } - }, - "required": [ - "id", - "name", - "slug", - "startsAt", - "lastAt", - "nextAt", - "dateCount", - "venueName", - "city", - "status", - "orgName" - ], - "additionalProperties": false - }, - "AdminCrmEventDateOption": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "eventId": { - "type": "string" - }, - "startsAt": { + "createdAt": { "type": "string", "description": "ISO 8601" }, - "label": { - "type": [ - "string", - "null" - ] - }, - "status": { - "type": "string" + "organization": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "taxId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "taxId" + ], + "additionalProperties": false }, - "venueName": { - "type": [ - "string", - "null" + "event": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ], + "additionalProperties": false + }, + { + "type": "null" + } ] }, - "city": { - "type": [ - "string", - "null" + "eventDate": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "startsAt": { + "type": "string", + "description": "ISO 8601" + } + }, + "required": [ + "id", + "startsAt" + ], + "additionalProperties": false + }, + { + "type": "null" + } ] - }, - "past": { - "type": "boolean" - }, - "buyers": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 } }, "required": [ "id", - "eventId", - "startsAt", + "reference", "label", "status", - "venueName", - "city", - "past", - "buyers" + "amount", + "grossAmount", + "unitsSold", + "currency", + "notes", + "rejectionReason", + "hasDocument", + "fileName", + "allocations", + "paymentProofs", + "notifiedAt", + "requestedAt", + "paidAt", + "createdAt", + "organization", + "event", + "eventDate" ], "additionalProperties": false }, - "AdminCrmTiming": { + "AdminSettlementCreateInput": { "oneOf": [ { "type": "object", "properties": { "mode": { "type": "string", - "const": "now" - } - }, - "required": [ - "mode" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "mode": { + "const": "manual" + }, + "organizationId": { "type": "string", - "const": "scheduled" + "minLength": 1, + "maxLength": 64 }, - "at": { + "eventId": { "type": "string", - "description": "ISO 8601 con offset (ej. `2026-11-03T19:00:00-05:00`)." + "minLength": 1, + "maxLength": 64 + }, + "eventDateId": { + "description": "Requiere `eventId`. Una función tiene UNA activa.", + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "label": { + "type": "string", + "minLength": 1, + "maxLength": 200 + }, + "amount": { + "type": "number", + "exclusiveMinimum": 0, + "maximum": 9999999999.99 + }, + "currency": { + "description": "ISO 4217. Sin valor: `COP`.", + "type": "string", + "pattern": "^[A-Z]{3}$" + }, + "storagePath": { + "type": "string", + "minLength": 1, + "maxLength": 512, + "description": "`storagePath` devuelto por `POST /settlements/files`. Tiene que ser de la organización de la liquidación (`settlements/{organizationId}/…`)." + }, + "fileName": { + "type": "string", + "minLength": 1, + "maxLength": 255 + }, + "notes": { + "type": "string", + "maxLength": 1000 } }, "required": [ "mode", - "at" + "organizationId", + "label", + "amount", + "storagePath", + "fileName" ], "additionalProperties": false }, @@ -5767,180 +8363,241 @@ "properties": { "mode": { "type": "string", - "const": "batches" + "const": "auto" }, - "firstAt": { + "eventDateId": { "type": "string", - "description": "ISO 8601 con offset (ej. `2026-11-03T19:00:00-05:00`)." + "minLength": 1, + "maxLength": 64 }, - "batchSize": { - "type": "integer", - "minimum": 1, - "maximum": 200 + "integrate": { + "description": "Por defecto true. false = liquidación DE EJEMPLO: sin función asociada (no bloquea la real), label `[EJEMPLO]`.", + "type": "boolean" }, - "perDay": { - "type": "integer", - "minimum": 1, - "maximum": 24 + "commissionRate": { + "description": "Comisión de pasarela en PORCENTAJE antes de IVA (ej. 2.9916). Sin valor: la del motor.", + "type": "number", + "minimum": 0, + "maximum": 100 }, - "intervalMinutes": { - "type": "integer", - "minimum": 15, - "maximum": 1440 + "fixedFee": { + "description": "Costo fijo por transacción, base SIN IVA en COP (ej. 500; el motor suma el IVA). Sin valor: el del motor.", + "type": "number", + "minimum": 0, + "maximum": 100000 } }, "required": [ "mode", - "firstAt", - "batchSize", - "perDay", - "intervalMinutes" + "eventDateId" ], "additionalProperties": false } ], - "description": "Cuándo sale. `scheduled` y `batches` tienen que estar en el futuro. Por WhatsApp, la hora se ajusta a la ventana de 9:00–20:00 de Bogotá (la respuesta trae la real en `scheduledAt`). Lotes solo por WhatsApp, con un tope diario de 150 si firma FreeTicket y 200 si firma una organización." + "description": "`manual`: el PDF ya subido con `POST /settlements/files` y el monto digitado. `auto`: el motor calcula el borrador de la función (ventas, costos, saldo), renderiza el PDF y lo adjunta; el monto es el saldo final. Las dos nacen en GENERATED y NO notifican al organizador hasta `send`." }, - "AdminCrmLaunchInput": { + "AdminSettlementRegenerateInput": { "type": "object", "properties": { - "channel": { - "$ref": "#/components/schemas/AdminCrmChannel" - }, - "sender": { - "$ref": "#/components/schemas/AdminCrmSender" - }, - "templateName": { - "description": "Plantilla de WhatsApp aprobada (obligatoria por WhatsApp; el correo la rechaza). Ver `GET /crm/options`.", - "type": [ - "string", - "null" - ] + "commissionRate": { + "description": "Comisión de pasarela en PORCENTAJE antes de IVA (ej. 2.9916). Sin valor: la del motor.", + "type": "number", + "minimum": 0, + "maximum": 100 }, - "subject": { + "fixedFee": { + "description": "Costo fijo por transacción, base SIN IVA en COP (ej. 500; el motor suma el IVA). Sin valor: el del motor.", + "type": "number", + "minimum": 0, + "maximum": 100000 + } + }, + "additionalProperties": false + }, + "AdminSettlementConfirmInput": { + "type": "object", + "properties": { + "confirm": { + "type": "boolean", + "const": true, + "description": "Obligatorio y literal `true`: sin él, 422 `CONFIRMATION_REQUIRED`." + } + }, + "required": [ + "confirm" + ], + "additionalProperties": false + }, + "AdminSettlementMarkPaidInput": { + "type": "object", + "properties": { + "confirm": { + "type": "boolean", + "const": true, + "description": "Obligatorio y literal `true`: sin él, 422 `CONFIRMATION_REQUIRED`." + }, + "proofs": { + "minItems": 1, + "maxItems": 20, + "type": "array", + "items": { + "type": "object", + "properties": { + "storagePath": { + "type": "string", + "minLength": 1, + "maxLength": 512, + "description": "`storagePath` devuelto por `POST /settlements/files`. Tiene que ser de la organización de la liquidación (`settlements/{organizationId}/…`)." + }, + "fileName": { + "type": "string", + "minLength": 1, + "maxLength": 255 + } + }, + "required": [ + "storagePath", + "fileName" + ], + "additionalProperties": false + }, + "description": "Comprobantes de la transferencia (uno por cuenta del reparto)." + } + }, + "required": [ + "confirm", + "proofs" + ], + "additionalProperties": false + }, + "AdminSettlementAttachProofInput": { + "type": "object", + "properties": { + "storagePath": { "type": "string", - "minLength": 1 + "minLength": 1, + "maxLength": 512, + "description": "`storagePath` devuelto por `POST /settlements/files`. Tiene que ser de la organización de la liquidación (`settlements/{organizationId}/…`)." }, - "body": { + "fileName": { "type": "string", - "minLength": 1 - }, - "imageUrl": { - "description": "Por WhatsApp tiene que salir de la biblioteca de medios propia.", - "type": "string" - }, - "promotedEventId": { - "description": "Show PUBLICADO que se promociona (si firma una organización, uno suyo).", - "type": "string" - }, - "filter": { - "$ref": "#/components/schemas/AdminCrmAudienceFilter" + "minLength": 1, + "maxLength": 255 }, - "timing": { - "$ref": "#/components/schemas/AdminCrmTiming" + "amount": { + "description": "Ajusta el monto al adjuntar (opcional). Cambia el dinero que se le gira al organizador: exige `confirm: true`.", + "type": "number", + "exclusiveMinimum": 0, + "maximum": 9999999999.99 }, - "ignoreSendWindow": { - "description": "Solo WhatsApp con `timing.mode = now`: true = sale aunque sea fuera de las 9:00–20:00 de Bogotá. Por defecto la respeta y responde 409 `OUTSIDE_SEND_WINDOW` con `Retry-After`.", - "type": "boolean" + "confirm": { + "description": "Literal `true`, obligatorio solo si viene `amount`: sin él, 422 `CONFIRMATION_REQUIRED`.", + "type": "boolean", + "const": true } }, "required": [ - "channel", - "sender", - "subject", - "body", - "filter", - "timing" + "storagePath", + "fileName" ], "additionalProperties": false }, - "AdminCrmLaunchResult": { + "AdminSettlementFileUploadInput": { "type": "object", "properties": { - "id": { - "type": "string" + "organizationId": { + "type": "string", + "minLength": 1, + "maxLength": 64 }, - "status": { + "fileName": { "type": "string", - "enum": [ - "APPROVED", - "SCHEDULED" - ] + "minLength": 1, + "maxLength": 255 }, - "scheduledAt": { - "anyOf": [ - { - "type": "string", - "description": "ISO 8601" - }, - { - "type": "null" - } - ], - "description": "Hora real de salida (ya ajustada a la ventana); null si sale ahora." + "contentBase64": { + "type": "string", + "minLength": 1, + "description": "El PDF en base64 (máx. 3 MB decodificado; se verifica que empiece por `%PDF`)." } }, "required": [ - "id", - "status", - "scheduledAt" + "organizationId", + "fileName", + "contentBase64" ], "additionalProperties": false }, - "AdminCrmBatchNextInput": { + "AdminSettlementFile": { "type": "object", "properties": { - "ignoreSendWindow": { - "description": "true = manda aunque sea fuera de las 9:00–20:00 de Bogotá. Por defecto la respeta y responde 409 `OUTSIDE_SEND_WINDOW` con `Retry-After`.", - "type": "boolean" + "storagePath": { + "type": "string" + }, + "fileName": { + "type": "string" } }, + "required": [ + "storagePath", + "fileName" + ], "additionalProperties": false }, - "AdminCrmBatchNextResult": { + "AdminSettlementCreateResult": { "type": "object", "properties": { - "batch": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "Cuántos salen como máximo en este lote (lo envía el pipeline)." + "id": { + "type": "string" + }, + "status": { + "type": "string", + "const": "GENERATED" } }, "required": [ - "batch" + "id", + "status" ], "additionalProperties": false }, - "AdminCrmBatchStopResult": { + "AdminSettlementTransition": { "type": "object", "properties": { - "skipped": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "Destinatarios pendientes que ya no se enviarán." + "id": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/AdminSettlementStatus" + }, + "paidAt": { + "type": "string", + "description": "ISO 8601" + }, + "fileName": { + "type": "string" } }, "required": [ - "skipped" + "id", + "status" ], "additionalProperties": false }, - "AdminCrmCancelResult": { + "AdminSettlementDeleteResult": { "type": "object", "properties": { "id": { "type": "string" }, - "status": { - "type": "string", - "const": "DENIED" + "deleted": { + "type": "boolean", + "const": true } }, "required": [ "id", - "status" + "deleted" ], "additionalProperties": false } diff --git a/openapi.json b/openapi.json index 284a34d..47ee2b4 100644 --- a/openapi.json +++ b/openapi.json @@ -2,8 +2,8 @@ "openapi": "3.1.0", "info": { "title": "FreeTicket B2B API", - "version": "1.43.0", - "description": "FreeTicket B2B REST API for integrations, the `ft` CLI and the FreeTicket MCP server. Authentication is by API key (`Authorization: Bearer ` header or `x-api-key`); the active workspace is selected with the `X-Workspace-Id` header.\n\nScopes: each key is either `read` (GET/HEAD only) or `write` (additionally creates, edits, deletes, cancels, refunds and checks in). Self-service keys are issued as `read`. A `read` key calling a mutating method gets a 403. The machine-readable declaration lives at `/.well-known/oauth-protected-resource` (RFC 9728).\n\nGetting a key (self-serve, no sales contact): `ft login` runs the Device Authorization Grant (RFC 8628, `POST /auth/device/code` + `POST /auth/device/token`); the user approves the code at https://admin.appfreeticket.com/device and the CLI receives a key. New organizers can bootstrap headless with `POST /auth/signup` (verify-first, then `ft login`). With a key, `POST /api-keys` mints more (born `read` unless `write` is requested). There is no sandbox environment: test against a dedicated workspace with `read` keys.\n\n## Versioning and deprecation\n\n- **Path version.** The B2B API is versioned in the path (`/api/v1`). A breaking change ships under a new path (`/api/v2`); the previous version keeps running in parallel until its sunset date.\n- **Contract version.** `info.version` is the semantic version of this document. MINOR = additive (new endpoints, new optional fields, new enum values, new error codes; clients must ignore unknown fields). PATCH = documentation or fixes that do not change shapes. The public API (`/api/public`) is pre-1.0 and not versioned in the path: there, a MINOR bump may include a breaking change and PATCH never does.\n- **Deprecation signals.** A deprecated operation is marked `deprecated: true` in this document and its responses carry `Deprecation` (RFC 9745, e.g. `Deprecation: @1767225600`), `Sunset` (RFC 8594, an HTTP-date after which the operation may stop working) and `Link: ; rel=\"deprecation\"`.\n- **Timeline.** At least 6 months between the first `Deprecation` header and the `Sunset` date for `/api/v1`, and at least 90 days for `/api/public`. A path version is only retired after all its operations have sunset.\n- **Current status.** No operation is deprecated today.\n\n## Rate limits\n\n- **429 always carries `Retry-After`** (seconds). Wait at least that long before retrying the same request. The JSON error envelope comes with `error.retryable: true`; most rate-limited responses use `error.code: \"RATE_LIMITED\"`, and some return a more specific code (for example `TOO_MANY_REQUESTS` or `SEAT_BUDGET_EXHAUSTED`).\n- **RateLimit headers are sent where listed below.** Those endpoints answer every response, success or error, with the IETF RateLimit headers (draft-ietf-httpapi-ratelimit-headers): `RateLimit-Policy: \"\";q=;w=` and `RateLimit: \"\";r=;t=`. Other endpoints may answer 429 without them.\n- Counters are fixed windows kept per server instance: treat the numbers as pacing hints, not as a global account quota.\n\nEndpoints that send RateLimit headers today: `POST /auth/signup` (per client IP), `POST /customer/auth/request` and `POST /customer/auth/verify` (per client IP), and the buyer-session endpoints `GET /customer/orders/{id}`, `POST /customer/orders/{id}/payment`, `/payment/card`, `/payment/pse`, `/release`, `POST /customer/purchase-sessions` and `POST /customer/purchase-sessions/{id}/release`." + "version": "1.55.0", + "description": "FreeTicket B2B REST API for integrations, the `ft` CLI and the FreeTicket MCP server. Authentication is by API key (`Authorization: Bearer ` header or `x-api-key`); the active workspace is selected with the `X-Workspace-Id` header.\n\nScopes: each key is either `read` (GET/HEAD only) or `write` (additionally creates, edits, deletes, cancels, refunds and checks in). Self-service keys are issued as `read`. A `read` key calling a mutating method gets a 403, except on the buyer-session endpoints under `/customer/*`: there an enterprise service key acts on behalf of the buyer in `X-Customer-Session`, and its scope does not limit the buyer's own writes (e.g. `/customer/community/*`). The machine-readable declaration lives at `/.well-known/oauth-protected-resource` (RFC 9728).\n\nGetting a key (self-serve, no sales contact): `ft login` runs the Device Authorization Grant (RFC 8628, `POST /auth/device/code` + `POST /auth/device/token`); the user approves the code at https://admin.appfreeticket.com/device and the CLI receives a key. New organizers can bootstrap headless with `POST /auth/signup` (verify-first, then `ft login`). With a key, `POST /api-keys` mints more (born `read` unless `write` is requested). There is no sandbox environment: test against a dedicated workspace with `read` keys.\n\n## Versioning and deprecation\n\n- **Path version.** The B2B API is versioned in the path (`/api/v1`). A breaking change ships under a new path (`/api/v2`); the previous version keeps running in parallel until its sunset date.\n- **Contract version.** `info.version` is the semantic version of this document. MINOR = additive (new endpoints, new optional fields, new enum values, new error codes; clients must ignore unknown fields). PATCH = documentation or fixes that do not change shapes. The public API (`/api/public`) is pre-1.0 and not versioned in the path: there, a MINOR bump may include a breaking change and PATCH never does.\n- **Deprecation signals.** A deprecated operation is marked `deprecated: true` in this document and its responses carry `Deprecation` (RFC 9745, e.g. `Deprecation: @1767225600`), `Sunset` (RFC 8594, an HTTP-date after which the operation may stop working) and `Link: ; rel=\"deprecation\"`.\n- **Timeline.** At least 6 months between the first `Deprecation` header and the `Sunset` date for `/api/v1`, and at least 90 days for `/api/public`. A path version is only retired after all its operations have sunset.\n- **Current status.** No operation is deprecated today.\n\n## Rate limits\n\n- **429 always carries `Retry-After`** (seconds). Wait at least that long before retrying the same request. The JSON error envelope comes with `error.retryable: true`; most rate-limited responses use `error.code: \"RATE_LIMITED\"`, and some return a more specific code (for example `TOO_MANY_REQUESTS` or `SEAT_BUDGET_EXHAUSTED`).\n- **RateLimit headers are sent where listed below.** Those endpoints answer every response, success or error, with the IETF RateLimit headers (draft-ietf-httpapi-ratelimit-headers): `RateLimit-Policy: \"\";q=;w=` and `RateLimit: \"\";r=;t=`. Other endpoints may answer 429 without them.\n- Counters are fixed windows kept per server instance: treat the numbers as pacing hints, not as a global account quota.\n\nEndpoints that send RateLimit headers today: `POST /auth/signup` (per client IP), `POST /customer/auth/request` and `POST /customer/auth/verify` (per client IP), and the buyer-session endpoints `GET /customer/orders/{id}`, `POST /customer/orders/{id}/payment`, `/payment/card`, `/payment/pse`, `/release`, `POST /customer/purchase-sessions` and `POST /customer/purchase-sessions/{id}/release`, and the buyer community endpoints under `/customer/community/*` (per key and per buyer)." }, "servers": [ { @@ -19,14 +19,153 @@ } ], "paths": { - "/events/{id}/dates": { - "get": { - "operationId": "getEventsIdDates", + "/auth/device/code": { + "post": { + "operationId": "postAuthDeviceCode", "tags": [ - "events" + "auth" ], - "summary": "List an event's dates", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Start the Device Authorization Grant (RFC 8628)", + "description": "Public endpoint (no auth): credential bootstrap for the Device Authorization Grant (RFC 8628).", + "security": [], + "responses": { + "200": { + "description": "Flow started: device_code (polled by the CLI) + user_code (approved by the user in the browser).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeviceCodeResponse" + } + } + } + }, + "429": { + "description": "Too many requests from the same IP (anti-flood).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "503": { + "description": "Could not generate a unique device_code/user_code after retrying (persistent collision).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/auth/device/token": { + "post": { + "operationId": "postAuthDeviceToken", + "tags": [ + "auth" + ], + "summary": "CLI poll: exchanges the device_code for an API key once approved", + "description": "Public endpoint (no auth): credential bootstrap for the Device Authorization Grant (RFC 8628).", + "security": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeviceTokenRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Approved: delivers the ft_live_… API key exactly once and consumes the row.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeviceTokenResponse" + } + } + } + }, + "400": { + "description": "RFC 8628 status: authorization_pending | slow_down | expired_token | access_denied | invalid_request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DeviceTokenError" + } + } + } + } + } + } + }, + "/auth/signup": { + "post": { + "operationId": "postAuthSignup", + "tags": [ + "auth" + ], + "summary": "Headless sign-up: creates the unverified account and sends the email", + "description": "Public (no auth). Verify-first: no credential is issued. The optional `workspaceName` creates the first tenant in the same step (on the free Spark plan). Rate-limited per IP and per email.", + "security": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignupRequest" + } + } + } + }, + "responses": { + "202": { + "description": "Account pending verification (or already existing: same shape, no enumeration). The email sent is used to verify AND set a password — it reuses the staff invitation (src/lib/staff-invite.ts). With that, the user can approve an `ft login` (Device Grant) from their browser.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignupResponse" + } + } + } + }, + "422": { + "description": "Invalid body (email, name or workspaceName).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many attempts from the same IP or the same email.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/workspaces": { + "post": { + "operationId": "postWorkspaces", + "tags": [ + "me" + ], + "summary": "Create your own workspace/tenant (self-serve)", + "description": "Requires a valid API key — does NOT require an active workspace (`X-Workspace-Id` does not apply here: it is ignored if sent). The caller becomes ADMIN of the new workspace. If they already administer their own Organization (umbrella), another workspace is added there, subject to the plan quota (spark=1, star=3, icon=7); if they have no link at all, a new Organization is created on the free Spark plan. A user who is already a collaborator (staff) of someone else's workspace gets 409 `ALREADY_HAS_ACCESS`: ask an administrator to add them, instead of creating a tenant that would override their current access.", "security": [ { "apiKey": [] @@ -36,14 +175,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -54,8 +185,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkspaceCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -63,10 +204,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EventDate" - } + "$ref": "#/components/schemas/WorkspaceAccess" } }, "required": [ @@ -106,8 +244,18 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -117,14 +265,16 @@ } } } - }, - "post": { - "operationId": "postEventsIdDates", + } + }, + "/me": { + "get": { + "operationId": "getMe", "tags": [ - "events" + "me" ], - "summary": "Add a date to an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Authenticated user, role and accessible workspaces", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. `activeWorkspaceId` is `null` and `workspaces` is `[]` when the credential is valid but the user does not have any workspace yet (just registered via POST /auth/signup, before POST /workspaces).", "security": [ { "apiKey": [] @@ -134,14 +284,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -152,18 +294,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EventDateCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -171,7 +303,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EventDate" + "$ref": "#/components/schemas/Me" } }, "required": [ @@ -486,14 +618,14 @@ } } }, - "/merch/catalog": { + "/events/{id}": { "get": { - "operationId": "getMerchCatalog", + "operationId": "getEventsId", "tags": [ - "merch" + "events" ], - "summary": "Merch store catalog of the key's brand", - "description": "Requires an enterprise service API key (Legend headless landing, called server-side); the store is ALWAYS the one of the key's organization. Returns the store settings (brand, support, shipping fees by zone — Bogotá is DANE 11001 —, free-shipping threshold, delivery modes), the PUBLISHED products with their active variants and `stock` (units available right now, already net of open 15-minute reservations), the active pickup points (only when pickup is enabled) and the public key of the brand's own MercadoPago account for the Payment Brick. Prices are COP integers, VAT included; the buyer pays no service fee. Preview: with a valid `X-Merch-Preview` token (issued by the dashboard for this key's store, 1 hour) the response also includes DRAFT products (each product carries `status`), answers even while the store onboarding is pending, sets `preview: true` and `Cache-Control: private, no-store`; an invalid or expired token silently returns the public catalog. Preview never enables ordering: `POST /merch/orders` only sells PUBLISHED products. 403 `MERCH_STORE_LOCKED` when the brand's Legend plan is not active; 404 `STORE_NOT_READY` when the brand has no store, its onboarding is incomplete or it has no connected MercadoPago account (a valid preview token is exempt). `mpPublicKey` is the public key of the brand's own MercadoPago account.", + "summary": "Get an event", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -504,19 +636,18 @@ ], "parameters": [ { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } }, { - "name": "X-Merch-Preview", + "name": "X-Workspace-Id", "in": "header", "required": false, - "description": "Optional preview token from the dashboard's 'Vista previa' link (`ft_preview` query param on the landing). Valid for this key's store: includes DRAFT products, no caching. Invalid or expired: ignored.", + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", "schema": { "type": "string" } @@ -531,7 +662,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MerchCatalog" + "$ref": "#/components/schemas/Event" } }, "required": [ @@ -552,7 +683,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -562,7 +693,7 @@ } }, "404": { - "description": "Operation error.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -582,16 +713,14 @@ } } } - } - }, - "/content/videos": { - "get": { - "operationId": "getContentVideos", + }, + "patch": { + "operationId": "patchEventsId", "tags": [ - "content" + "events" ], - "summary": "List the organization's published videos", - "description": "Only published videos that have finished processing (READY) in the active workspace. Does not include the playback id: to play one, request a token from `POST /content/playback-token`.", + "summary": "Update an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nAbsent fields are left untouched. Errors (`error.code`): 409 `SLUG_TAKEN`; 422 `PULEP_REQUIRED` (only evaluated when the request changes `genre` or `pulepCode`); 422 `GENRE_OTHER_WITHOUT_OTRO` (`genreOther` sent without `genre` while the stored genre is not \"otro\"); 422 `CLASSIFICATION_CONFLICT` (the resulting genre + audience, merged with the stored values, are incompatible, e.g. \"familiar\" with an 18+ audience). `genre`/`subgenre`/`audience` are validated against the stored classification (422 `CLASSIFICATION_CONFLICT`) and then saved as manual classification facets on a best-effort basis. Publication status, the external ticketing URL and the artist lineup have their own endpoints.", "security": [ { "apiKey": [] @@ -602,19 +731,9 @@ ], "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } @@ -629,6 +748,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventUpdate" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -638,18 +767,11 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ContentVideo" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/Event" } }, "required": [ - "data", - "page" + "data" ] } } @@ -685,6 +807,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -696,16 +828,14 @@ } } } - } - }, - "/content/lives": { - "get": { - "operationId": "getContentLives", + }, + "delete": { + "operationId": "deleteEventsId", "tags": [ - "content" + "events" ], - "summary": "List the organization's live streams", - "description": "Live streams from the active workspace, newest first. `status: ACTIVE` is the one on air. Does not include the RTMP key or the playback ids.", + "summary": "Delete an event (soft delete)", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nReturns 409 `EVENT_HAS_SALES` when the event has CONFIRMED or REFUNDED sales; cancel it with `POST /events/{id}/cancel` instead.", "security": [ { "apiKey": [] @@ -716,19 +846,9 @@ ], "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } @@ -749,22 +869,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ContentLive" - } - }, - "page": { - "$ref": "#/components/schemas/Page" - } - }, - "required": [ - "data", - "page" - ] + "type": "object" } } } @@ -799,6 +904,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -810,14 +925,16 @@ } } } - }, + } + }, + "/events/{id}/publish": { "post": { - "operationId": "postContentLives", + "operationId": "postEventsIdPublish", "tags": [ - "content" + "events" ], - "summary": "Create a live stream", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New live stream\" in the dashboard: creates the stream in Mux and returns the RTMPS server and stream key to configure OBS or any encoder.\n\nSECURITY: `streamKey` is a secret that grants broadcasting rights on this stream in the organization's name. It is returned ONLY here and by `POST /content/lives/{id}/reset-key`, never by `GET /content/lives`, `GET /content/lives/{id}` or `PATCH`. Store it like a password; if it leaks, rotate it with reset-key.\n\n`memberOnly` is forced to false when the workspace has no active membership plan (nobody to restrict it to). With `eventDateId` and no `scheduledAt`, the stream inherits the show date's start time.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, or `scheduledAt` not in \"YYYY-MM-DDTHH:mm\" format.\n- 400 `INVALID_SCHEDULE`: `scheduledAt` is in the past or more than 2 years ahead.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include streaming.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: `eventDateId` does not exist or is not an event of this workspace (as owner or linked artist).\n- 409 `EVENT_DATE_HAS_LIVE`: that show date already has a live stream.\n- 502 `MUX_ERROR`: Mux rejected the request or is not configured; nothing was created.", + "summary": "Publish an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nPublishes the event and its dates (cancelled dates stay cancelled unless the whole event was `CANCELLED`). Requires at least one future date (409 `CONFLICT`).\n\nSeated (seats.io) events are validated first:\n- 409 `SEATSIO_INVALID`: a seated date has no ticket type mapped to a chart category, or maps a category missing from the chart.\n- 409 `SEAT_MAP_CATEGORIES_UNCOVERED`: a chart category with seats on sale has no ticket type on that date and is not fully blocked (booked). `error.details.zones[]` lists each one (`dateLabel`, `categoryKey`, `categoryLabel`, `seats`). Create its ticket type or block those seats, then retry.\n- 503 `SEAT_MAP_UNVERIFIABLE` (retryable): seats.io could not be reached to verify the map.\n\nPaid events (any ticket type with price > 0) require the workspace identity verification to be approved:\n- 409 `IDENTITY_VERIFICATION_REQUIRED`: the event stays `DRAFT` and is queued; it publishes automatically within ~5 minutes of the verification being approved.", "security": [ { "apiKey": [] @@ -827,6 +944,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -837,18 +962,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentLiveCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -856,7 +971,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentLiveCreated" + "$ref": "#/components/schemas/Event" } }, "required": [ @@ -866,16 +981,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -926,147 +1031,8 @@ } } }, - "502": { - "description": "The external provider failed to complete the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/auth/device/code": { - "post": { - "operationId": "postAuthDeviceCode", - "tags": [ - "auth" - ], - "summary": "Start the Device Authorization Grant (RFC 8628)", - "description": "Public endpoint (no auth): credential bootstrap for the Device Authorization Grant (RFC 8628).", - "security": [], - "responses": { - "200": { - "description": "Flow started: device_code (polled by the CLI) + user_code (approved by the user in the browser).", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeviceCodeResponse" - } - } - } - }, - "429": { - "description": "Too many requests from the same IP (anti-flood).", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "503": { - "description": "Could not generate a unique device_code/user_code after retrying (persistent collision).", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/auth/device/token": { - "post": { - "operationId": "postAuthDeviceToken", - "tags": [ - "auth" - ], - "summary": "CLI poll: exchanges the device_code for an API key once approved", - "description": "Public endpoint (no auth): credential bootstrap for the Device Authorization Grant (RFC 8628).", - "security": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeviceTokenRequest" - } - } - } - }, - "responses": { - "200": { - "description": "Approved: delivers the ft_live_… API key exactly once and consumes the row.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeviceTokenResponse" - } - } - } - }, - "400": { - "description": "RFC 8628 status: authorization_pending | slow_down | expired_token | access_denied | invalid_request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/DeviceTokenError" - } - } - } - } - } - } - }, - "/auth/signup": { - "post": { - "operationId": "postAuthSignup", - "tags": [ - "auth" - ], - "summary": "Headless sign-up: creates the unverified account and sends the email", - "description": "Public (no auth). Verify-first: no credential is issued. The optional `workspaceName` creates the first tenant in the same step (on the free Spark plan). Rate-limited per IP and per email.", - "security": [], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SignupRequest" - } - } - } - }, - "responses": { - "202": { - "description": "Account pending verification (or already existing: same shape, no enumeration). The email sent is used to verify AND set a password — it reuses the staff invitation (src/lib/staff-invite.ts). With that, the user can approve an `ft login` (Device Grant) from their browser.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SignupResponse" - } - } - } - }, - "422": { - "description": "Invalid body (email, name or workspaceName).", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "429": { - "description": "Too many attempts from the same IP or the same email.", + "description": "Service unavailable: an external dependency is down or initialization failed.", "content": { "application/json": { "schema": { @@ -1078,14 +1044,14 @@ } } }, - "/workspaces": { + "/events/{id}/cancel": { "post": { - "operationId": "postWorkspaces", + "operationId": "postEventsIdCancel", "tags": [ - "me" + "events" ], - "summary": "Create your own workspace/tenant (self-serve)", - "description": "Requires a valid API key — does NOT require an active workspace (`X-Workspace-Id` does not apply here: it is ignored if sent). The caller becomes ADMIN of the new workspace. If they already administer their own Organization (umbrella), another workspace is added there, subject to the plan quota (spark=1, star=3, icon=7); if they have no link at all, a new Organization is created on the free Spark plan. A user who is already a collaborator (staff) of someone else's workspace gets 409 `ALREADY_HAS_ACCESS`: ask an administrator to add them, instead of creating a tenant that would override their current access.", + "summary": "Cancel an event (keeps the record and its sales)", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nSets the event and ALL its dates to `CANCELLED` and turns off the waiting room. Unlike `DELETE /events/{id}`, it PRESERVES the record: sales, issued tickets and the audit trail for refunds remain. Idempotent: cancelling an already-cancelled event returns 200 with no changes. Does not trigger refunds — use `POST /sales/{id}/refund` for that.", "security": [ { "apiKey": [] @@ -1095,6 +1061,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -1105,18 +1079,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WorkspaceCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -1124,7 +1088,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/WorkspaceAccess" + "$ref": "#/components/schemas/Event" } }, "required": [ @@ -1164,18 +1128,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { - "description": "Operation error.", + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -1187,14 +1141,14 @@ } } }, - "/me": { + "/events/{id}/dates": { "get": { - "operationId": "getMe", + "operationId": "getEventsIdDates", "tags": [ - "me" + "events" ], - "summary": "Authenticated user, role and accessible workspaces", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. `activeWorkspaceId` is `null` and `workspaces` is `[]` when the credential is valid but the user does not have any workspace yet (just registered via POST /auth/signup, before POST /workspaces).", + "summary": "List an event's dates", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -1204,6 +1158,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -1223,7 +1185,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Me" + "type": "array", + "items": { + "$ref": "#/components/schemas/EventDate" + } } }, "required": [ @@ -1274,16 +1239,14 @@ } } } - } - }, - "/events/{id}": { - "get": { - "operationId": "getEventsId", + }, + "post": { + "operationId": "postEventsIdDates", "tags": [ "events" ], - "summary": "Get an event", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Add a date to an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -1311,8 +1274,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventDateCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -1320,7 +1293,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Event" + "$ref": "#/components/schemas/EventDate" } }, "required": [ @@ -1371,14 +1344,16 @@ } } } - }, + } + }, + "/events/{id}/dates/{dateId}": { "patch": { - "operationId": "patchEventsId", + "operationId": "patchEventsIdDatesDateId", "tags": [ "events" ], - "summary": "Update an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nAbsent fields are left untouched. Errors (`error.code`): 409 `SLUG_TAKEN`; 422 `PULEP_REQUIRED` (only evaluated when the request changes `genre` or `pulepCode`); 422 `GENRE_OTHER_WITHOUT_OTRO` (`genreOther` sent without `genre` while the stored genre is not \"otro\"); 422 `CLASSIFICATION_CONFLICT` (the resulting genre + audience, merged with the stored values, are incompatible, e.g. \"familiar\" with an 18+ audience). `genre`/`subgenre`/`audience` are validated against the stored classification (422 `CLASSIFICATION_CONFLICT`) and then saved as manual classification facets on a best-effort basis. Publication status, the external ticketing URL and the artist lineup have their own endpoints.", + "summary": "Update an event date", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -1396,6 +1371,14 @@ "type": "string" } }, + { + "name": "dateId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -1411,7 +1394,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EventUpdate" + "$ref": "#/components/schemas/EventDateUpdate" } } } @@ -1425,7 +1408,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Event" + "$ref": "#/components/schemas/EventDate" } }, "required": [ @@ -1465,16 +1448,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -1488,12 +1461,12 @@ } }, "delete": { - "operationId": "deleteEventsId", + "operationId": "deleteEventsIdDatesDateId", "tags": [ "events" ], - "summary": "Delete an event (soft delete)", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nReturns 409 `EVENT_HAS_SALES` when the event has CONFIRMED or REFUNDED sales; cancel it with `POST /events/{id}/cancel` instead.", + "summary": "Delete an event date", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -1511,6 +1484,14 @@ "type": "string" } }, + { + "name": "dateId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -1585,14 +1566,14 @@ } } }, - "/events/{id}/publish": { - "post": { - "operationId": "postEventsIdPublish", + "/events/{id}/artists": { + "put": { + "operationId": "putEventsIdArtists", "tags": [ "events" ], - "summary": "Publish an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nPublishes the event and its dates (cancelled dates stay cancelled unless the whole event was `CANCELLED`). Requires at least one future date (409 `CONFLICT`).\n\nSeated (seats.io) events are validated first:\n- 409 `SEATSIO_INVALID`: a seated date has no ticket type mapped to a chart category, or maps a category missing from the chart.\n- 409 `SEAT_MAP_CATEGORIES_UNCOVERED`: a chart category with seats on sale has no ticket type on that date and is not fully blocked (booked). `error.details.zones[]` lists each one (`dateLabel`, `categoryKey`, `categoryLabel`, `seats`). Create its ticket type or block those seats, then retry.\n- 503 `SEAT_MAP_UNVERIFIABLE` (retryable): seats.io could not be reached to verify the map.\n\nPaid events (any ticket type with price > 0) require the workspace identity verification to be approved:\n- 409 `IDENTITY_VERIFICATION_REQUIRED`: the event stays `DRAFT` and is queued; it publishes automatically within ~5 minutes of the verification being approved.", + "summary": "Replace the event lineup", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nReplaces the artists linked to the event with `artistIds`, in that order (the lineup order). Artists not in the list are unlinked (send the full lineup, not a diff); `[]` clears it. Ids come from `GET /artists?q=` (workspace ids of registered artists). Newly linked artists get a notification email.\n\n`inviteEmails` invites artists without an account: each email gets an invitation (only once per email and event) and is linked when it signs up. `inviteEmails` is additive: omitting it does not cancel existing invitations (use `DELETE /events/{id}/artist-invitations/{invitationId}`).\n\nIds that are not a registered artist (or the event's own workspace) are skipped and reported in `warnings[]` with code `ARTIST_IDS_IGNORED` (`ids`).\n\nLimits: up to 50 `artistIds` and 20 `inviteEmails` per request; 20 lineup changes per hour per API key and event (429 `RATE_LIMITED` with `Retry-After`).", "security": [ { "apiKey": [] @@ -1620,6 +1601,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventArtistsReplace" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -1630,6 +1621,12 @@ "properties": { "data": { "$ref": "#/components/schemas/Event" + }, + "warnings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Warning" + } } }, "required": [ @@ -1669,16 +1666,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -1689,27 +1676,38 @@ } } }, - "503": { - "description": "Service unavailable: an external dependency is down or initialization failed.", + "429": { + "description": "Too many requests: rate limit exceeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } } } } } }, - "/events/{id}/cancel": { - "post": { - "operationId": "postEventsIdCancel", + "/events/{id}/artists/{organizationId}": { + "delete": { + "operationId": "deleteEventsIdArtistsOrganizationId", "tags": [ "events" ], - "summary": "Cancel an event (keeps the record and its sales)", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nSets the event and ALL its dates to `CANCELLED` and turns off the waiting room. Unlike `DELETE /events/{id}`, it PRESERVES the record: sales, issued tickets and the audit trail for refunds remain. Idempotent: cancelling an already-cancelled event returns 200 with no changes. Does not trigger refunds — use `POST /sales/{id}/refund` for that.", + "summary": "Unlink an artist from an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nRemoves one artist from the event lineup. Allowed for the workspace that owns the event, or for the artist itself (`organizationId` equal to the active workspace) to remove itself from an event it was linked to. 404 `EVENT_NOT_FOUND` when the event is not owned by the workspace; 404 `ARTIST_NOT_LINKED` when the artist is not in its lineup (when unlinking itself, the artist always gets `ARTIST_NOT_LINKED`).", "security": [ { "apiKey": [] @@ -1727,6 +1725,14 @@ "type": "string" } }, + { + "name": "organizationId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -1746,7 +1752,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Event" + "$ref": "#/components/schemas/EventArtistUnlink" } }, "required": [ @@ -1799,14 +1805,14 @@ } } }, - "/events/{id}/dates/{dateId}": { - "patch": { - "operationId": "patchEventsIdDatesDateId", + "/events/{id}/artist-invitations": { + "get": { + "operationId": "getEventsIdArtistInvitations", "tags": [ "events" ], - "summary": "Update an event date", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", + "summary": "List artist invitations of an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nPending and expired invitations sent to artists without an account (via `inviteEmails` in `PUT /events/{id}/artists`), newest first. Accepted invitations are not listed: they are already linked artists. Invitations expire 14 days after being sent.", "security": [ { "apiKey": [] @@ -1824,14 +1830,6 @@ "type": "string" } }, - { - "name": "dateId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -1842,16 +1840,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EventDateUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -1861,7 +1849,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EventDate" + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtistInvitation" + } } }, "required": [ @@ -1912,14 +1903,16 @@ } } } - }, + } + }, + "/events/{id}/artist-invitations/{invitationId}": { "delete": { - "operationId": "deleteEventsIdDatesDateId", + "operationId": "deleteEventsIdArtistInvitationsInvitationId", "tags": [ "events" ], - "summary": "Delete an event date", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Cancel an artist invitation", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nCancels a pending or expired invitation; its link stops working. 409 `INVITATION_ACCEPTED` when the artist already accepted it (unlink the artist with `DELETE /events/{id}/artists/{organizationId}` instead).", "security": [ { "apiKey": [] @@ -1938,7 +1931,7 @@ } }, { - "name": "dateId", + "name": "invitationId", "in": "path", "required": true, "schema": { @@ -1961,7 +1954,15 @@ "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/ArtistInvitationDeleted" + } + }, + "required": [ + "data" + ] } } } @@ -2019,14 +2020,14 @@ } } }, - "/events/{id}/artists": { - "put": { - "operationId": "putEventsIdArtists", + "/events/{id}/artist-invitations/{invitationId}/resend": { + "post": { + "operationId": "postEventsIdArtistInvitationsInvitationIdResend", "tags": [ "events" ], - "summary": "Replace the event lineup", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nReplaces the artists linked to the event with `artistIds`, in that order (the lineup order). Artists not in the list are unlinked (send the full lineup, not a diff); `[]` clears it. Ids come from `GET /artists?q=` (workspace ids of registered artists). Newly linked artists get a notification email.\n\n`inviteEmails` invites artists without an account: each email gets an invitation (only once per email and event) and is linked when it signs up. `inviteEmails` is additive: omitting it does not cancel existing invitations (use `DELETE /events/{id}/artist-invitations/{invitationId}`).\n\nIds that are not a registered artist (or the event's own workspace) are skipped and reported in `warnings[]` with code `ARTIST_IDS_IGNORED` (`ids`).\n\nLimits: up to 50 `artistIds` and 20 `inviteEmails` per request; 20 lineup changes per hour per API key and event (429 `RATE_LIMITED` with `Retry-After`).", + "summary": "Resend an artist invitation", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nResends the invitation email and renews its expiry to 14 days from now (status back to `PENDING`, same link). Works on expired invitations too. 409 `INVITATION_ACCEPTED` when already accepted. 502 `EMAIL_NOT_SENT` when the email provider failed (the expiry was renewed; retry). Rate limited: 3 resends per hour per API key and invitation (429 `RATE_LIMITED` with `Retry-After`).", "security": [ { "apiKey": [] @@ -2044,6 +2045,14 @@ "type": "string" } }, + { + "name": "invitationId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -2054,16 +2063,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EventArtistsReplace" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -2073,13 +2072,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Event" - }, - "warnings": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Warning" - } + "$ref": "#/components/schemas/ArtistInvitation" } }, "required": [ @@ -2119,6 +2112,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -2149,18 +2152,28 @@ "$ref": "#/components/headers/RateLimitPolicy" } } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } }, - "/events/{id}/artists/{organizationId}": { - "delete": { - "operationId": "deleteEventsIdArtistsOrganizationId", + "/artists": { + "get": { + "operationId": "getArtists", "tags": [ - "events" + "artists" ], - "summary": "Unlink an artist from an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nRemoves one artist from the event lineup. Allowed for the workspace that owns the event, or for the artist itself (`organizationId` equal to the active workspace) to remove itself from an event it was linked to. 404 `EVENT_NOT_FOUND` when the event is not owned by the workspace; 404 `ARTIST_NOT_LINKED` when the artist is not in its lineup (when unlinking itself, the artist always gets `ARTIST_NOT_LINKED`).", + "summary": "Search registered artists", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.\n\nSearches artist workspaces registered on FreeTicket by name (case-insensitive, `q` of 2+ characters). Returns public brand data only. Use the `id` in `PUT /events/{id}/artists`; for artists without an account use `inviteEmails` there.", "security": [ { "apiKey": [] @@ -2171,17 +2184,28 @@ ], "parameters": [ { - "name": "id", - "in": "path", + "name": "q", + "in": "query", "required": true, + "description": "Name to search, 2-100 characters", "schema": { "type": "string" } }, { - "name": "organizationId", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -2205,11 +2229,18 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EventArtistUnlink" + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtistSummary" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } @@ -2258,14 +2289,14 @@ } } }, - "/events/{id}/artist-invitations": { + "/events/{id}/viewers": { "get": { - "operationId": "getEventsIdArtistInvitations", + "operationId": "getEventsIdViewers", "tags": [ "events" ], - "summary": "List artist invitations of an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nPending and expired invitations sent to artists without an account (via `inviteEmails` in `PUT /events/{id}/artists`), newest first. Accepted invitations are not listed: they are already linked artists. Invitations expire 14 days after being sent.", + "summary": "List read-only viewers of an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nPeople with read-only access to this event's statistics (they see only `/stats`, nothing else of the workspace), newest first. Only events owned by the active workspace (an event where the workspace is just a linked artist is 404). A key restricted by `event_scope` gets 403 `EVENT_SCOPE_FORBIDDEN` for events outside its scope.", "security": [ { "apiKey": [] @@ -2304,7 +2335,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/ArtistInvitation" + "$ref": "#/components/schemas/EventViewer" } } }, @@ -2356,16 +2387,14 @@ } } } - } - }, - "/events/{id}/artist-invitations/{invitationId}": { - "delete": { - "operationId": "deleteEventsIdArtistInvitationsInvitationId", + }, + "post": { + "operationId": "postEventsIdViewers", "tags": [ "events" ], - "summary": "Cancel an artist invitation", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nCancels a pending or expired invitation; its link stops working. 409 `INVITATION_ACCEPTED` when the artist already accepted it (unlink the artist with `DELETE /events/{id}/artists/{organizationId}` instead).", + "summary": "Grant read-only access to an event's statistics", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nGives the owner of `email` read-only access to this event's statistics and emails them the link. If no account exists for that email, a read-only (`VIEWER`) account is created with no access to the rest of the workspace, and a second email lets them set a password. The response does not say whether an account already existed (`newAccount` is deprecated and never sent). Idempotent per event and person: 201 when the access is new, 200 when it already existed (the notice email is sent again). 502 `EMAIL_NOT_SENT` when the email provider failed (the access WAS granted; retry to resend). Rate limited: 10 invitations per 10 minutes per API key (429 `RATE_LIMITED` with `Retry-After`).", "security": [ { "apiKey": [] @@ -2383,14 +2412,6 @@ "type": "string" } }, - { - "name": "invitationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -2401,8 +2422,36 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventViewerInvite" + } + } + } + }, "responses": { "200": { + "description": "The person already had access.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/EventViewerInviteResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "201": { "description": "OK", "content": { "application/json": { @@ -2410,7 +2459,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ArtistInvitationDeleted" + "$ref": "#/components/schemas/EventViewerInviteResult" } }, "required": [ @@ -2450,131 +2499,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/events/{id}/artist-invitations/{invitationId}/resend": { - "post": { - "operationId": "postEventsIdArtistInvitationsInvitationIdResend", - "tags": [ - "events" - ], - "summary": "Resend an artist invitation", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nResends the invitation email and renews its expiry to 14 days from now (status back to `PENDING`, same link). Works on expired invitations too. 409 `INVITATION_ACCEPTED` when already accepted. 502 `EMAIL_NOT_SENT` when the email provider failed (the expiry was renewed; retry). Rate limited: 3 resends per hour per API key and invitation (429 `RATE_LIMITED` with `Retry-After`).", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "invitationId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/ArtistInvitation" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -2619,14 +2543,14 @@ } } }, - "/artists": { - "get": { - "operationId": "getArtists", + "/events/{id}/viewers/{viewerId}": { + "delete": { + "operationId": "deleteEventsIdViewersViewerId", "tags": [ - "artists" + "events" ], - "summary": "Search registered artists", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.\n\nSearches artist workspaces registered on FreeTicket by name (case-insensitive, `q` of 2+ characters). Returns public brand data only. Use the `id` in `PUT /events/{id}/artists`; for artists without an account use `inviteEmails` there.", + "summary": "Revoke a read-only viewer of an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE: removes this person's read-only access to the event's statistics. Their account is kept (it may have access to other events). `viewerId` is the access id returned by `GET /events/{id}/viewers`, not the user id. An access of another event or workspace is 404.", "security": [ { "apiKey": [] @@ -2635,30 +2559,20 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { - "name": "q", - "in": "query", + "name": "id", + "in": "path", "required": true, - "description": "Name to search, 2-100 characters", "schema": { "type": "string" } }, { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, + "name": "viewerId", + "in": "path", + "required": true, "schema": { "type": "string" } @@ -2682,18 +2596,11 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtistSummary" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/EventViewerRevoke" } }, "required": [ - "data", - "page" + "data" ] } } @@ -2742,14 +2649,14 @@ } } }, - "/events/{id}/viewers": { + "/events/{id}/validators": { "get": { - "operationId": "getEventsIdViewers", + "operationId": "getEventsIdValidators", "tags": [ "events" ], - "summary": "List read-only viewers of an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nPeople with read-only access to this event's statistics (they see only `/stats`, nothing else of the workspace), newest first. Only events owned by the active workspace (an event where the workspace is just a linked artist is 404). A key restricted by `event_scope` gets 403 `EVENT_SCOPE_FORBIDDEN` for events outside its scope.", + "summary": "List the ticket validators of an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDoor staff who can validate tickets for this event: those assigned to it plus those with no events assigned (`allEvents: true`, they validate every event of the workspace). Includes inactive validators (`isActive: false`). `userId` and `name` are only returned for members of the active workspace. Only events owned by the active workspace. A key restricted by `event_scope` gets 403 `EVENT_SCOPE_FORBIDDEN` for events outside its scope.", "security": [ { "apiKey": [] @@ -2788,7 +2695,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/EventViewer" + "$ref": "#/components/schemas/EventValidator" } } }, @@ -2842,12 +2749,12 @@ } }, "post": { - "operationId": "postEventsIdViewers", + "operationId": "postEventsIdValidators", "tags": [ "events" ], - "summary": "Grant read-only access to an event's statistics", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nGives the owner of `email` read-only access to this event's statistics and emails them the link. If no account exists for that email, a read-only (`VIEWER`) account is created with no access to the rest of the workspace, and a second email lets them set a password. The response does not say whether an account already existed (`newAccount` is deprecated and never sent). Idempotent per event and person: 201 when the access is new, 200 when it already existed (the notice email is sent again). 502 `EMAIL_NOT_SENT` when the email provider failed (the access WAS granted; retry to resend). Rate limited: 10 invitations per 10 minutes per API key (429 `RATE_LIMITED` with `Retry-After`).", + "summary": "Add a ticket validator to an event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nAssigns door staff to this event. If no account exists for `email`, a `STAFF` account is created in the workspace and an invitation email is sent so they can set a password (`invited: true`). If the person is already a validator of this workspace, they are reactivated and this event is added to their list (assignments are additive: existing events are never removed; a validator with no events assigned already validates every event of the workspace, so nothing is added and they keep `allEvents: true`). `userId` and `name` are only returned when the person is a member of the active workspace (otherwise only the `email` sent is echoed). 409 `VALIDATOR_OTHER_WORKSPACE` when that person cannot be assigned as a validator of this workspace (the message is intentionally generic). To remove a validator, change their access with `PUT /staff/{id}/access` or revoke it with `DELETE /staff/{id}`. Rate limited: 10 per 10 minutes per API key (429 `RATE_LIMITED` with `Retry-After`).", "security": [ { "apiKey": [] @@ -2880,30 +2787,12 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EventViewerInvite" + "$ref": "#/components/schemas/EventValidatorCreate" } } } }, "responses": { - "200": { - "description": "The person already had access.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/EventViewerInviteResult" - } - }, - "required": [ - "data" - ] - } - } - } - }, "201": { "description": "OK", "content": { @@ -2912,7 +2801,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EventViewerInviteResult" + "$ref": "#/components/schemas/EventValidatorCreateResult" } }, "required": [ @@ -2952,6 +2841,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -2982,28 +2881,18 @@ "$ref": "#/components/headers/RateLimitPolicy" } } - }, - "502": { - "description": "The external provider failed to complete the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } } } } }, - "/events/{id}/viewers/{viewerId}": { - "delete": { - "operationId": "deleteEventsIdViewersViewerId", + "/ticket-types": { + "get": { + "operationId": "getTicketTypes", "tags": [ - "events" + "ticket-types" ], - "summary": "Revoke a read-only viewer of an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE: removes this person's read-only access to the event's statistics. Their account is kept (it may have access to other events). `viewerId` is the access id returned by `GET /events/{id}/viewers`, not the user id. An access of another event or workspace is 404.", + "summary": "List workspace ticket types", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -3012,20 +2901,30 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "eventDateId", + "in": "query", + "required": false, + "description": "filter by event date", "schema": { "type": "string" } }, { - "name": "viewerId", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -3049,11 +2948,18 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EventViewerRevoke" + "type": "array", + "items": { + "$ref": "#/components/schemas/TicketType" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } @@ -3100,16 +3006,14 @@ } } } - } - }, - "/events/{id}/validators": { - "get": { - "operationId": "getEventsIdValidators", + }, + "post": { + "operationId": "postTicketTypes", "tags": [ - "events" + "ticket-types" ], - "summary": "List the ticket validators of an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDoor staff who can validate tickets for this event: those assigned to it plus those with no events assigned (`allEvents: true`, they validate every event of the workspace). Includes inactive validators (`isActive: false`). `userId` and `name` are only returned for members of the active workspace. Only events owned by the active workspace. A key restricted by `event_scope` gets 403 `EVENT_SCOPE_FORBIDDEN` for events outside its scope.", + "summary": "Create a ticket type", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -3119,14 +3023,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -3137,8 +3033,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TicketTypeCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -3146,10 +3052,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/EventValidator" - } + "$ref": "#/components/schemas/TicketType" } }, "required": [ @@ -3200,14 +3103,16 @@ } } } - }, - "post": { - "operationId": "postEventsIdValidators", + } + }, + "/ticket-types/{id}": { + "get": { + "operationId": "getTicketTypesId", "tags": [ - "events" + "ticket-types" ], - "summary": "Add a ticket validator to an event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nAssigns door staff to this event. If no account exists for `email`, a `STAFF` account is created in the workspace and an invitation email is sent so they can set a password (`invited: true`). If the person is already a validator of this workspace, they are reactivated and this event is added to their list (assignments are additive: existing events are never removed; a validator with no events assigned already validates every event of the workspace, so nothing is added and they keep `allEvents: true`). `userId` and `name` are only returned when the person is a member of the active workspace (otherwise only the `email` sent is echoed). 409 `VALIDATOR_OTHER_WORKSPACE` when that person cannot be assigned as a validator of this workspace (the message is intentionally generic). To remove a validator, change their access with `PUT /staff/{id}/access` or revoke it with `DELETE /staff/{id}`. Rate limited: 10 per 10 minutes per API key (429 `RATE_LIMITED` with `Retry-After`).", + "summary": "Get a ticket type", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -3235,18 +3140,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EventValidatorCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -3254,355 +3149,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/EventValidatorCreateResult" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } - } - } - } - } - }, - "/ticket-types": { - "get": { - "operationId": "getTicketTypes", - "tags": [ - "ticket-types" - ], - "summary": "List workspace ticket types", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "parameters": [ - { - "name": "eventDateId", - "in": "query", - "required": false, - "description": "filter by event date", - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TicketType" - } - }, - "page": { - "$ref": "#/components/schemas/Page" - } - }, - "required": [ - "data", - "page" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, - "post": { - "operationId": "postTicketTypes", - "tags": [ - "ticket-types" - ], - "summary": "Create a ticket type", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "parameters": [ - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TicketTypeCreate" - } - } - } - }, - "responses": { - "201": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/TicketType" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/ticket-types/{id}": { - "get": { - "operationId": "getTicketTypesId", - "tags": [ - "ticket-types" - ], - "summary": "Get a ticket type", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/TicketType" + "$ref": "#/components/schemas/TicketType" } }, "required": [ @@ -4422,14 +3969,14 @@ } } }, - "/event-dates/{id}/courtesy-seats": { - "get": { - "operationId": "getEventDatesIdCourtesySeats", + "/sales/{id}/refund": { + "post": { + "operationId": "postSalesIdRefund", "tags": [ - "events" + "sales" ], - "summary": "List blocked seats that can be issued as courtesies", - "description": "For a numbered (seats.io) event date: the seats that are booked on the map without an order (blocked from sale by the event wizard or by hand) and are not claimed by any live sale, grouped by numbered ticket type (matched by seats.io category). These are the seats the dashboard offers when issuing a courtesy. A date without a seat map, or without numbered ticket types, returns `ticketTypes: []`. 503 SEATSIO_UNAVAILABLE (retryable) when seats.io could not be read. Minimum role: `ADMIN`.", + "summary": "Refund a sale (moving the funds depends on the payment gateway)", + "description": "Marks the sale as REFUNDED and releases the associated numbered seats. IMPORTANT: whether the money goes back to the buyer depends on the payment gateway and the payment method used. Sales charged through MercadoPago are fully refunded against the MercadoPago API (stable idempotency key per sale, so retries never refund twice) and marked only once MercadoPago confirms. A 503 GATEWAY_REFUND_PENDING means MercadoPago did not answer clearly: the sale stays CONFIRMED and repeating the same call is safe. Sales charged through Wompi by CARD are voided against the payment gateway before being marked. In every other case this endpoint does NOT trigger the actual refund: the money is NOT returned automatically and a 200 only confirms the accounting status change. Those refunds must be handled separately in the payment gateway's dashboard. PARTIAL REFUND BY TICKET: send `items` with the ids of the sale items to refund (the `id` field of GET /sales/{id}/tickets). Each item refunds its prorated share of the sale total (by item subtotal; shares always add up to the exact total). The refunded tickets are invalidated at the door and their quota returns to stock; when no live item remains the sale becomes REFUNDED. Only MercadoPago (or uncharged / cash sales) support partial refunds: Wompi and Bold answer 409 GATEWAY_REFUND_NOT_SUPPORTED. Items already checked in answer 409 ITEM_ALREADY_CHECKED_IN — also for a FULL refund (no `items`, or all of them): a sale with any checked-in ticket is never refunded whole; refund the unused tickets by item; items from another sale answer 422 ITEM_NOT_IN_SALE; a refund already in flight over the same items answers 409 REFUND_IN_PROGRESS (retry exactly the same items). `block_seats: true` (also valid for a full refund) keeps the refunded numbered seats OUT of sale: seats.io moves them from booked straight to a blocked status, never through free. The `refund` object in the response reports the refunded amount and what happened to the seats. Wompi payment methods without API refunds (PSE, Nequi, Bancolombia transfer) respond 409: return the money in the Wompi dashboard and repeat the call with {\"acknowledge_manual\": true} to reflect the accounting status. A 502 means the gateway rejected the void and the sale remains CONFIRMED.", "security": [ { "apiKey": [] @@ -4457,6 +4004,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SaleRefundRequest" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -4466,7 +4023,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CourtesySeats" + "$ref": "#/components/schemas/SaleRefundResult" } }, "required": [ @@ -4506,8 +4063,28 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", "content": { "application/json": { "schema": { @@ -4529,14 +4106,14 @@ } } }, - "/membership-plans": { - "get": { - "operationId": "getMembershipPlans", + "/sales/{id}/items/{itemId}/transfer": { + "post": { + "operationId": "postSalesIdItemsItemIdTransfer", "tags": [ - "membership-plans" + "sales" ], - "summary": "List the workspace's membership plans", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Transfer one ticket of a sale to another person (destructive)", + "description": "DESTRUCTIVE: changes the ticket holder and voids the previous QR code (the ticket code is rotated and any installed Apple Wallet pass stops working). The new holder receives the ticket by email and the buyer is notified. Same rules as the dashboard and the buyer: the recipient must already have a verified FreeTicket buyer account (the holder name comes from that account), each ticket can be transferred only once (no staff override) and only until the show starts. 422 RECIPIENT_NOT_REGISTERED / SELF_TRANSFER: fix the recipient. 409 NOT_CONFIRMED, ALREADY_TRANSFERRED, CHECKED_IN, REFUNDED, ADDON, PRESALE_NOT_TRANSFERABLE, MULTI_QUANTITY, EVENT_STARTED or CONFLICT (the ticket changed in flight; re-read and retry). Not idempotent: a retry after success answers 409 ALREADY_TRANSFERRED. Minimum role: `ADMIN`.", "security": [ { "apiKey": [] @@ -4545,21 +4122,20 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", + "name": "id", + "in": "path", + "required": true, "schema": { - "type": "integer", - "default": 20 + "type": "string" } }, { - "name": "cursor", - "in": "query", - "required": false, + "name": "itemId", + "in": "path", + "required": true, "schema": { "type": "string" } @@ -4574,6 +4150,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SaleItemTransferRequest" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -4583,18 +4169,11 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MembershipPlan" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/SaleItemTransfer" } }, "required": [ - "data", - "page" + "data" ] } } @@ -4630,6 +4209,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -4641,14 +4230,16 @@ } } } - }, - "post": { - "operationId": "postMembershipPlans", + } + }, + "/sales/{id}/recipient": { + "patch": { + "operationId": "patchSalesIdRecipient", "tags": [ - "membership-plans" + "sales" ], - "summary": "Create a membership plan", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Correct the recipient of a courtesy sale and resend its tickets", + "description": "DESTRUCTIVE when the email changes (previous QR codes are voided). Only for courtesy sales issued from the dashboard (confirmed, `is_courtesy`); any other sale answers 404. Updates the recipient's name and email and resends the tickets to the corrected address. When the email changes, the ticket codes of the non-transferred tickets are rotated, so the QR codes sent to the wrong address stop working (`ticketCodesRotated: true`). Minimum role: `ADMIN`.", "security": [ { "apiKey": [] @@ -4657,7 +4248,16 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -4673,13 +4273,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MembershipPlanCreate" + "$ref": "#/components/schemas/CourtesyRecipientUpdate" } } } }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -4687,7 +4287,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MembershipPlan" + "$ref": "#/components/schemas/CourtesyRecipient" } }, "required": [ @@ -4740,14 +4340,14 @@ } } }, - "/membership-plans/{id}": { + "/event-dates/{id}/courtesy-seats": { "get": { - "operationId": "getMembershipPlansId", + "operationId": "getEventDatesIdCourtesySeats", "tags": [ - "membership-plans" + "events" ], - "summary": "Get a membership plan", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "List blocked seats that can be issued as courtesies", + "description": "For a numbered (seats.io) event date: the seats that are booked on the map without an order (blocked from sale by the event wizard or by hand) and are not claimed by any live sale, grouped by numbered ticket type (matched by seats.io category). These are the seats the dashboard offers when issuing a courtesy. A date without a seat map, or without numbered ticket types, returns `ticketTypes: []`. 503 SEATSIO_UNAVAILABLE (retryable) when seats.io could not be read. Minimum role: `ADMIN`.", "security": [ { "apiKey": [] @@ -4784,7 +4384,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MembershipPlan" + "$ref": "#/components/schemas/CourtesySeats" } }, "required": [ @@ -4833,16 +4433,28 @@ } } } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } - }, - "patch": { - "operationId": "patchMembershipPlansId", + } + }, + "/membership-plans": { + "get": { + "operationId": "getMembershipPlans", "tags": [ "membership-plans" ], - "summary": "Update a membership plan", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", + "summary": "List the workspace's membership plans", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -4853,9 +4465,19 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -4870,16 +4492,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MembershipPlanUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -4889,11 +4501,18 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MembershipPlan" + "type": "array", + "items": { + "$ref": "#/components/schemas/MembershipPlan" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } @@ -4941,12 +4560,12 @@ } } }, - "delete": { - "operationId": "deleteMembershipPlansId", + "post": { + "operationId": "postMembershipPlans", "tags": [ "membership-plans" ], - "summary": "Delete a membership plan (soft delete)", + "summary": "Create a membership plan", "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -4957,14 +4576,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -4975,13 +4586,31 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MembershipPlanCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MembershipPlan" + } + }, + "required": [ + "data" + ] } } } @@ -5016,16 +4645,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -5039,13 +4658,13 @@ } } }, - "/venues": { + "/membership-plans/{id}": { "get": { - "operationId": "getVenues", + "operationId": "getMembershipPlansId", "tags": [ - "venues" + "membership-plans" ], - "summary": "List workspace venues", + "summary": "Get a membership plan", "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -5057,19 +4676,9 @@ ], "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } @@ -5093,18 +4702,11 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Venue" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/MembershipPlan" } }, "required": [ - "data", - "page" + "data" ] } } @@ -5152,12 +4754,12 @@ } } }, - "post": { - "operationId": "postVenues", + "patch": { + "operationId": "patchMembershipPlansId", "tags": [ - "venues" + "membership-plans" ], - "summary": "Create a venue", + "summary": "Update a membership plan", "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -5168,6 +4770,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -5183,13 +4793,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/VenueCreate" + "$ref": "#/components/schemas/MembershipPlanUpdate" } } } }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -5197,7 +4807,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Venue" + "$ref": "#/components/schemas/MembershipPlan" } }, "required": [ @@ -5248,16 +4858,14 @@ } } } - } - }, - "/venues/{id}": { - "get": { - "operationId": "getVenuesId", + }, + "delete": { + "operationId": "deleteMembershipPlansId", "tags": [ - "venues" + "membership-plans" ], - "summary": "Get a venue", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Delete a membership plan (soft delete)", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -5291,15 +4899,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/Venue" - } - }, - "required": [ - "data" - ] + "type": "object" } } } @@ -5334,6 +4934,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -5345,14 +4955,16 @@ } } } - }, - "patch": { - "operationId": "patchVenuesId", + } + }, + "/venues": { + "get": { + "operationId": "getVenues", "tags": [ "venues" ], - "summary": "Update a venue", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", + "summary": "List workspace venues", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -5363,9 +4975,19 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -5380,16 +5002,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VenueUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -5399,11 +5011,18 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Venue" + "type": "array", + "items": { + "$ref": "#/components/schemas/Venue" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } @@ -5451,12 +5070,12 @@ } } }, - "delete": { - "operationId": "deleteVenuesId", + "post": { + "operationId": "postVenues", "tags": [ "venues" ], - "summary": "Delete a venue (soft delete)", + "summary": "Create a venue", "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -5467,14 +5086,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -5485,13 +5096,31 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VenueCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/Venue" + } + }, + "required": [ + "data" + ] } } } @@ -5539,14 +5168,14 @@ } } }, - "/staff": { + "/venues/{id}": { "get": { - "operationId": "getStaff", + "operationId": "getVenuesId", "tags": [ - "staff" + "venues" ], - "summary": "List staff with access to the workspace", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. With `?workspaceIds=`, cursor pagination is still per user: `limit` counts people, not rows.", + "summary": "Get a venue", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -5557,28 +5186,9 @@ ], "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "workspaceIds", - "in": "query", - "required": false, - "description": "Comma-separated workspace ids (max. 25). Returns the staff of all of them in a single call, with each row tagged with `workspaceId`/`workspaceName` (one row per person and workspace). Always intersected with the workspaces the credential can already manage: it never widens its scope. Without the parameter, the workspace from the `X-Workspace-Id` header is listed.", + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } @@ -5602,18 +5212,11 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/StaffUser" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/Venue" } }, "required": [ - "data", - "page" + "data" ] } } @@ -5661,12 +5264,12 @@ } } }, - "post": { - "operationId": "postStaff", + "patch": { + "operationId": "patchVenuesId", "tags": [ - "staff" + "venues" ], - "summary": "Create a staff user in the workspace", + "summary": "Update a venue", "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -5677,6 +5280,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -5692,13 +5303,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/StaffCreate" + "$ref": "#/components/schemas/VenueUpdate" } } } }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -5706,7 +5317,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/StaffUser" + "$ref": "#/components/schemas/Venue" } }, "required": [ @@ -5746,16 +5357,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -5765,38 +5366,15 @@ } } } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } - } } } - } - }, - "/staff/{id}": { - "get": { - "operationId": "getStaffId", + }, + "delete": { + "operationId": "deleteVenuesId", "tags": [ - "staff" + "venues" ], - "summary": "Get a staff member", + "summary": "Delete a venue (soft delete)", "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -5831,15 +5409,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/StaffUser" - } - }, - "required": [ - "data" - ] + "type": "object" } } } @@ -5885,14 +5455,16 @@ } } } - }, - "delete": { - "operationId": "deleteStaffId", + } + }, + "/staff": { + "get": { + "operationId": "getStaff", "tags": [ "staff" ], - "summary": "Revoke a staff member's access to this workspace", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nRevokes access to THIS workspace: granted sections, ticket validation permissions, read-only events, membership, and the home workspace if it was this one. Terminates live sessions and invalidates the invitation QR code. It does NOT delete the account or its history: the person may belong to other workspaces. An `ADMIN` cannot revoke another admin (403) or themselves (409).", + "summary": "List staff with access to the workspace", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. With `?workspaceIds=`, cursor pagination is still per user: `limit` counts people, not rows.", "security": [ { "apiKey": [] @@ -5903,9 +5475,28 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "workspaceIds", + "in": "query", + "required": false, + "description": "Comma-separated workspace ids (max. 25). Returns the staff of all of them in a single call, with each row tagged with `workspaceId`/`workspaceName` (one row per person and workspace). Always intersected with the workspaces the credential can already manage: it never widens its scope. Without the parameter, the workspace from the `X-Workspace-Id` header is listed.", "schema": { "type": "string" } @@ -5926,7 +5517,22 @@ "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StaffUser" + } + }, + "page": { + "$ref": "#/components/schemas/Page" + } + }, + "required": [ + "data", + "page" + ] } } } @@ -5961,16 +5567,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -5982,15 +5578,13 @@ } } } - } - }, - "/staff/{id}/role": { - "patch": { - "operationId": "patchStaffIdRole", + }, + "post": { + "operationId": "postStaff", "tags": [ "staff" ], - "summary": "Change a staff user's role", + "summary": "Create a staff user in the workspace", "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -6001,14 +5595,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -6024,13 +5610,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/RoleUpdate" + "$ref": "#/components/schemas/StaffCreate" } } } }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -6097,18 +5683,39 @@ } } } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } } } } }, - "/staff/{id}/resend-invite": { - "post": { - "operationId": "postStaffIdResendInvite", + "/staff/{id}": { + "get": { + "operationId": "getStaffId", "tags": [ "staff" ], - "summary": "Resend a staff member's invitation email", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nEmails the staff member their invitation link again (to set a password and enter the panel). The link is the same persistent one already shared, so previously shared links and QR codes keep working; the link itself is never returned by the API. An `ADMIN` can only target users whose home workspace is the active one (otherwise 404). 409 `NO_EMAIL` for quick-access accounts without an email address (share their QR from the panel). 502 `EMAIL_NOT_SENT` when the email provider failed (retry). Rate limited: 3 resends per hour per API key and user (429 `RATE_LIMITED` with `Retry-After`). Keys restricted by `event_scope` get 403.", + "summary": "Get a staff member", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -6145,7 +5752,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/StaffInviteResend" + "$ref": "#/components/schemas/StaffUser" } }, "required": [ @@ -6185,8 +5792,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -6194,9 +5801,56 @@ } } } + } + } + }, + "delete": { + "operationId": "deleteStaffId", + "tags": [ + "staff" + ], + "summary": "Revoke a staff member's access to this workspace", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nRevokes access to THIS workspace: granted sections, ticket validation permissions, read-only events, membership, and the home workspace if it was this one. Terminates live sessions and invalidates the invitation QR code. It does NOT delete the account or its history: the person may belong to other workspaces. An `ADMIN` cannot revoke another admin (403) or themselves (409).", + "security": [ + { + "apiKey": [] }, - "422": { - "description": "Request body/parameter validation failed.", + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -6205,29 +5859,38 @@ } } }, - "429": { - "description": "Too many requests: rate limit exceeded.", + "403": { + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } } } }, - "502": { - "description": "The external provider failed to complete the operation.", + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -6239,14 +5902,14 @@ } } }, - "/staff/{id}/access": { - "put": { - "operationId": "putStaffIdAccess", + "/staff/{id}/role": { + "patch": { + "operationId": "patchStaffIdRole", "tags": [ "staff" ], - "summary": "Replace a staff member's access in this workspace", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE (full replace): sets what the user can do in the active workspace and removes whatever is not in the body. `accessType`: `admin` (role `ADMIN`, everything; only a `SUPER_ADMIN` can grant it, otherwise 403 `ADMIN_REQUIRES_SUPER_ADMIN`), `validador` (role `STAFF`, ticket validation only; `validatorEventIds` limits which events, empty = all events of the workspace), `personalizado` (role `STAFF`, only the listed `sections`; including `validar` also enables validation, limited by `validatorEventIds`) or `lectura` (role `VIEWER`, read-only statistics of `viewerEventIds`). `expiresAt` (`YYYY-MM-DD`, end of that day in the workspace timezone; null = permanent). `expiresAt` in the past is rejected (422). Event ids must belong to the workspace (422 `INVALID_EVENTS`). Nobody can change their own access (409 `SELF_ACCESS`). Only a `SUPER_ADMIN` can change the access of a user whose global role is `SUPER_ADMIN`, `ADMIN` or `MINCULTURA`, or who is an `OWNER`/`ADMIN` of the organization that owns the workspace (403 `TARGET_ROLE_FORBIDDEN`). 409 `VALIDATOR_OTHER_WORKSPACE` when the access enables ticket validation and the user cannot be assigned as a validator of this workspace (nothing is written). An `ADMIN` can only target users whose home workspace is the active one (otherwise 404). Note: the role is the user's global role. Keys restricted by `event_scope` get 403.", + "summary": "Change a staff user's role", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -6255,7 +5918,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -6280,7 +5942,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/StaffAccessUpdate" + "$ref": "#/components/schemas/RoleUpdate" } } } @@ -6294,7 +5956,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/StaffAccess" + "$ref": "#/components/schemas/StaffUser" } }, "required": [ @@ -6357,14 +6019,14 @@ } } }, - "/reports/summary": { - "get": { - "operationId": "getReportsSummary", + "/staff/{id}/resend-invite": { + "post": { + "operationId": "postStaffIdResendInvite", "tags": [ - "reports" + "staff" ], - "summary": "Workspace KPIs (revenue, tickets, sales, memberships)", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Resend a staff member's invitation email", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nEmails the staff member their invitation link again (to set a password and enter the panel). The link is the same persistent one already shared, so previously shared links and QR codes keep working; the link itself is never returned by the API. An `ADMIN` can only target users whose home workspace is the active one (otherwise 404). 409 `NO_EMAIL` for quick-access accounts without an email address (share their QR from the panel). 502 `EMAIL_NOT_SENT` when the email provider failed (retry). Rate limited: 3 resends per hour per API key and user (429 `RATE_LIMITED` with `Retry-After`). Keys restricted by `event_scope` get 403.", "security": [ { "apiKey": [] @@ -6375,19 +6037,275 @@ ], "parameters": [ { - "name": "period", - "in": "query", - "required": false, - "description": "7d | 30d (default) | 90d | 1y", + "name": "id", + "in": "path", + "required": true, "schema": { - "type": "string", - "enum": [ - "7d", - "30d", - "90d", - "1y" - ], - "default": "30d" + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/StaffInviteResend" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/staff/{id}/access": { + "put": { + "operationId": "putStaffIdAccess", + "tags": [ + "staff" + ], + "summary": "Replace a staff member's access in this workspace", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE (full replace): sets what the user can do in the active workspace and removes whatever is not in the body. `accessType`: `admin` (role `ADMIN`, everything; only a `SUPER_ADMIN` can grant it, otherwise 403 `ADMIN_REQUIRES_SUPER_ADMIN`), `validador` (role `STAFF`, ticket validation only; `validatorEventIds` limits which events, empty = all events of the workspace), `personalizado` (role `STAFF`, only the listed `sections`; including `validar` also enables validation, limited by `validatorEventIds`) or `lectura` (role `VIEWER`, read-only statistics of `viewerEventIds`). `expiresAt` (`YYYY-MM-DD`, end of that day in the workspace timezone; null = permanent). `expiresAt` in the past is rejected (422). Event ids must belong to the workspace (422 `INVALID_EVENTS`). Nobody can change their own access (409 `SELF_ACCESS`). Only a `SUPER_ADMIN` can change the access of a user whose global role is `SUPER_ADMIN`, `ADMIN` or `MINCULTURA`, or who is an `OWNER`/`ADMIN` of the organization that owns the workspace (403 `TARGET_ROLE_FORBIDDEN`). 409 `VALIDATOR_OTHER_WORKSPACE` when the access enables ticket validation and the user cannot be assigned as a validator of this workspace (nothing is written). An `ADMIN` can only target users whose home workspace is the active one (otherwise 404). Note: the role is the user's global role. Keys restricted by `event_scope` get 403.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "x-ft-destructive": true, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/StaffAccessUpdate" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/StaffAccess" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/reports/summary": { + "get": { + "operationId": "getReportsSummary", + "tags": [ + "reports" + ], + "summary": "Workspace KPIs (revenue, tickets, sales, memberships)", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "period", + "in": "query", + "required": false, + "description": "7d | 30d (default) | 90d | 1y", + "schema": { + "type": "string", + "enum": [ + "7d", + "30d", + "90d", + "1y" + ], + "default": "30d" } }, { @@ -7740,7 +7658,7 @@ "settlements" ], "summary": "Workspace settlements (payouts to the organizer)", - "description": "Lists the settlements visible to the organization (SENT, AWAITING_PAYMENT, PAID) with their standard id, amount, event/event date, and payment proofs. Download the files with `GET /settlements/{id}/document` (PDF) and `GET /settlements/{id}/proofs/{fileName}` (bank transfer proofs).", + "description": "Lists the settlements visible to the organization (SENT, AWAITING_PAYMENT, PAID) with their standard id, `kind` (EVENT or MEMBERSHIP), amount, event/event date (EVENT) or period/membership plan (MEMBERSHIP), and payment proofs. Membership settlements have no event, so an API key restricted to events (`event_scope`) never sees them. Download the files with `GET /settlements/{id}/document` (PDF) and `GET /settlements/{id}/proofs/{fileName}` (bank transfer proofs).", "security": [ { "apiKey": [] @@ -7759,6 +7677,19 @@ "type": "string" } }, + { + "name": "kind", + "in": "query", + "required": false, + "description": "EVENT|MEMBERSHIP. Omit to list both.", + "schema": { + "type": "string", + "enum": [ + "EVENT", + "MEMBERSHIP" + ] + } + }, { "name": "status", "in": "query", @@ -9582,14 +9513,14 @@ } } }, - "/tickets/{ticketCode}/checkin": { + "/tickets/{ticketCode}/resend": { "post": { - "operationId": "postTicketsTicketCodeCheckin", + "operationId": "postTicketsTicketCodeResend", "tags": [ "tickets" ], - "summary": "Check in a ticket at the door", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Resend the confirmation email with the ticket", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -9617,16 +9548,6 @@ } } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CheckinRequest" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -9636,7 +9557,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CheckinResult" + "$ref": "#/components/schemas/ResendTicket" } }, "required": [ @@ -9695,105 +9616,9 @@ } } } - } - } - }, - "delete": { - "operationId": "deleteTicketsTicketCodeCheckin", - "tags": [ - "tickets" - ], - "summary": "Undo a ticket check-in (destructive)", - "description": "DESTRUCTIVE: reverts a door check-in so the ticket is valid again. Use it to fix a wrong scan; it is recorded in the audit log as CHECKIN_UNDO. Requires `ADMIN` (not `STAFF`): a checked-in ticket blocks cancelling its sale, and undoing the check-in reopens that path. The show's validation window does not apply. Idempotent: a ticket that is not checked in answers 200 with `undone: false`. 409 CHECKIN_CHANGED when the check-in changed between the read and the write (another undo or a new scan): re-read the ticket and retry. Minimum role: `ADMIN`.", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "x-ft-destructive": true, - "parameters": [ - { - "name": "ticketCode", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/CheckinUndoResult" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", + "502": { + "description": "The external provider failed to complete the operation.", "content": { "application/json": { "schema": { @@ -9805,13 +9630,13 @@ } } }, - "/tickets/{ticketCode}/access": { - "get": { - "operationId": "getTicketsTicketCodeAccess", + "/tickets/{ticketCode}/checkin": { + "post": { + "operationId": "postTicketsTicketCodeCheckin", "tags": [ "tickets" ], - "summary": "Check a ticket's validity without consuming it", + "summary": "Check in a ticket at the door", "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header.", "security": [ { @@ -9840,113 +9665,16 @@ } } ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/TicketAccess" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } + "requestBody": { + "required": false, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CheckinRequest" } } } - } - } - }, - "/api-keys": { - "get": { - "operationId": "getApiKeys", - "tags": [ - "api-keys" - ], - "summary": "List my API keys", - "description": "Lists the authenticated user's API keys (never the hash or the plaintext secret).", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "parameters": [ - { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], + }, "responses": { "200": { "description": "OK", @@ -9956,18 +9684,338 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ApiKey" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/CheckinResult" } }, "required": [ - "data", - "page" + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteTicketsTicketCodeCheckin", + "tags": [ + "tickets" + ], + "summary": "Undo a ticket check-in (destructive)", + "description": "DESTRUCTIVE: reverts a door check-in so the ticket is valid again. Use it to fix a wrong scan; it is recorded in the audit log as CHECKIN_UNDO. Requires `ADMIN` (not `STAFF`): a checked-in ticket blocks cancelling its sale, and undoing the check-in reopens that path. The show's validation window does not apply. Idempotent: a ticket that is not checked in answers 200 with `undone: false`. 409 CHECKIN_CHANGED when the check-in changed between the read and the write (another undo or a new scan): re-read the ticket and retry. Minimum role: `ADMIN`.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "x-ft-destructive": true, + "parameters": [ + { + "name": "ticketCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CheckinUndoResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/tickets/{ticketCode}/access": { + "get": { + "operationId": "getTicketsTicketCodeAccess", + "tags": [ + "tickets" + ], + "summary": "Check a ticket's validity without consuming it", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "ticketCode", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/TicketAccess" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/api-keys": { + "get": { + "operationId": "getApiKeys", + "tags": [ + "api-keys" + ], + "summary": "List my API keys", + "description": "Lists the authenticated user's API keys (never the hash or the plaintext secret).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApiKey" + } + }, + "page": { + "$ref": "#/components/schemas/Page" + } + }, + "required": [ + "data", + "page" ] } } @@ -10911,7 +10959,7 @@ "customer" ], "summary": "Exchange the headless SSO one-time token for a session token", - "description": "Server-to-server: requires an enterprise service API key (Bearer or x-api-key). Exchanges the one-time token issued by /api/customer-auth/enterprise-return (single-use, 60 s TTL) for the buyer's session token. Plain body, no { data } envelope.", + "description": "Server-to-server: requires an enterprise service API key (Bearer or x-api-key). Exchanges the one-time token issued by /api/customer-auth/enterprise-return (single-use, 60 s TTL) for a buyer session token dedicated to the API key's workspace. Plain body, no { data } envelope.", "security": [ { "apiKey": [] @@ -10966,6 +11014,9 @@ }, "422": { "description": "Invalid body." + }, + "503": { + "description": "The dedicated session could not be created. The one-time token was consumed: restart the login flow." } } } @@ -11186,7 +11237,7 @@ "subscriptions" ], "summary": "Cancel the buyer's own membership", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, the workspace is the one pinned to it (any `workspaceId` in the body is ignored); without a key, `workspaceId` is REQUIRED in the body (422 if missing). The membership is ALWAYS resolved from the buyer session (a CustomerMembership id is never accepted). It first cancels the recurring charge at the provider and then marks the membership as CANCELLED. Idempotent.", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, the workspace is the one pinned to it (any `workspaceId` in the body is ignored); without a key, `workspaceId` is REQUIRED in the body (422 if missing). The membership is ALWAYS resolved from the buyer session (a CustomerMembership id is never accepted). It first stops the recurring charge at the provider (Stripe: at period end) and then sets `auto_renew=false` and `cancelledAt`: the buyer KEEPS access until `expiresAt`, so `status` stays ACTIVE until then. A membership without expiry (LIFETIME) is cancelled immediately (`status` CANCELLED). Idempotent.", "security": [ { "apiKey": [] @@ -12037,165 +12088,16 @@ } } }, - "/customer/purchase-sessions": { - "post": { - "operationId": "postCustomerPurchaseSessions", - "tags": [ - "customer", - "purchase-sessions" - ], - "summary": "Open the purchase session (only one live per buyer)", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, the event date must belong to the workspace pinned to it; otherwise 404). Opens THE buyer purchase session: there is ONLY one live per buyer across any tab or device, and the latest wins — the previous one becomes `superseded` (it can no longer create an order or start a new payment) and its seats.io hold is released, unless it backs a live sale. On seated event dates the server ISSUES the `holdToken` (mount the chart with `session: \"manual\"`) and sets `seatsDeadline`: each session gets up to 3 minutes and the budget is 3 attempts (9 CUMULATIVE minutes) per buyer and event date, summing all of their sessions within a 30-minute window, and it only runs while no order has been created. Once exhausted, it responds 429 with `error.code` `SEAT_BUDGET_EXHAUSTED`, `error.details.reason` `seat_budget_exhausted` and `error.details.retryAfterSeconds` (10-minute cooldown; also in the `Retry-After` header). If the SAME browser (`deviceKey`) reopens the SAME event date with its session alive, it gets that same session with 200 instead of 201. Only event dates on sale: published event and current event date (otherwise 404). Limits: 10 creations per minute per buyer, 30 per minute per IP when called without an API key, and a global ceiling per event date (429 `RATE_LIMITED`). Once the session is created, `POST /customer/orders` and the payment POSTs carry the `X-Purchase-Session: ` header; when the clock runs out, call `POST /customer/purchase-sessions/{id}/release`.", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "parameters": [ - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PurchaseSessionCreateRequest" - } - } - } - }, - "responses": { - "200": { - "description": "The SAME browser (`deviceKey`) reopened the SAME event date while its session was still alive: that session is returned (same `holdToken`, same clock) and nothing was created.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/PurchaseSessionCreated" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "201": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/PurchaseSessionCreated" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } - } - }, - "503": { - "description": "Service unavailable: an external dependency is down or initialization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/customer/purchase-sessions/{id}": { + "/customer/newsletter": { "get": { - "operationId": "getCustomerPurchaseSessionsId", + "operationId": "getCustomerNewsletter", "tags": [ - "customer", - "purchase-sessions" + "customer" ], - "summary": "Purchase session status", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL. Returns the status of one of THE buyer's purchase sessions: `live` (this tab can create the order), `superseded` (another tab or device replaced it: stop offering the map and the payment), `expired` (the map clock ran out or it was released) or `converted` (it already created its order: `orderId`). A session whose `seatsDeadline` has passed is reported as `expired` immediately. Designed to be polled every ~10 s. Another buyer's session is 404.", + "summary": "Buyer newsletter subscription status in a workspace", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, the workspace is the one pinned to it (`workspaceId` is ignored); without a key, `workspaceId` is REQUIRED (422 if missing, 404 if the workspace does not exist). `subscribed` is true while the buyer is subscribed.", "security": [ + {}, { "apiKey": [] }, @@ -12205,9 +12107,10 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "workspaceId", + "in": "query", + "required": false, + "description": "Required only without an enterprise service API key. Ignored with a key.", "schema": { "type": "string" } @@ -12231,7 +12134,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/PurchaseSessionStatus" + "$ref": "#/components/schemas/CustomerNewsletterState" } }, "required": [ @@ -12262,7 +12165,7 @@ } }, "404": { - "description": "Resource does not exist or is out of scope.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -12272,7 +12175,7 @@ } }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -12282,17 +12185,14 @@ } } } - } - }, - "/customer/purchase-sessions/{id}/release": { + }, "post": { - "operationId": "postCustomerPurchaseSessionsIdRelease", + "operationId": "postCustomerNewsletter", "tags": [ - "customer", - "purchase-sessions" + "customer" ], - "summary": "Release the seats of a purchase session", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL. Marks the session `expired` and releases in seats.io the seats held with its `holdToken`. Idempotent: repeating it changes nothing. It NEVER releases a token that backs a live sale (pending payment or confirmed) nor that of a `converted` session: those seats belong to the order. Call it when the map clock runs out. Another buyer's session is 404.", + "summary": "Subscribe the buyer to the workspace newsletter", + "description": "Requires the `X-Customer-Session` header AND the enterprise service API key: the workspace is the one pinned to the key (403 without a key; `workspaceId` is ignored). The workspace must be on the Legend plan (403 otherwise). The body must carry explicit consent (`consent: true` + `consentTextVersion`; 422 if missing). Idempotent: subscribing twice keeps one subscription, and subscribing after unsubscribing reactivates it; each call records the new consent and `subscribedAt` becomes its date.", "security": [ { "apiKey": [] @@ -12302,14 +12202,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -12320,6 +12212,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerNewsletterSubscribe" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -12329,7 +12231,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/PurchaseSessionStatus" + "$ref": "#/components/schemas/CustomerNewsletterState" } }, "required": [ @@ -12350,7 +12252,7 @@ } }, "403": { - "description": "Insufficient role or resource not accessible.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -12370,48 +12272,26 @@ } }, "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", + "description": "Operation error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } } } } - } - }, - "/content/posts": { - "get": { - "operationId": "getContentPosts", + }, + "delete": { + "operationId": "deleteCustomerNewsletter", "tags": [ - "content" + "customer" ], - "summary": "List the organization's community feed", - "description": "Posts from the active workspace, newest first, excluding deleted posts and posts scheduled for the future. A post with `locked: true` arrives redacted (`content`, `imageUrl`, `videoId`, `eventId` and `link` set to null, `commentsCount` set to 0): it is members-only content and the key does not represent a buyer with a current membership. Does not include `likes_count` (only visible to the workspace owner) or the post's internal author.", + "summary": "Unsubscribe the buyer from the workspace newsletter", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, the workspace is the one pinned to it (`workspaceId` is ignored); without a key, `workspaceId` is REQUIRED (422 if missing, 404 if the workspace does not exist). Idempotent: unsubscribing when not subscribed also returns `subscribed: false`.", "security": [ + {}, { "apiKey": [] }, @@ -12421,19 +12301,10 @@ ], "parameters": [ { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", + "name": "workspaceId", "in": "query", "required": false, + "description": "Required only without an enterprise service API key. Ignored with a key.", "schema": { "type": "string" } @@ -12457,18 +12328,11 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ContentPost" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/CustomerNewsletterState" } }, "required": [ - "data", - "page" + "data" ] } } @@ -12495,7 +12359,7 @@ } }, "404": { - "description": "Resource does not exist or is out of scope.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -12505,7 +12369,7 @@ } }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -12515,14 +12379,17 @@ } } } - }, - "post": { - "operationId": "postContentPosts", + } + }, + "/customer/orders": { + "get": { + "operationId": "getCustomerOrders", "tags": [ - "content" + "customer", + "orders" ], - "summary": "Publish community content (including articles)", - "description": "Creates a community post. `type=ARTICLE` requires `title` and `body` (Markdown) and builds a slug unique per organization (manual via `slug`, or derived from `title` if omitted); `type=TEXT`/`IMAGE` require `content` or `imageUrl`, same as the dashboard composer. Unlike the dashboard, this path does NOT resolve the link's Open Graph snapshot (`link` is always null in the response). Minimum role ADMIN, like every other `POST` in `/api/v1`. If the workspace has the `community_v2` flag enabled, publishing enqueues a notification to members in the same transaction; with a future `publishedAt`, the notification goes out when the post is published. The response does not change.", + "summary": "The purchase the buyer left unfinished for this event date", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, results are additionally scoped to the workspace pinned to it; without a key, any of the buyer's own unfinished purchases is visible. Returns the PENDING sale whose inventory hold is STILL ALIVE that the buyer has for that event date —with its seats, its total and when it expires—, or `order: null` if there is none. This is what lets reloading the checkout, or coming back from signing in, RESUME the purchase instead of starting from scratch: the seats remain held in that person's name. If `paymentOpened` is true the payment is already open and `POST /customer/orders/{id}/payment` returns the SAME signed configuration; to discard it and pick other seats, use `POST /customer/orders/{id}/release`.", "security": [ { "apiKey": [] @@ -12532,6 +12399,15 @@ } ], "parameters": [ + { + "name": "eventDateId", + "in": "query", + "required": false, + "description": "Required. The event date being queried.", + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -12542,18 +12418,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentPostCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -12561,7 +12427,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentPost" + "$ref": "#/components/schemas/CustomerOrderCurrent" } }, "required": [ @@ -12571,16 +12437,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -12611,18 +12467,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -12632,16 +12478,15 @@ } } } - } - }, - "/content/lives/{id}": { - "get": { - "operationId": "getContentLivesId", + }, + "post": { + "operationId": "postCustomerOrders", "tags": [ - "content" + "customer", + "orders" ], - "summary": "Live stream status", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Create the ticket reservation (step 1 of the headless purchase)", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, the date and the ticket type must belong to the workspace pinned to it (anything else is 404); without a key, it is enough for the ticket type to exist and be on sale (same eligibility as the first-party checkout). Reserves inventory and creates the PENDING sale with the SAME rules as the first-party checkout (stock under lock, seats validated against seats.io, per-buyer limit, presale, memberships and virtual queue turn). The buyer email comes from the session, never from the body. Rejections carry a stable `reason` in `error.details.reason` (`sold_out`, `queue_turn_required`, `seats_not_held`, `members_only`, `members_only_withdrawn` — a members-only ticket whose artist withdrew the permission or left the lineup: it is no longer sold even to members —, …). With `pending_sale_in_progress` the inventory is taken by a half-paid purchase FROM THE SAME buyer: `error.details.pendingSaleId` and `pendingReference` identify it, and the right step is to reopen its payment with `POST /customer/orders/{pendingSaleId}/payment` (idempotent) instead of reserving again. If `free` is true the sale is already confirmed and `/payment` must NOT be called. Next step: `POST /customer/orders/{id}/payment`.", "security": [ { "apiKey": [] @@ -12652,25 +12497,36 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", "schema": { "type": "string" } }, { - "name": "X-Workspace-Id", + "name": "X-Purchase-Session", "in": "header", "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", "schema": { "type": "string" } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerOrderCreateRequest" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -12678,7 +12534,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentLive" + "$ref": "#/components/schemas/CustomerOrderCreateResult" } }, "required": [ @@ -12718,6 +12574,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -12727,16 +12593,50 @@ } } } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } - }, - "patch": { - "operationId": "patchContentLivesId", + } + }, + "/customer/orders/{id}/payment": { + "post": { + "operationId": "postCustomerOrdersIdPayment", "tags": [ - "content" + "customer", + "orders" ], - "summary": "Update a live stream's schedule or audience", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same actions as the dashboard's scheduled-time picker and members-only switch. Send `scheduledAt` and/or `memberOnly`; absent fields keep their value. Never returns the stream key.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `scheduledAt` not in \"YYYY-MM-DDTHH:mm\" format.\n- 400 `INVALID_SCHEDULE`: `scheduledAt` is in the past or more than 2 years ahead.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was deleted or belongs to another workspace.\n- 409 `LIVE_NOT_IDLE`: `scheduledAt` sent for a stream that is on air or already ended.\n- 409 `MEMBERSHIP_PREREQ`: the workspace has no active membership plan yet; create one first (members-only content needs something to pay for). Only checked for `memberOnly: true`.", + "summary": "Open payment for a reservation (Bold or MercadoPago, depending on the event)", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). The payment rail is chosen on the SERVER: Bold-eligible events (legend plan + allowlist) return the SIGNED configuration of the embedded Bold Payment Button (`apiKey` + `renderMode: \"embedded\"` + `integritySignature`, …), which the landing page mounts with `new BoldCheckout({...})`; all others return `publicKey` + `amount` + `currency` + `reference` + `payerEmail` to mount the MercadoPago Payment Brick (`POST .../payment/card` to charge, `POST .../payment/pse` for PSE). The landing page tells the rails apart by the SHAPE of the response (`apiKey`/`renderMode` ⇒ Bold, `publicKey` ⇒ MercadoPago), never by a separate flag. The sale must belong to the session buyer (and, with a key, to the workspace pinned to it): anything else is 404. Responds 409 with code `PAYMENT_UNAVAILABLE` if the reservation expired, the sale is no longer pending, or (Bold only) the event has no legend plan or a payment attempt is already in flight with another gateway. `{id}` accepts the sale id or its `reference`. Limited to 10 opens per minute per buyer (429 with `Retry-After`).", "security": [ { "apiKey": [] @@ -12762,18 +12662,17 @@ "schema": { "type": "string" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentLiveUpdate" - } + }, + { + "name": "X-Purchase-Session", + "in": "header", + "required": false, + "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "OK", @@ -12783,7 +12682,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentLiveSettings" + "$ref": "#/components/schemas/CustomerOrderStartPayment" } }, "required": [ @@ -12793,16 +12692,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -12852,16 +12741,40 @@ } } } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } } } - }, - "delete": { - "operationId": "deleteContentLivesId", + } + }, + "/customer/orders/{id}/payment/card": { + "post": { + "operationId": "postCustomerOrdersIdPaymentCard", "tags": [ - "content" + "customer", + "orders" ], - "summary": "Delete a live stream", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a live stream in the dashboard.\n\nDESTRUCTIVE and irreversible: deletes the stream in Mux (its stream key stops working, an encoder on air is cut off) and soft-deletes it locally, so it disappears from the dashboard and the API listings. Cannot be restored through the API.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was already deleted or belongs to another workspace.", + "summary": "Charge with the MercadoPago Payment Brick token", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). Receives the token the Payment Brick produced on the landing page's domain and charges through the Orders API using the sale amount (never one sent by the client); `payer.email` travels in the body but is ignored — the payer is ALWAYS the sale's. `status` is `approved`, `pending` (normal, may require additional authentication from the bank) or `rejected` (business decline; the reason is in `message`) — all three are returned with 200. With `rejected`, `saleAlive` tells what happened to the purchase: `false` = it was cancelled and a new one must be started; `true` = this payment was declined but the purchase is still pending because another payment is in progress on it (do not start a new purchase: wait and check the order). Responds 409 with code `PAYMENT_UNAVAILABLE` if the reservation expired, the sale is no longer pending, a payment attempt is in flight with another gateway, the event only charges through Bold, or MercadoPago returned an error that cannot be classified as a decline. The sale must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. `{id}` accepts the sale id or its `reference`. Limited to 10 attempts per minute per buyer (429 with `Retry-After`).", "security": [ { "apiKey": [] @@ -12870,7 +12783,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -12888,8 +12800,27 @@ "schema": { "type": "string" } + }, + { + "name": "X-Purchase-Session", + "in": "header", + "required": false, + "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", + "schema": { + "type": "string" + } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerOrderMercadoPagoChargeRequest" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -12899,7 +12830,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentMediaDeleted" + "$ref": "#/components/schemas/CustomerOrderMercadoPagoChargeResult" } }, "required": [ @@ -12939,27 +12870,59 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } } } } } }, - "/content/playback-token": { + "/customer/orders/{id}/payment/pse": { "post": { - "operationId": "postContentPlaybackToken", + "operationId": "postCustomerOrdersIdPaymentPse", "tags": [ - "content" + "customer", + "orders" ], - "summary": "Signed token to play a video or a live stream", - "description": "Requires an enterprise service API key. `memberOnly` content additionally requires the `X-Customer-Session` header of a buyer with a current membership in the key's organization or, for a live stream tied to a show date, a CONFIRMED ticket for that date (otherwise 403 `MEMBERSHIP_REQUIRED`). Rate limited: 600 requests/min per key and 30/min per buyer (429 `RATE_LIMITED` with `Retry-After`). Content from another organization responds 404. Short-lived tokens: 30 minutes for live streams, 1 hour for videos.", + "summary": "Open a PSE payment through MercadoPago (redirect)", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). Creates a MercadoPago preference restricted to PSE and returns `redirectUrl` (`init_point`): the landing page must REDIRECT the browser there, not mount it in an iframe. The buyer picks their bank and confirms the transfer inside MercadoPago; on return, they land on `GET /api/mp/return` (our domain), which issues a 302 to the `returnUrl` sent in `POST /customer/orders` — the landing page must call `GET /customer/orders/{id}` for the authoritative status, never infer it from the return URL. The sale is confirmed by webhook when the bank settles the payment (asynchronous: it may take a while). Responds 409 with code `PAYMENT_UNAVAILABLE` if the reservation expired, the sale is no longer pending, a payment attempt is in flight with another gateway, or the event only charges through Bold. The sale must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. `{id}` accepts the sale id or its `reference`. Limited to 10 opens per minute per buyer (429 with `Retry-After`).", "security": [ { "apiKey": [] @@ -12969,6 +12932,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -12977,18 +12948,17 @@ "schema": { "type": "string" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentPlaybackTokenRequest" - } + }, + { + "name": "X-Purchase-Session", + "in": "header", + "required": false, + "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", + "schema": { + "type": "string" } } - }, + ], "responses": { "200": { "description": "OK", @@ -12998,7 +12968,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentPlaybackToken" + "$ref": "#/components/schemas/CustomerOrderMercadoPagoPse" } }, "required": [ @@ -13038,6 +13008,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -13068,28 +13048,19 @@ "$ref": "#/components/headers/RateLimitPolicy" } } - }, - "503": { - "description": "Service unavailable: an external dependency is down or initialization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } } } } }, - "/waitlist": { + "/customer/orders/{id}/release": { "post": { - "operationId": "postWaitlist", + "operationId": "postCustomerOrdersIdRelease", "tags": [ - "waitlist" + "customer", + "orders" ], - "summary": "Join the per-city waitlist of an enterprise landing", - "description": "Requires an enterprise service API key; the entry belongs to the key's organization. `X-Customer-Session` is optional: when present the entry is linked to that buyer. `contact` must be an email or a phone number (7-15 digits; only a leading `+`, spaces and dashes besides digits — parentheses, dots, letters or extensions respond 422). Phones are stored without spaces or dashes. Idempotent per (organization, city folded without accents/case, contact normalized — lowercased email, or the last 10 phone digits so `+57 300…` and `300…` are the same contact): 201 with `created: true` on the first call, 200 with `created: false` afterwards. Rate limited: 120 requests/min per key and 10/min per contact (429 `RATE_LIMITED` with `Retry-After`). Invalid JSON responds 400; an invalid body 422.", + "summary": "Release a reservation the buyer will not pay for", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). Abandons the PENDING sale and returns its inventory (and its seats) to stock, so the buyer can start over without waiting for the reservation to expire. It is the counterpart of `pending_sale_in_progress`: when `POST /customer/orders` rejects with that `reason`, the landing page can offer *continue paying* (`/payment`, idempotent) or *start over* (this route). It ONLY releases with evidence that nobody started the payment: if Bold reports any transaction, if a provider response is already stored, or if the payment goes through a rail we cannot query, it responds 409 with `details.reason` = `payment_in_flight` and the sale is left intact. If the gateway does not respond, 503 (`gateway_unreachable`): retry later. The sale must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. `{id}` accepts the sale id or its `reference`. Limited to 10 calls per minute per buyer.", "security": [ { "apiKey": [] @@ -13100,54 +13071,25 @@ ], "parameters": [ { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } }, { - "name": "X-Customer-Session", + "name": "X-Workspace-Id", "in": "header", "required": false, - "description": "Optional buyer session token; links the entry to that buyer.", + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", "schema": { "type": "string" } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WaitlistEntryCreate" - } - } - } - }, "responses": { "200": { - "description": "Already on this city's waitlist (`created: false`).", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/WaitlistEntryResult" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "201": { "description": "OK", "content": { "application/json": { @@ -13155,7 +13097,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/WaitlistEntryResult" + "$ref": "#/components/schemas/CustomerOrderRelease" } }, "required": [ @@ -13165,8 +13107,8 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -13175,8 +13117,8 @@ } } }, - "401": { - "description": "Missing or invalid credential.", + "403": { + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -13185,8 +13127,8 @@ } } }, - "403": { - "description": "Insufficient role or resource not accessible.", + "404": { + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -13195,8 +13137,8 @@ } } }, - "404": { - "description": "Resource does not exist or is out of scope.", + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", "content": { "application/json": { "schema": { @@ -13235,16 +13177,29 @@ "$ref": "#/components/headers/RateLimitPolicy" } } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } - }, + } + }, + "/customer/orders/{id}": { "get": { - "operationId": "getWaitlist", + "operationId": "getCustomerOrdersId", "tags": [ - "waitlist" + "customer", + "orders" ], - "summary": "List the waitlist entries of the workspace", - "description": "Export for staff (CLI/MCP). Contains personal data, so it requires ADMIN. Newest first, cursor pagination; `city` filters by the folded city (accents and case ignored).", + "summary": "Status of a headless purchase (and its tickets, once paid)", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). `{id}` accepts the `reference` (FT-…) or the sale id. If the sale is still PENDING and its payment goes through Bold, the authoritative payment status is re-read from Bold; between re-reads it responds with the internal status, which the webhook keeps up to date. `status` is `approved`, `pending` or `rejected`; `pending` is a NORMAL state (asynchronous payment methods take time) and the landing page must retry. `tickets` is only present when `status` is `approved`; each `ticketCode` is null until the QR gate opens (event starting in 72 hours or less), so a landing page shows its own countdown until then. The purchase must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. The route MAY rate-limit polling and respond 429: honor `Retry-After` and apply backoff. Polling every ~2 s fits comfortably, but do not treat any threshold as a guarantee.", "security": [ { "apiKey": [] @@ -13255,28 +13210,9 @@ ], "parameters": [ { - "name": "city", - "in": "query", - "required": false, - "description": "City name; accents and case are ignored", - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } @@ -13300,18 +13236,11 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WaitlistEntry" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/CustomerOrderStatus" } }, "required": [ - "data", - "page" + "data" ] } } @@ -13356,18 +13285,40 @@ } } } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } } } } }, - "/events/{id}/schedule": { + "/customer/purchase-sessions": { "post": { - "operationId": "postEventsIdSchedule", + "operationId": "postCustomerPurchaseSessions", "tags": [ - "events" + "customer", + "purchase-sessions" ], - "summary": "Schedule a draft event", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nSend exactly one of:\n- `publishAt`: the DRAFT publishes itself at that instant (checked every ~5 minutes). Must be in the future and before at least one of the event's dates. The response's `publishAt` echoes it.\n- `saleStartsAt`: publishes the DRAFT now and opens sales at that instant, setting `saleStartsAt` on every ticket type of the upcoming dates in the same transaction. Must be in the future and before the first upcoming date.\n\nErrors (`error.code`):\n- 409 `EVENT_NOT_DRAFT`: only drafts can be scheduled (also when it got published concurrently).\n- 422 `SCHEDULE_IN_PAST`, 422 `SCHEDULE_AFTER_EVENT_DATE`.\n- 409 `NO_FUTURE_DATE`, 409 `NO_TICKET_TYPES`, 422 `TICKET_TYPE_SALE_CLOSES_BEFORE` (`saleStartsAt` only).\n- Seated (seats.io) events: 409 `SEATSIO_INVALID`, 409 `SEAT_MAP_CATEGORIES_UNCOVERED` (`error.details.zones[]`), 503 `SEAT_MAP_UNVERIFIABLE` (retryable) — same as `POST /events/{id}/publish`.\n- 409 `IDENTITY_VERIFICATION_REQUIRED` (`saleStartsAt` on a paid event of an unverified workspace). Unlike `POST /events/{id}/publish`, the event is NOT queued: retry after the verification is approved.", + "summary": "Open the purchase session (only one live per buyer)", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, the event date must belong to the workspace pinned to it; otherwise 404). Opens THE buyer purchase session: there is ONLY one live per buyer across any tab or device, and the latest wins — the previous one becomes `superseded` (it can no longer create an order or start a new payment) and its seats.io hold is released, unless it backs a live sale. On seated event dates the server ISSUES the `holdToken` (mount the chart with `session: \"manual\"`) and sets `seatsDeadline`: each session gets up to 3 minutes and the budget is 3 attempts (9 CUMULATIVE minutes) per buyer and event date, summing all of their sessions within a 30-minute window, and it only runs while no order has been created. Once exhausted, it responds 429 with `error.code` `SEAT_BUDGET_EXHAUSTED`, `error.details.reason` `seat_budget_exhausted` and `error.details.retryAfterSeconds` (10-minute cooldown; also in the `Retry-After` header). If the SAME browser (`deviceKey`) reopens the SAME event date with its session alive, it gets that same session with 200 instead of 201. Only event dates on sale: published event and current event date (otherwise 404). Limits: 10 creations per minute per buyer, 30 per minute per IP when called without an API key, and a global ceiling per event date (429 `RATE_LIMITED`). Once the session is created, `POST /customer/orders` and the payment POSTs carry the `X-Purchase-Session: ` header; when the clock runs out, call `POST /customer/purchase-sessions/{id}/release`.", "security": [ { "apiKey": [] @@ -13377,14 +13328,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -13400,21 +13343,39 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/EventSchedule" + "$ref": "#/components/schemas/PurchaseSessionCreateRequest" } } } }, "responses": { "200": { - "description": "OK", + "description": "The SAME browser (`deviceKey`) reopened the SAME event date while its session was still alive: that session is returned (same `holdToken`, same clock) and nothing was created.", "content": { "application/json": { "schema": { "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Event" + "$ref": "#/components/schemas/PurchaseSessionCreated" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "201": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/PurchaseSessionCreated" } }, "required": [ @@ -13454,8 +13415,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -13464,14 +13425,25 @@ } } }, - "422": { - "description": "Request body/parameter validation failed.", + "429": { + "description": "Too many requests: rate limit exceeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } } }, "503": { @@ -13485,14 +13457,17 @@ } } } - }, - "delete": { - "operationId": "deleteEventsIdSchedule", + } + }, + "/customer/purchase-sessions/{id}": { + "get": { + "operationId": "getCustomerPurchaseSessionsId", "tags": [ - "events" + "customer", + "purchase-sessions" ], - "summary": "Cancel a scheduled publication", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nClears the pending scheduled publication (`publishAt` becomes null). The event keeps its status. Does not undo a `saleStartsAt` schedule: edit the ticket types' `saleStartsAt` instead.", + "summary": "Purchase session status", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL. Returns the status of one of THE buyer's purchase sessions: `live` (this tab can create the order), `superseded` (another tab or device replaced it: stop offering the map and the payment), `expired` (the map clock ran out or it was released) or `converted` (it already created its order: `orderId`). A session whose `seatsDeadline` has passed is reported as `expired` immediately. Designed to be polled every ~10 s. Another buyer's session is 404.", "security": [ { "apiKey": [] @@ -13529,7 +13504,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Event" + "$ref": "#/components/schemas/PurchaseSessionStatus" } }, "required": [ @@ -13582,14 +13557,15 @@ } } }, - "/ticket-types/{id}/presale-windows": { - "get": { - "operationId": "getTicketTypesIdPresaleWindows", + "/customer/purchase-sessions/{id}/release": { + "post": { + "operationId": "postCustomerPurchaseSessionsIdRelease", "tags": [ - "ticket-types" + "customer", + "purchase-sessions" ], - "summary": "List a ticket type's presale windows", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Release the seats of a purchase session", + "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL. Marks the session `expired` and releases in seats.io the seats held with its `holdToken`. Idempotent: repeating it changes nothing. It NEVER releases a token that backs a live sale (pending payment or confirmed) nor that of a `converted` session: those seats belong to the order. Call it when the map clock runs out. Another buyer's session is 404.", "security": [ { "apiKey": [] @@ -13626,10 +13602,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/PresaleWindow" - } + "$ref": "#/components/schemas/PurchaseSessionStatus" } }, "required": [ @@ -13678,16 +13651,39 @@ } } } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } } } - }, - "post": { - "operationId": "postTicketTypesIdPresaleWindows", + } + }, + "/content/videos": { + "get": { + "operationId": "getContentVideos", "tags": [ - "ticket-types" + "content" ], - "summary": "Create a presale window", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nActive members of `planId` can buy this ticket type between `presaleStartsAt` and `presaleEndsAt` (instants in UTC), optionally capped by `presaleCapacity`. One window per plan and ticket type.\n\nErrors (`error.code`): 422 `PLAN_NOT_ELIGIBLE` (the plan is not an active plan of the workspace that owns the event), 422 `PRESALE_WINDOW_INVERTED` (end not after start), 409 `DUPLICATE_PLAN` (that plan already has a window on this ticket type), 403 `EVENT_SCOPE_FORBIDDEN` (key restricted to other events).", + "summary": "List the organization's published videos", + "description": "Only published videos that have finished processing (READY) in the active workspace. Does not include the playback id: to play one, request a token from `POST /content/playback-token`.", "security": [ { "apiKey": [] @@ -13698,9 +13694,19 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -13715,18 +13721,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PresaleWindowCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -13734,11 +13730,18 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/PresaleWindow" + "type": "array", + "items": { + "$ref": "#/components/schemas/ContentVideo" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } @@ -13774,16 +13777,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -13797,14 +13790,14 @@ } } }, - "/presale-windows/{id}": { - "patch": { - "operationId": "patchPresaleWindowsId", + "/content/posts": { + "get": { + "operationId": "getContentPosts", "tags": [ - "ticket-types" + "content" ], - "summary": "Update a presale window", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nAbsent fields are left untouched; the start/end order is checked against the stored values.\n\nErrors (`error.code`): 422 `PLAN_NOT_ELIGIBLE` (the plan is not an active plan of the workspace that owns the event), 422 `PRESALE_WINDOW_INVERTED` (end not after start), 409 `DUPLICATE_PLAN` (that plan already has a window on this ticket type), 403 `EVENT_SCOPE_FORBIDDEN` (key restricted to other events).", + "summary": "List the organization's community feed", + "description": "Posts from the active workspace, newest first, excluding deleted posts and posts scheduled for the future. A post with `locked: true` arrives redacted (`content`, `imageUrl`, `videoId`, `eventId` and `link` set to null, `commentsCount` set to 0): it is members-only content and the key does not represent a buyer with a current membership. Does not include `likes_count` (only visible to the workspace owner) or the post's internal author.", "security": [ { "apiKey": [] @@ -13815,9 +13808,19 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -13832,16 +13835,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/PresaleWindowUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -13851,11 +13844,18 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/PresaleWindow" + "type": "array", + "items": { + "$ref": "#/components/schemas/ContentPost" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } @@ -13891,16 +13891,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -13913,13 +13903,13 @@ } } }, - "delete": { - "operationId": "deletePresaleWindowsId", + "post": { + "operationId": "postContentPosts", "tags": [ - "ticket-types" + "content" ], - "summary": "Delete a presale window", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE: permanently deletes the window; members lose that presale access immediately. Re-creating it yields a new id.", + "summary": "Publish community content (including articles)", + "description": "Creates a community post. `type=ARTICLE` requires `title` and `body` (Markdown) and builds a slug unique per organization (manual via `slug`, or derived from `title` if omitted); `type=TEXT`/`IMAGE` require `content` or `imageUrl`, same as the dashboard composer. Unlike the dashboard, this path does NOT resolve the link's Open Graph snapshot (`link` is always null in the response). Minimum role ADMIN, like every other `POST` in `/api/v1`. If the workspace has the `community_v2` flag enabled, publishing enqueues a notification to members in the same transaction; with a future `publishedAt`, the notification goes out when the post is published. The response does not change.", "security": [ { "apiKey": [] @@ -13928,16 +13918,7 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -13948,13 +13929,41 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentPostCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/ContentPost" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" } } } @@ -13989,6 +13998,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -14002,14 +14021,14 @@ } } }, - "/reports/live-attendance": { + "/content/lives": { "get": { - "operationId": "getReportsLiveAttendance", + "operationId": "getContentLives", "tags": [ - "reports" + "content" ], - "summary": "Events happening right now, with check-in progress", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the \"Live\" cards of the dashboard summary (section `inicio`).\n\nReturns the event dates whose live window contains the current instant (doors open, or start, until `ends_at`; 6 hours after the start when there is no end), for PUBLISHED/SOLD_OUT events visible to the workspace (own and collaborative) plus shows of other organizers hosted in one of the workspace's venues (occupancy only). Sorted by `sold` descending. `sold`/`validated` count tickets (QR) of CONFIRMED sales; `validatedPct` is 0-100. Meant for polling (the dashboard polls every 20 s).\n\n`scope` narrows like the dashboard selector: `all` (default), `own` (only the workspace's own shows; hosted shows are excluded), `partner:` (shows shared with that partner). An event-scoped API key only sees its events.\n\nErrors (`error.code`): 400 `BAD_REQUEST` (invalid `scope`).", + "summary": "List the organization's live streams", + "description": "Live streams from the active workspace, newest first. `status: ACTIVE` is the one on air. Does not include the RTMP key or the playback ids.", "security": [ { "apiKey": [] @@ -14020,13 +14039,21 @@ ], "parameters": [ { - "name": "scope", + "name": "limit", "in": "query", "required": false, - "description": "all (default) | own | partner:", + "description": "1-100, default 20", "schema": { - "type": "string", - "default": "all" + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "schema": { + "type": "string" } }, { @@ -14050,27 +14077,21 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/LiveAttendance" + "$ref": "#/components/schemas/ContentLive" } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -14112,17 +14133,14 @@ } } } - } - }, - "/event-dates/{id}/access-close": { - "get": { - "operationId": "getEventDatesIdAccessClose", + }, + "post": { + "operationId": "postContentLives", "tags": [ - "events", - "tickets" + "content" ], - "summary": "Live entry count and access-close status of an event date", - "description": "Minimum role: `STAFF` (any role that validates tickets), with the `validar` section when the access is scoped. Active workspace via the `X-Workspace-Id` header. Same gate and same count as the access-close screen of the dashboard: a door validator limited to some events only sees those.\n\nOnly event dates of the workspace's OWN events that admit an access-close record (not cancelled, PUBLISHED/SOLD_OUT/COMPLETED event, no external ticketing). `live.issued` counts tickets of CONFIRMED sales (courtesies included); `live.checkins` is what a signature would freeze right now. Once closed, `closedCheckins` is the frozen number. Date fields are labels already formatted in the event date's time zone.\n\nErrors (`error.code`): 403 `ACCESS_CLOSE_FORBIDDEN` (role/section/validator scope), 404 (not found, another workspace, collaborative/hosted event or outside the key's `event_scope`).", + "summary": "Create a live stream", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New live stream\" in the dashboard: creates the stream in Mux and returns the RTMPS server and stream key to configure OBS or any encoder.\n\nSECURITY: `streamKey` is a secret that grants broadcasting rights on this stream in the organization's name. It is returned ONLY here and by `POST /content/lives/{id}/reset-key`, never by `GET /content/lives`, `GET /content/lives/{id}` or `PATCH`. Store it like a password; if it leaks, rotate it with reset-key.\n\n`memberOnly` is forced to false when the workspace has no active membership plan (nobody to restrict it to). With `eventDateId` and no `scheduledAt`, the stream inherits the show date's start time.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, or `scheduledAt` not in \"YYYY-MM-DDTHH:mm\" format.\n- 400 `INVALID_SCHEDULE`: `scheduledAt` is in the past or more than 2 years ahead.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include streaming.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: `eventDateId` does not exist or is not an event of this workspace (as owner or linked artist).\n- 409 `EVENT_DATE_HAS_LIVE`: that show date already has a live stream.\n- 502 `MUX_ERROR`: Mux rejected the request or is not configured; nothing was created.", "security": [ { "apiKey": [] @@ -14132,14 +14150,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -14150,8 +14160,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentLiveCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -14159,7 +14179,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/AccessCloseStatus" + "$ref": "#/components/schemas/ContentLiveCreated" } }, "required": [ @@ -14169,6 +14189,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -14199,6 +14229,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -14208,17 +14248,28 @@ } } } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } - }, - "post": { - "operationId": "postEventDatesIdAccessClose", + } + }, + "/content/lives/{id}": { + "get": { + "operationId": "getContentLivesId", "tags": [ - "events", - "tickets" + "content" ], - "summary": "Sign the access-close record of an event date (irreversible)", - "description": "Minimum role: `ADMIN` (stricter than the dashboard, where door staff can also sign). Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE and IRREVERSIBLE: freezes the number of check-ins of the event date as its access-close record, signed by the API key owner, and emails the record to the workspace. It does not stop the scanner. There is no endpoint to undo it. Requires the body `{\"confirm\": true}` (422 without it). Only one signature per date: concurrent calls are resolved atomically and the loser gets 409.\n\nSigning opens 2 hours after the date starts.\n\nErrors (`error.code`):\n- 403 `ACCESS_CLOSE_FORBIDDEN` (section/validator scope), 403 `EVENT_SCOPE_FORBIDDEN` (outside the key's `event_scope`).\n- 404: not found, another workspace, or a date that does not admit a record (cancelled, draft event, external ticketing, collaborative/hosted event).\n- 409 `ACCESS_CLOSE_NOT_SIGNABLE_YET`: `error.details.signableFrom` (ISO 8601).\n- 409 `ACCESS_ALREADY_CLOSED`: someone signed first or the automatic close ran; `error.details` has `closedAt`, `closedByName` (null if automatic) and `automatic`. Not retryable.", + "summary": "Live stream status", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -14227,7 +14278,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -14247,16 +14297,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AccessCloseSignRequest" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -14266,7 +14306,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/AccessCloseSigned" + "$ref": "#/components/schemas/ContentLive" } }, "required": [ @@ -14306,16 +14346,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -14327,16 +14357,14 @@ } } } - } - }, - "/payment-intents": { - "get": { - "operationId": "getPaymentIntents", + }, + "patch": { + "operationId": "patchContentLivesId", "tags": [ - "sales" + "content" ], - "summary": "Purchase intents of an event (checkout funnel and abandoned journeys)", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the dashboard's Sales → Intents screen.\n\nFolds the checkout funnel log of ONE event (own or collaborative) into one journey per visitor (the buyer account when known, otherwise the device), with how far it got (`stage`) and how it ended (`outcome`: `NO_SALE`, `REJECTED` with `reason`, or the sale status). `funnel` counts ALL journeys of the filter, not only the page. Journeys are sorted by last activity, newest first.\n\nPagination: pass `nextCursor` back as `cursor` (opaque); `null` means no more pages. `eventDate` must belong to the event, otherwise all dates are used (`selectedDateId` echoes the one applied). `onlyAbandoned=true` keeps journeys that picked seats and did not pay (excludes sales still PENDING).\n\nPersonal data: `personName`/`personEmail` come from the buyer account or what was typed at checkout — the same data `GET /sales` returns. Device identifiers never leave the server (`threadId` is a hash).\n\nErrors (`error.code`): 400 `BAD_REQUEST` (missing `event`, invalid `limit`/`onlyAbandoned`), 404 (event not found, not visible, or outside the key's `event_scope`).", + "summary": "Update a live stream's schedule or audience", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same actions as the dashboard's scheduled-time picker, members-only switch and replay switch. Send `scheduledAt`, `memberOnly` and/or `replayEnabled`; absent fields keep their value. Never returns the stream key.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `scheduledAt` not in \"YYYY-MM-DDTHH:mm\" format.\n- 400 `INVALID_SCHEDULE`: `scheduledAt` is in the past or more than 2 years ahead.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was deleted or belongs to another workspace.\n- 409 `LIVE_NOT_IDLE`: `scheduledAt` sent for a stream that is on air or already ended.\n- 409 `MEMBERSHIP_PREREQ`: the workspace has no active membership plan yet; create one first (members-only content needs something to pay for). Only checked for `memberOnly: true`.", "security": [ { "apiKey": [] @@ -14347,47 +14375,9 @@ ], "parameters": [ { - "name": "event", - "in": "query", + "name": "id", + "in": "path", "required": true, - "description": "event id", - "schema": { - "type": "string" - } - }, - { - "name": "eventDate", - "in": "query", - "required": false, - "description": "event date id (must belong to the event)", - "schema": { - "type": "string" - } - }, - { - "name": "onlyAbandoned", - "in": "query", - "required": false, - "description": "true = only journeys that picked seats and did not pay", - "schema": { - "type": "boolean" - } - }, - { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 100", - "schema": { - "type": "integer", - "default": 100 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, - "description": "`nextCursor` of the previous page", "schema": { "type": "string" } @@ -14402,6 +14392,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentLiveUpdate" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -14411,7 +14411,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/PaymentIntentsPage" + "$ref": "#/components/schemas/ContentLiveSettings" } }, "required": [ @@ -14461,6 +14461,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -14472,16 +14482,14 @@ } } } - } - }, - "/sales/{id}/abandon": { - "post": { - "operationId": "postSalesIdAbandon", + }, + "delete": { + "operationId": "deleteContentLivesId", "tags": [ - "sales" + "content" ], - "summary": "Mark a pending sale as abandoned (releases its stock)", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Mark as abandoned\" in the dashboard.\n\nDESTRUCTIVE: a PENDING sale whose payment never started moves to ABANDONED (terminal) and its stock reservations are deleted, so the inventory goes back on sale immediately. It does not touch seats.io holds (same as the dashboard). Use `POST /sales/{id}/cancel` for confirmed sales.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: an item of the sale is outside the key's `event_scope`.\n- 409 `SALE_NOT_PENDING`: only PENDING sales (also when it is already ABANDONED).\n- 409 `PAYMENT_IN_PROGRESS`: a payment was started (`payment_ref` set) and may still be confirmed by the gateway; wait for reconciliation.\n- 409 `SALE_STATE_CHANGED`: the sale changed between the read and the write (e.g. a payment started); re-read it.", + "summary": "Delete a live stream", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a live stream in the dashboard.\n\nDESTRUCTIVE and irreversible: deletes the stream in Mux (its stream key stops working, an encoder on air is cut off) and soft-deletes it locally, so it disappears from the dashboard and the API listings. Cannot be restored through the API.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was already deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -14519,7 +14527,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Sale" + "$ref": "#/components/schemas/ContentMediaDeleted" } }, "required": [ @@ -14559,16 +14567,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -14582,14 +14580,14 @@ } } }, - "/content/posts/{id}": { - "patch": { - "operationId": "patchContentPostsId", + "/content/playback-token": { + "post": { + "operationId": "postContentPlaybackToken", "tags": [ "content" ], - "summary": "Update a community post or article", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a post or an article in the dashboard.\n\nPartial update: absent fields keep their stored value; `null` clears a nullable field. The stored post decides the shape: an ARTICLE accepts `title`, `subtitle`, `body`, `slug`, `imageUrl` (cover), `locked`, `eventId` and `publishedAt`; a TEXT/IMAGE/VIDEO post accepts `type` (TEXT/IMAGE), `content`, `imageUrl`, `locked`, `eventId`, `channelId` and `publishedAt`. Unlike `POST /content/posts`, changing the text of a short post re-resolves its link preview, like the dashboard. Member posts cannot be edited (404); moderate them under `/content/moderation/member-posts`. The response is redacted like `GET /content/posts` when the post is `locked`.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a field that does not apply to the post's type, or the result would be empty (a short post needs `content` or `imageUrl`).\n- 404 `NOT_FOUND`: the post, the linked `eventId` or the `channelId` does not exist in this workspace.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: `channelId` was sent but channels are not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 409 `SLUG_CONFLICT`: another article of the organization already uses that slug.", + "summary": "Signed token to play a video or a live stream", + "description": "Requires an enterprise service API key. `memberOnly` content additionally requires the `X-Customer-Session` header of a buyer with a current membership in the key's organization or, for a live stream tied to a show date, a CONFIRMED ticket for that date (otherwise 403 `MEMBERSHIP_REQUIRED`). Rate limited: 600 requests/min per key and 30/min per buyer (429 `RATE_LIMITED` with `Retry-After`). Content from another organization responds 404. A live stream that is no longer on air plays its recording only while its replay is open (`replayEnabled` and within 24 hours of the end, see `replayUntil` on `GET /content/lives`); otherwise 404. Short-lived tokens: 30 minutes for live streams (cut to the end of the replay window for a replay), 1 hour for videos.", "security": [ { "apiKey": [] @@ -14599,14 +14597,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -14622,7 +14612,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ContentPostUpdate" + "$ref": "#/components/schemas/ContentPlaybackTokenRequest" } } } @@ -14636,7 +14626,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentPost" + "$ref": "#/components/schemas/ContentPlaybackToken" } }, "required": [ @@ -14646,8 +14636,8 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -14656,8 +14646,8 @@ } } }, - "401": { - "description": "Missing or invalid credential.", + "403": { + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -14666,8 +14656,8 @@ } } }, - "403": { - "description": "Insufficient role or resource not accessible.", + "404": { + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -14676,8 +14666,8 @@ } } }, - "404": { - "description": "Resource does not exist or is out of scope.", + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -14686,18 +14676,29 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "429": { + "description": "Too many requests: rate limit exceeded.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } } }, - "422": { - "description": "Request body/parameter validation failed.", + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", "content": { "application/json": { "schema": { @@ -14707,14 +14708,16 @@ } } } - }, - "delete": { - "operationId": "deleteContentPostsId", + } + }, + "/waitlist": { + "post": { + "operationId": "postWaitlist", "tags": [ - "content" + "waitlist" ], - "summary": "Delete a community post", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a post in the dashboard.\n\nDESTRUCTIVE: soft-deletes the post (organization post, article or member post), unpins it and redacts the member notifications that pointed to it. It disappears from the feed immediately and cannot be restored through the API. To take down a member post with a notice to its author, prefer `POST /content/moderation/member-posts/{id}/remove`.\n\nErrors: 404 `NOT_FOUND` (does not exist, already deleted or belongs to another workspace); 403 `EVENT_SCOPE_FORBIDDEN`.", + "summary": "Join the per-city waitlist of an enterprise landing", + "description": "Requires an enterprise service API key; the entry belongs to the key's organization. `X-Customer-Session` is optional: when present the entry is linked to that buyer. `contact` must be an email or a phone number (7-15 digits; only a leading `+`, spaces and dashes besides digits — parentheses, dots, letters or extensions respond 422). Phones are stored without spaces or dashes. Idempotent per (organization, city folded without accents/case, contact normalized — lowercased email, or the last 10 phone digits so `+57 300…` and `300…` are the same contact): 201 with `created: true` on the first call, 200 with `created: false` afterwards. Rate limited: 120 requests/min per key and 10/min per contact (429 `RATE_LIMITED` with `Retry-After`). Invalid JSON responds 400; an invalid body 422.", "security": [ { "apiKey": [] @@ -14723,33 +14726,79 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", "schema": { "type": "string" } }, { - "name": "X-Workspace-Id", + "name": "X-Customer-Session", "in": "header", "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "description": "Optional buyer session token; links the entry to that buyer.", "schema": { "type": "string" } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WaitlistEntryCreate" + } + } + } + }, "responses": { "200": { + "description": "Already on this city's waitlist (`created: false`).", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/WaitlistEntryResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "201": { "description": "OK", "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/WaitlistEntryResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" } } } @@ -14793,18 +14842,37 @@ } } } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } } } - } - }, - "/content/posts/{id}/pin": { - "put": { - "operationId": "putContentPostsIdPin", + }, + "get": { + "operationId": "getWaitlist", "tags": [ - "content" + "waitlist" ], - "summary": "Pin or unpin a community post", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Pin\" in the dashboard.\n\nAt most one pinned post per workspace: `pinned: true` unpins the previous one in the same transaction. Only a published post can be pinned; unpinning works on any post. Idempotent.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 404 `NOT_FOUND`: the post does not exist, is deleted, is not published (when pinning) or belongs to another workspace.", + "summary": "List the waitlist entries of the workspace", + "description": "Export for staff (CLI/MCP). Contains personal data, so it requires ADMIN. Newest first, cursor pagination; `city` filters by the folded city (accents and case ignored).", "security": [ { "apiKey": [] @@ -14815,9 +14883,28 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "city", + "in": "query", + "required": false, + "description": "City name; accents and case are ignored", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -14832,16 +14919,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentPostPin" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -14851,11 +14928,18 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentPostPinned" + "type": "array", + "items": { + "$ref": "#/components/schemas/WaitlistEntry" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } @@ -14904,14 +14988,14 @@ } } }, - "/content/comments/{id}": { - "delete": { - "operationId": "deleteContentCommentsId", + "/courtesy-requests": { + "post": { + "operationId": "postCourtesyRequests", "tags": [ - "content" + "courtesy-requests" ], - "summary": "Delete a community comment (moderation)", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a comment from the dashboard.\n\nDESTRUCTIVE: soft-deletes the comment and, if it is a top-level comment, all its live replies; the post's comment count is recomputed. Cannot be undone through the API. To hide it reversibly use `POST /content/moderation/comments/{id}/hide`.\n\nErrors: 404 `NOT_FOUND` (does not exist, already deleted or belongs to another workspace); 403 `EVENT_SCOPE_FORBIDDEN`.", + "summary": "Request a courtesy invitation from an enterprise landing", + "description": "Requires an enterprise service API key; the request belongs to the key's organization (never one from the body). `fullName` is 2-120 characters; emails are trimmed and lowercased. `companion` is optional and, when present, needs only its own `fullName` (422 otherwise); any companion `email` is ignored. One request per (organization, email): the first one wins. 201 on the first call; a resubmit with the same email responds 409 `CONFLICT` and leaves the existing request untouched. Rate limited: 120 requests/min per key and 10/min per email (429 `RATE_LIMITED` with `Retry-After`). Invalid JSON responds 400; an invalid body 422. The list and CSV export live in the dashboard (/dashboard/cortesias), not in this API.", "security": [ { "apiKey": [] @@ -14920,16 +15004,7 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -14940,8 +15015,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CourtesyRequestCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -14949,7 +15034,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentCommentDeleted" + "$ref": "#/components/schemas/CourtesyRequestResult" } }, "required": [ @@ -14959,6 +15044,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -14989,6 +15084,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -14998,18 +15103,39 @@ } } } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } } } } }, - "/content/channels": { - "get": { - "operationId": "getContentChannels", + "/events/{id}/schedule": { + "post": { + "operationId": "postEventsIdSchedule", "tags": [ - "content" + "events" ], - "summary": "List the community channels", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Channels screen: active channels in display order (archived ones are omitted). Like the dashboard, the default Announcements and General channels are created on first read if the workspace has none.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Schedule a draft event", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nSend exactly one of:\n- `publishAt`: the DRAFT publishes itself at that instant (checked every ~5 minutes). Must be in the future and before at least one of the event's dates. The response's `publishAt` echoes it.\n- `saleStartsAt`: publishes the DRAFT now and opens sales at that instant, setting `saleStartsAt` on every ticket type of the upcoming dates in the same transaction. Must be in the future and before the first upcoming date.\n\nErrors (`error.code`):\n- 409 `EVENT_NOT_DRAFT`: only drafts can be scheduled (also when it got published concurrently).\n- 422 `SCHEDULE_IN_PAST`, 422 `SCHEDULE_AFTER_EVENT_DATE`.\n- 409 `NO_FUTURE_DATE`, 409 `NO_TICKET_TYPES`, 422 `TICKET_TYPE_SALE_CLOSES_BEFORE` (`saleStartsAt` only).\n- Seated (seats.io) events: 409 `SEATSIO_INVALID`, 409 `SEAT_MAP_CATEGORIES_UNCOVERED` (`error.details.zones[]`), 503 `SEAT_MAP_UNVERIFIABLE` (retryable) — same as `POST /events/{id}/publish`.\n- 409 `IDENTITY_VERIFICATION_REQUIRED` (`saleStartsAt` on a paid event of an unverified workspace). Unlike `POST /events/{id}/publish`, the event is NOT queued: retry after the verification is approved.", "security": [ { "apiKey": [] @@ -15019,6 +15145,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -15029,6 +15163,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventSchedule" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -15038,10 +15182,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/CommunityChannel" - } + "$ref": "#/components/schemas/Event" } }, "required": [ @@ -15081,6 +15222,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -15090,16 +15241,26 @@ } } } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } }, - "post": { - "operationId": "postContentChannels", + "delete": { + "operationId": "deleteEventsIdSchedule", "tags": [ - "content" + "events" ], - "summary": "Create a community channel", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New channel\" in the dashboard: a CITY or CUSTOM channel, appended at the end. The slug is derived from the name, unique in the workspace, and never changes afterwards.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 400 `BAD_REQUEST`: `city` missing on a CITY channel.\n- 409 `CHANNEL_LIMIT_REACHED`: the workspace already has the maximum of active channels; archive one first.", + "summary": "Cancel a scheduled publication", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nClears the pending scheduled publication (`publishAt` becomes null). The event keeps its status. Does not undo a `saleStartsAt` schedule: edit the ticket types' `saleStartsAt` instead.", "security": [ { "apiKey": [] @@ -15109,6 +15270,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -15119,18 +15288,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CommunityChannelCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -15138,7 +15297,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityChannel" + "$ref": "#/components/schemas/Event" } }, "required": [ @@ -15148,16 +15307,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -15188,16 +15337,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -15211,14 +15350,14 @@ } } }, - "/content/channels/{id}": { - "patch": { - "operationId": "patchContentChannelsId", + "/ticket-types/{id}/presale-windows": { + "get": { + "operationId": "getTicketTypesIdPresaleWindows", "tags": [ - "content" + "ticket-types" ], - "summary": "Update a community channel", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a channel in the dashboard. Partial: absent fields keep their value; `null` clears `description`/`city`. The slug does not change on rename. Archived channels cannot be edited.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 400 `ANNOUNCEMENTS_STAFF_ONLY`: Announcements cannot be opened to members (`whoCanPost` must stay STAFF).\n- 400 `CITY_REQUIRED`: a CITY channel needs a city.\n- 404 `NOT_FOUND`: the channel does not exist, is archived or belongs to another workspace.", + "summary": "List a ticket type's presale windows", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header.", "security": [ { "apiKey": [] @@ -15246,16 +15385,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CommunityChannelUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -15265,7 +15394,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityChannel" + "type": "array", + "items": { + "$ref": "#/components/schemas/PresaleWindow" + } } }, "required": [ @@ -15275,16 +15407,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -15326,16 +15448,14 @@ } } } - } - }, - "/content/channels/order": { - "put": { - "operationId": "putContentChannelsOrder", + }, + "post": { + "operationId": "postTicketTypesIdPresaleWindows", "tags": [ - "content" + "ticket-types" ], - "summary": "Reorder the community channels", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as dragging channels in the dashboard. Send EVERY active channel id (from `GET /content/channels`) in the new order, Announcements first; a partial list is rejected, not applied halfway.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 400 `BAD_REQUEST`: repeated ids.\n- 400 `ANNOUNCEMENTS_FIRST`: Announcements must stay first.\n- 409 `CHANNEL_LIST_CHANGED`: the ids are not exactly the active channels (one was created/archived, or an id from another workspace); re-read and retry.", + "summary": "Create a presale window", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nActive members of `planId` can buy this ticket type between `presaleStartsAt` and `presaleEndsAt` (instants in UTC), optionally capped by `presaleCapacity`. One window per plan and ticket type.\n\nErrors (`error.code`): 422 `PLAN_NOT_ELIGIBLE` (the plan is not an active plan of the workspace that owns the event), 422 `PRESALE_WINDOW_INVERTED` (end not after start), 409 `DUPLICATE_PLAN` (that plan already has a window on this ticket type), 403 `EVENT_SCOPE_FORBIDDEN` (key restricted to other events).", "security": [ { "apiKey": [] @@ -15345,6 +15465,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -15360,13 +15488,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommunityChannelOrder" + "$ref": "#/components/schemas/PresaleWindowCreate" } } } }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -15374,7 +15502,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityChannelOrder" + "$ref": "#/components/schemas/PresaleWindow" } }, "required": [ @@ -15384,16 +15512,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -15447,14 +15565,14 @@ } } }, - "/content/channels/{id}/archive": { - "post": { - "operationId": "postContentChannelsIdArchive", + "/presale-windows/{id}": { + "patch": { + "operationId": "patchPresaleWindowsId", "tags": [ - "content" + "ticket-types" ], - "summary": "Archive a community channel", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Archive\" in the dashboard.\n\nDESTRUCTIVE: the channel tab disappears for members and staff can no longer post to it; its posts remain visible under \"All\". There is no unarchive endpoint, and its slug stays taken.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 404 `NOT_FOUND`: the channel does not exist, is already archived or belongs to another workspace.\n- 409 `ANNOUNCEMENTS_NOT_ARCHIVABLE`: Announcements cannot be archived.", + "summary": "Update a presale window", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nAbsent fields are left untouched; the start/end order is checked against the stored values.\n\nErrors (`error.code`): 422 `PLAN_NOT_ELIGIBLE` (the plan is not an active plan of the workspace that owns the event), 422 `PRESALE_WINDOW_INVERTED` (end not after start), 409 `DUPLICATE_PLAN` (that plan already has a window on this ticket type), 403 `EVENT_SCOPE_FORBIDDEN` (key restricted to other events).", "security": [ { "apiKey": [] @@ -15463,7 +15581,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -15483,13 +15600,31 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PresaleWindowUpdate" + } + } + } + }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/PresaleWindow" + } + }, + "required": [ + "data" + ] } } } @@ -15545,16 +15680,14 @@ } } } - } - }, - "/content/moderation/queue": { - "get": { - "operationId": "getContentModerationQueue", + }, + "delete": { + "operationId": "deletePresaleWindowsId", "tags": [ - "content" + "ticket-types" ], - "summary": "List reported community comments (moderation queue)", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same queue as the dashboard's Moderation screen: comments with open reports, most reported first, including auto-hidden ones and comments deleted with reports still open (deleting does not dodge a ban). 50 per page; `page` is 0-based (an empty array means no more pages).\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Delete a presale window", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE: permanently deletes the window; members lose that presale access immediately. Re-creating it yields a new id.", "security": [ { "apiKey": [] @@ -15563,15 +15696,14 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { - "name": "page", - "in": "query", - "required": false, - "description": "0-based page", + "name": "id", + "in": "path", + "required": true, "schema": { - "type": "integer", - "default": 0 + "type": "string" } }, { @@ -15590,18 +15722,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ModerationQueueItem" - } - } - }, - "required": [ - "data" - ] + "type": "object" } } } @@ -15649,14 +15770,14 @@ } } }, - "/content/moderation/bans": { + "/reports/live-attendance": { "get": { - "operationId": "getContentModerationBans", + "operationId": "getReportsLiveAttendance", "tags": [ - "content" + "reports" ], - "summary": "List members banned from the community", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Moderation screen: the latest 200 bans, newest first. Lift one with `DELETE /content/members/{customerId}/ban`.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Events happening right now, with check-in progress", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the \"Live\" cards of the dashboard summary (section `inicio`).\n\nReturns the event dates whose live window contains the current instant (doors open, or start, until `ends_at`; 6 hours after the start when there is no end), for PUBLISHED/SOLD_OUT events visible to the workspace (own and collaborative) plus shows of other organizers hosted in one of the workspace's venues (occupancy only). Sorted by `sold` descending. `sold`/`validated` count tickets (QR) of CONFIRMED sales; `validatedPct` is 0-100. Meant for polling (the dashboard polls every 20 s).\n\n`scope` narrows like the dashboard selector: `all` (default), `own` (only the workspace's own shows; hosted shows are excluded), `partner:` (shows shared with that partner). An event-scoped API key only sees its events.\n\nErrors (`error.code`): 400 `BAD_REQUEST` (invalid `scope`).", "security": [ { "apiKey": [] @@ -15666,6 +15787,16 @@ } ], "parameters": [ + { + "name": "scope", + "in": "query", + "required": false, + "description": "all (default) | own | partner:", + "schema": { + "type": "string", + "default": "all" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -15687,7 +15818,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/CommunityBan" + "$ref": "#/components/schemas/LiveAttendance" } } }, @@ -15698,6 +15829,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -15741,14 +15882,15 @@ } } }, - "/content/moderation/member-posts": { + "/event-dates/{id}/access-close": { "get": { - "operationId": "getContentModerationMemberPosts", + "operationId": "getEventDatesIdAccessClose", "tags": [ - "content" + "events", + "tickets" ], - "summary": "List member posts awaiting review (or recently published)", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same lists as the dashboard's Moderation → Posts view. `status=PENDING_REVIEW` (default): posts waiting for approval, oldest first, 30 per 0-based `page`; their `imageUrl` is a short-lived signed URL. `status=PUBLISHED`: the latest 30 published member posts (no paging), to remove one. Approving needs the `updatedAt` read here.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `MEMBER_POSTS_UNAVAILABLE`: member posts are not enabled for this workspace.", + "summary": "Live entry count and access-close status of an event date", + "description": "Minimum role: `STAFF` (any role that validates tickets), with the `validar` section when the access is scoped. Active workspace via the `X-Workspace-Id` header. Same gate and same count as the access-close screen of the dashboard: a door validator limited to some events only sees those.\n\nOnly event dates of the workspace's OWN events that admit an access-close record (not cancelled, PUBLISHED/SOLD_OUT/COMPLETED event, no external ticketing). `live.issued` counts tickets of CONFIRMED sales (courtesies included); `live.checkins` is what a signature would freeze right now. Once closed, `closedCheckins` is the frozen number. Date fields are labels already formatted in the event date's time zone.\n\nErrors (`error.code`): 403 `ACCESS_CLOSE_FORBIDDEN` (role/section/validator scope), 404 (not found, another workspace, collaborative/hosted event or outside the key's `event_scope`).", "security": [ { "apiKey": [] @@ -15759,27 +15901,11 @@ ], "parameters": [ { - "name": "status", - "in": "query", - "required": false, - "description": "PENDING_REVIEW (default) or PUBLISHED", - "schema": { - "type": "string", - "enum": [ - "PENDING_REVIEW", - "PUBLISHED" - ], - "default": "PENDING_REVIEW" - } - }, - { - "name": "page", - "in": "query", - "required": false, - "description": "0-based page (PENDING_REVIEW only)", + "name": "id", + "in": "path", + "required": true, "schema": { - "type": "integer", - "default": 0 + "type": "string" } }, { @@ -15801,10 +15927,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MemberPostQueueItem" - } + "$ref": "#/components/schemas/AccessCloseStatus" } }, "required": [ @@ -15855,16 +15978,15 @@ } } } - } - }, - "/content/moderation/comments/{id}/hide": { + }, "post": { - "operationId": "postContentModerationCommentsIdHide", + "operationId": "postEventDatesIdAccessClose", "tags": [ - "content" + "events", + "tickets" ], - "summary": "Hide a community comment", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Hide\" in the dashboard's moderation queue.\n\nHides the comment (and its replies from the count) and resolves its open reports as HIDDEN. Reversible with `/unhide`. Idempotent: hiding a hidden comment returns `changed: false`.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist, is deleted or belongs to another workspace.", + "summary": "Sign the access-close record of an event date (irreversible)", + "description": "Minimum role: `ADMIN` (stricter than the dashboard, where door staff can also sign). Active workspace via the `X-Workspace-Id` header.\n\nDESTRUCTIVE and IRREVERSIBLE: freezes the number of check-ins of the event date as its access-close record, signed by the API key owner, and emails the record to the workspace. It does not stop the scanner. There is no endpoint to undo it. Requires the body `{\"confirm\": true}` (422 without it). Only one signature per date: concurrent calls are resolved atomically and the loser gets 409.\n\nSigning opens 2 hours after the date starts.\n\nErrors (`error.code`):\n- 403 `ACCESS_CLOSE_FORBIDDEN` (section/validator scope), 403 `EVENT_SCOPE_FORBIDDEN` (outside the key's `event_scope`).\n- 404: not found, another workspace, or a date that does not admit a record (cancelled, draft event, external ticketing, collaborative/hosted event).\n- 409 `ACCESS_CLOSE_NOT_SIGNABLE_YET`: `error.details.signableFrom` (ISO 8601).\n- 409 `ACCESS_ALREADY_CLOSED`: someone signed first or the automatic close ran; `error.details` has `closedAt`, `closedByName` (null if automatic) and `automatic`. Not retryable.", "security": [ { "apiKey": [] @@ -15873,6 +15995,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -15892,6 +16015,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccessCloseSignRequest" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -15901,7 +16034,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommentModerated" + "$ref": "#/components/schemas/AccessCloseSigned" } }, "required": [ @@ -15941,6 +16074,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -15954,14 +16097,14 @@ } } }, - "/content/moderation/comments/{id}/unhide": { - "post": { - "operationId": "postContentModerationCommentsIdUnhide", + "/payment-intents": { + "get": { + "operationId": "getPaymentIntents", "tags": [ - "content" + "sales" ], - "summary": "Show a hidden community comment again", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Show\" in the dashboard's moderation queue.\n\nShows the comment again, marks it as cleared (it will not be auto-hidden again) and resolves its open reports as IGNORED. Idempotent.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist, is deleted or belongs to another workspace.", + "summary": "Purchase intents of an event (checkout funnel and abandoned journeys)", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the dashboard's Sales → Intents screen.\n\nFolds the checkout funnel log of ONE event (own or collaborative) into one journey per visitor (the buyer account when known, otherwise the device), with how far it got (`stage`) and how it ended (`outcome`: `NO_SALE`, `REJECTED` with `reason`, or the sale status). `funnel` counts ALL journeys of the filter, not only the page. Journeys are sorted by last activity, newest first.\n\nPagination: pass `nextCursor` back as `cursor` (opaque); `null` means no more pages. `eventDate` must belong to the event, otherwise all dates are used (`selectedDateId` echoes the one applied). `onlyAbandoned=true` keeps journeys that picked seats and did not pay (excludes sales still PENDING).\n\nPersonal data: `personName`/`personEmail` come from the buyer account or what was typed at checkout — the same data `GET /sales` returns. Device identifiers never leave the server (`threadId` is a hash).\n\nErrors (`error.code`): 400 `BAD_REQUEST` (missing `event`, invalid `limit`/`onlyAbandoned`), 404 (event not found, not visible, or outside the key's `event_scope`).", "security": [ { "apiKey": [] @@ -15972,9 +16115,47 @@ ], "parameters": [ { - "name": "id", - "in": "path", + "name": "event", + "in": "query", "required": true, + "description": "event id", + "schema": { + "type": "string" + } + }, + { + "name": "eventDate", + "in": "query", + "required": false, + "description": "event date id (must belong to the event)", + "schema": { + "type": "string" + } + }, + { + "name": "onlyAbandoned", + "in": "query", + "required": false, + "description": "true = only journeys that picked seats and did not pay", + "schema": { + "type": "boolean" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 100", + "schema": { + "type": "integer", + "default": 100 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "`nextCursor` of the previous page", "schema": { "type": "string" } @@ -15998,7 +16179,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommentModerated" + "$ref": "#/components/schemas/PaymentIntentsPage" } }, "required": [ @@ -16008,6 +16189,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -16051,14 +16242,14 @@ } } }, - "/content/moderation/comments/{id}/ignore-reports": { + "/sales/{id}/abandon": { "post": { - "operationId": "postContentModerationCommentsIdIgnoreReports", + "operationId": "postSalesIdAbandon", "tags": [ - "content" + "sales" ], - "summary": "Dismiss the open reports of a community comment", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Ignore\" in the dashboard's moderation queue.\n\nLeaves the comment as it is, resolves its open reports as IGNORED and takes it out of the queue; it will no longer be auto-hidden. New reports put it back in the queue. Works on deleted comments too.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist or belongs to another workspace.", + "summary": "Mark a pending sale as abandoned (releases its stock)", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Mark as abandoned\" in the dashboard.\n\nDESTRUCTIVE: a PENDING sale whose payment never started moves to ABANDONED (terminal) and its stock reservations are deleted, so the inventory goes back on sale immediately. It does not touch seats.io holds (same as the dashboard). Use `POST /sales/{id}/cancel` for confirmed sales.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: an item of the sale is outside the key's `event_scope`.\n- 409 `SALE_NOT_PENDING`: only PENDING sales (also when it is already ABANDONED).\n- 409 `PAYMENT_IN_PROGRESS`: a payment was started (`payment_ref` set) and may still be confirmed by the gateway; wait for reconciliation.\n- 409 `SALE_STATE_CHANGED`: the sale changed between the read and the write (e.g. a payment started); re-read it.", "security": [ { "apiKey": [] @@ -16067,6 +16258,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -16095,7 +16287,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommentModerated" + "$ref": "#/components/schemas/Sale" } }, "required": [ @@ -16135,6 +16327,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -16148,14 +16350,14 @@ } } }, - "/content/moderation/member-posts/{id}/approve": { - "post": { - "operationId": "postContentModerationMemberPostsIdApprove", + "/content/posts/{id}": { + "patch": { + "operationId": "patchContentPostsId", "tags": [ "content" ], - "summary": "Approve a pending member post", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Approve\" in the dashboard's Moderation → Posts view: the post is published at the top of the feed, its author is notified and mentioned members are notified.\n\nOnly the version you read is approved: send the post's `updatedAt` from `GET /content/moderation/member-posts` as `expectedUpdatedAt`. If the author edited it since, nothing is published (409 `EDITED_SINCE_READ`): re-read and review again.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `MEMBER_POSTS_UNAVAILABLE`: member posts are not enabled for this workspace.\n- 404 `NOT_FOUND`: not a member post of this workspace, or deleted.\n- 409 `ALREADY_REVIEWED`: it is no longer pending.\n- 409 `EDITED_SINCE_READ`: the author edited it after `expectedUpdatedAt`.\n- 502 `IMAGE_PROMOTION_FAILED`: the image could not be published; retry.", + "summary": "Update a community post or article", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a post or an article in the dashboard.\n\nPartial update: absent fields keep their stored value; `null` clears a nullable field. The stored post decides the shape: an ARTICLE accepts `title`, `subtitle`, `body`, `slug`, `imageUrl` (cover), `locked`, `eventId` and `publishedAt`; a TEXT/IMAGE/VIDEO post accepts `type` (TEXT/IMAGE), `content`, `imageUrl`, `locked`, `eventId`, `channelId` and `publishedAt`. Unlike `POST /content/posts`, changing the text of a short post re-resolves its link preview, like the dashboard. Member posts cannot be edited (404); moderate them under `/content/moderation/member-posts`. The response is redacted like `GET /content/posts` when the post is `locked`.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a field that does not apply to the post's type, or the result would be empty (a short post needs `content` or `imageUrl`).\n- 404 `NOT_FOUND`: the post, the linked `eventId` or the `channelId` does not exist in this workspace.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: `channelId` was sent but channels are not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 409 `SLUG_CONFLICT`: another article of the organization already uses that slug.", "security": [ { "apiKey": [] @@ -16188,7 +16390,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MemberPostApprove" + "$ref": "#/components/schemas/ContentPostUpdate" } } } @@ -16202,7 +16404,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MemberPostReviewed" + "$ref": "#/components/schemas/ContentPost" } }, "required": [ @@ -16212,6 +16414,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -16261,28 +16473,16 @@ } } } - }, - "502": { - "description": "The external provider failed to complete the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } } } - } - }, - "/content/moderation/member-posts/{id}/reject": { - "post": { - "operationId": "postContentModerationMemberPostsIdReject", + }, + "delete": { + "operationId": "deleteContentPostsId", "tags": [ "content" ], - "summary": "Reject a pending member post", - "description": "Minimum role: `STAFF` (`ADMIN` with `banAuthor: true`). Active workspace via the `X-Workspace-Id` header. Same action as \"Reject\" in the dashboard's Moderation → Posts view.\n\nDESTRUCTIVE: the pending post is rejected (it never gets published), the author is notified in their inbox and the image is purged from storage. The optional `reason` is shown to the author. With `banAuthor` the author is also banned from the community in the same transaction.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `BAN_REQUIRES_ADMIN`: `banAuthor` with a role below ADMIN.\n- 400 `BAD_REQUEST`: invalid `reason`.\n- 404 `NOT_FOUND`: not a member post of this workspace, or deleted.\n- 409 `ALREADY_REVIEWED`: another moderator already reviewed it.", + "summary": "Delete a community post", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a post in the dashboard.\n\nDESTRUCTIVE: soft-deletes the post (organization post, article or member post), unpins it and redacts the member notifications that pointed to it. It disappears from the feed immediately and cannot be restored through the API. To take down a member post with a notice to its author, prefer `POST /content/moderation/member-posts/{id}/remove`.\n\nErrors: 404 `NOT_FOUND` (does not exist, already deleted or belongs to another workspace); 403 `EVENT_SCOPE_FORBIDDEN`.", "security": [ { "apiKey": [] @@ -16311,41 +16511,13 @@ } } ], - "requestBody": { - "required": false, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MemberPostDecision" - } - } - } - }, "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/MemberPostReviewed" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" + "type": "object" } } } @@ -16380,16 +16552,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -16403,14 +16565,14 @@ } } }, - "/content/moderation/member-posts/{id}/remove": { - "post": { - "operationId": "postContentModerationMemberPostsIdRemove", + "/content/posts/{id}/pin": { + "put": { + "operationId": "putContentPostsIdPin", "tags": [ "content" ], - "summary": "Remove a published member post", - "description": "Minimum role: `STAFF` (`ADMIN` with `banAuthor: true`). Active workspace via the `X-Workspace-Id` header. Same action as \"Remove\" in the dashboard's Moderation → Posts view.\n\nDESTRUCTIVE: the published post is soft-deleted, the author is notified in their inbox and the image is purged from storage. The optional `reason` is shown to the author. With `banAuthor` the author is also banned from the community in the same transaction.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `BAN_REQUIRES_ADMIN`: `banAuthor` with a role below ADMIN.\n- 400 `BAD_REQUEST`: invalid `reason`.\n- 404 `NOT_FOUND`: not a published member post of this workspace.", + "summary": "Pin or unpin a community post", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Pin\" in the dashboard.\n\nAt most one pinned post per workspace: `pinned: true` unpins the previous one in the same transaction. Only a published post can be pinned; unpinning works on any post. Idempotent.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 404 `NOT_FOUND`: the post does not exist, is deleted, is not published (when pinning) or belongs to another workspace.", "security": [ { "apiKey": [] @@ -16419,7 +16581,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -16440,11 +16601,11 @@ } ], "requestBody": { - "required": false, + "required": true, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MemberPostDecision" + "$ref": "#/components/schemas/ContentPostPin" } } } @@ -16458,7 +16619,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MemberPostReviewed" + "$ref": "#/components/schemas/ContentPostPinned" } }, "required": [ @@ -16468,16 +16629,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -16521,120 +16672,14 @@ } } }, - "/content/members/{id}/ban": { - "post": { - "operationId": "postContentMembersIdBan", - "tags": [ - "content" - ], - "summary": "Ban a member from the community", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. `{id}` is the member's customer id (`author.customerId` in the moderation queue). Same action as \"Ban\" in the dashboard's moderation queue.\n\nDESTRUCTIVE: the member can no longer post, comment or RSVP in this workspace's community; their RSVPs to upcoming meetups are cancelled (the seat is released); `commentId` (or, with `hideAllComments`, all their comments in this workspace) is hidden and the open reports are resolved as BANNED. Idempotent on the ban itself. Lift it with `DELETE`.\n\nThe ban always comes from a comment of this workspace: the banned member is that comment's author, and `{id}` must match it.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist in this workspace or was not written by `{id}`.", - "security": [ - { - "apiKey": [] - }, - { - "apiKeyHeader": [] - } - ], - "x-ft-destructive": true, - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MemberBanCreate" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/MemberBanResult" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - }, + "/content/comments/{id}": { "delete": { - "operationId": "deleteContentMembersIdBan", + "operationId": "deleteContentCommentsId", "tags": [ "content" ], - "summary": "Lift a member's community ban", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Lift ban\" in the dashboard. Deletes the ban (leaving an audit log entry); hidden comments stay hidden and cancelled RSVPs stay cancelled.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the member is not banned in this workspace.", + "summary": "Delete a community comment (moderation)", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a comment from the dashboard.\n\nDESTRUCTIVE: soft-deletes the comment and, if it is a top-level comment, all its live replies; the post's comment count is recomputed. Cannot be undone through the API. To hide it reversibly use `POST /content/moderation/comments/{id}/hide`.\n\nErrors: 404 `NOT_FOUND` (does not exist, already deleted or belongs to another workspace); 403 `EVENT_SCOPE_FORBIDDEN`.", "security": [ { "apiKey": [] @@ -16643,6 +16688,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -16671,7 +16717,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MemberBanResult" + "$ref": "#/components/schemas/ContentCommentDeleted" } }, "required": [ @@ -16724,14 +16770,14 @@ } } }, - "/content/meetups": { + "/content/channels": { "get": { - "operationId": "getContentMeetups", + "operationId": "getContentChannels", "tags": [ "content" ], - "summary": "List community meetups", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Meetups screen: the latest 100 meetups by start date (newest first), in any status, with confirmed and pending-request counts.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).", + "summary": "List the community channels", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Channels screen: active channels in display order (archived ones are omitted). Like the dashboard, the default Announcements and General channels are created on first read if the workspace has none.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -16762,7 +16808,7 @@ "data": { "type": "array", "items": { - "$ref": "#/components/schemas/CommunityMeetup" + "$ref": "#/components/schemas/CommunityChannel" } } }, @@ -16816,12 +16862,12 @@ } }, "post": { - "operationId": "postContentMeetups", + "operationId": "postContentChannels", "tags": [ "content" ], - "summary": "Create a community meetup (draft)", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same form as \"New meetup\" in the dashboard; it is created as DRAFT (publish it with `POST /content/meetups/{id}/publish`). `startsAt`/`endsAt` are local wall times in the workspace's timezone (`YYYY-MM-DDTHH:mm`). An ONLINE meetup keeps `onlineUrl` and drops the address; IN_PERSON the opposite.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 400 `BAD_REQUEST`: malformed wall time, `endsAt` not after `startsAt`, or `onlineUrl` not https.\n- 400 `STARTS_IN_PAST`: the start must be in the future.", + "summary": "Create a community channel", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New channel\" in the dashboard: a CITY or CUSTOM channel, appended at the end. The slug is derived from the name, unique in the workspace, and never changes afterwards.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 400 `BAD_REQUEST`: `city` missing on a CITY channel.\n- 409 `CHANNEL_LIMIT_REACHED`: the workspace already has the maximum of active channels; archive one first.", "security": [ { "apiKey": [] @@ -16846,7 +16892,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommunityMeetupCreate" + "$ref": "#/components/schemas/CommunityChannelCreate" } } } @@ -16860,7 +16906,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityMeetupDetail" + "$ref": "#/components/schemas/CommunityChannel" } }, "required": [ @@ -16910,6 +16956,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -16923,14 +16979,14 @@ } } }, - "/content/meetups/{id}": { - "get": { - "operationId": "getContentMeetupsId", + "/content/channels/{id}": { + "patch": { + "operationId": "patchContentChannelsId", "tags": [ "content" ], - "summary": "Get a community meetup with its attendees and requests", - "description": "Minimum role: `STAFF` (includes the name and email of members who requested a seat). Active workspace via the `X-Workspace-Id` header. Same detail as the dashboard: confirmed attendees (with check-in) and RSVP requests (pending first). `local` carries the editable values in the workspace's wall time.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.", + "summary": "Update a community channel", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a channel in the dashboard. Partial: absent fields keep their value; `null` clears `description`/`city`. The slug does not change on rename. Archived channels cannot be edited.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 400 `ANNOUNCEMENTS_STAFF_ONLY`: Announcements cannot be opened to members (`whoCanPost` must stay STAFF).\n- 400 `CITY_REQUIRED`: a CITY channel needs a city.\n- 404 `NOT_FOUND`: the channel does not exist, is archived or belongs to another workspace.", "security": [ { "apiKey": [] @@ -16958,6 +17014,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommunityChannelUpdate" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -16967,7 +17033,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityMeetupDetail" + "$ref": "#/components/schemas/CommunityChannel" } }, "required": [ @@ -16977,6 +17043,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -17018,14 +17094,16 @@ } } } - }, - "patch": { - "operationId": "patchContentMeetupsId", + } + }, + "/content/channels/order": { + "put": { + "operationId": "putContentChannelsOrder", "tags": [ "content" ], - "summary": "Update a community meetup", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same form as editing a meetup in the dashboard. Partial: absent fields keep the stored value (see `local` in the detail); an empty string clears an optional text field. Times are local wall times in the workspace's timezone.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 400 `BAD_REQUEST`: malformed values (see `POST /content/meetups`).\n- 400 `STARTS_IN_PAST`: a past start is only accepted if it is the one already stored.\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.\n- 409 `EVENT_CANCELLED`: a cancelled meetup cannot be edited.\n- 409 `CAPACITY_BELOW_GOING`: `capacity` lower than the members already confirmed.", + "summary": "Reorder the community channels", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as dragging channels in the dashboard. Send EVERY active channel id (from `GET /content/channels`) in the new order, Announcements first; a partial list is rejected, not applied halfway.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 400 `BAD_REQUEST`: repeated ids.\n- 400 `ANNOUNCEMENTS_FIRST`: Announcements must stay first.\n- 409 `CHANNEL_LIST_CHANGED`: the ids are not exactly the active channels (one was created/archived, or an id from another workspace); re-read and retry.", "security": [ { "apiKey": [] @@ -17035,14 +17113,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -17058,7 +17128,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CommunityMeetupUpdate" + "$ref": "#/components/schemas/CommunityChannelOrder" } } } @@ -17072,7 +17142,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityMeetupDetail" + "$ref": "#/components/schemas/CommunityChannelOrder" } }, "required": [ @@ -17145,14 +17215,14 @@ } } }, - "/content/meetups/{id}/publish": { + "/content/channels/{id}/archive": { "post": { - "operationId": "postContentMeetupsIdPublish", + "operationId": "postContentChannelsIdArchive", "tags": [ "content" ], - "summary": "Publish a draft community meetup", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Publish\" in the dashboard: the draft becomes visible to members and a notification to the whole community is queued in the same transaction (sent by the background job, not by this request).\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.\n- 409 `NOT_DRAFT`: only a draft can be published.\n- 409 `STARTS_IN_PAST`: its start already passed; update it first.", + "summary": "Archive a community channel", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Archive\" in the dashboard.\n\nDESTRUCTIVE: the channel tab disappears for members and staff can no longer post to it; its posts remain visible under \"All\". There is no unarchive endpoint, and its slug stays taken.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 404 `NOT_FOUND`: the channel does not exist, is already archived or belongs to another workspace.\n- 409 `ANNOUNCEMENTS_NOT_ARCHIVABLE`: Announcements cannot be archived.", "security": [ { "apiKey": [] @@ -17161,6 +17231,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -17186,15 +17257,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/CommunityMeetupDetail" - } - }, - "required": [ - "data" - ] + "type": "object" } } } @@ -17252,14 +17315,14 @@ } } }, - "/content/meetups/{id}/cancel": { - "post": { - "operationId": "postContentMeetupsIdCancel", + "/content/moderation/queue": { + "get": { + "operationId": "getContentModerationQueue", "tags": [ "content" ], - "summary": "Cancel a community meetup", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Cancel meetup\" in the dashboard.\n\nDESTRUCTIVE: the meetup (draft or published) moves to CANCELLED, which is terminal: it cannot be edited or published again. Members who confirmed are notified by email/inbox (queued in the same transaction, sent by the background job). RSVPs are kept as they are.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.\n- 409 `ALREADY_CANCELLED`: it was already cancelled.", + "summary": "List reported community comments (moderation queue)", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same queue as the dashboard's Moderation screen: comments with open reports, most reported first, including auto-hidden ones and comments deleted with reports still open (deleting does not dodge a ban). 50 per page; `page` is 0-based (an empty array means no more pages).\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -17268,14 +17331,15 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "page", + "in": "query", + "required": false, + "description": "0-based page", "schema": { - "type": "string" + "type": "integer", + "default": 0 } }, { @@ -17297,7 +17361,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityMeetupDetail" + "type": "array", + "items": { + "$ref": "#/components/schemas/ModerationQueueItem" + } } }, "required": [ @@ -17337,16 +17404,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -17360,14 +17417,14 @@ } } }, - "/content/meetups/{id}/rsvps/{rsvpId}": { - "patch": { - "operationId": "patchContentMeetupsIdRsvpsRsvpId", + "/content/moderation/bans": { + "get": { + "operationId": "getContentModerationBans", "tags": [ "content" ], - "summary": "Approve or reject a meetup RSVP request", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as approving/rejecting a request in the dashboard (meetups with `requiresApproval`). The member gets an email with the decision after the change is committed. APPROVE also works on a previously rejected request (the staff can change its mind); REJECT only on a pending one.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup or the request does not exist in this workspace.\n- 409 `NOT_PENDING`: already reviewed.\n- 409 `EVENT_FULL`: no seats left; raise the capacity first.\n- 409 `EVENT_CLOSED`: the meetup is not published or already started.\n- 409 `MEMBER_BANNED`: the member is banned from the community.\n- 409 `NO_MEMBERSHIP`: the member no longer has an active membership.", + "summary": "List members banned from the community", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Moderation screen: the latest 200 bans, newest first. Lift one with `DELETE /content/members/{customerId}/ban`.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -17377,22 +17434,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "rsvpId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -17403,16 +17444,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CommunityMeetupRsvpReview" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -17422,7 +17453,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityMeetupRsvpReviewed" + "type": "array", + "items": { + "$ref": "#/components/schemas/CommunityBan" + } } }, "required": [ @@ -17462,16 +17496,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -17485,14 +17509,14 @@ } } }, - "/content/meetups/{id}/attendance": { - "put": { - "operationId": "putContentMeetupsIdAttendance", + "/content/moderation/member-posts": { + "get": { + "operationId": "getContentModerationMemberPosts", "tags": [ "content" ], - "summary": "Mark or unmark a meetup attendee as checked in", - "description": "Minimum role: `STAFF` (door work, like `POST /tickets/{ticketCode}/checkin`). Active workspace via the `X-Workspace-Id` header. Same action as the \"Attended\" checkbox in the dashboard. Only on a confirmed (GOING) RSVP of a meetup that is not cancelled; repeating the same mark changes nothing (`changed: false`, also when the RSVP is not GOING or does not belong to the meetup).\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.", + "summary": "List member posts awaiting review (or recently published)", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same lists as the dashboard's Moderation → Posts view. `status=PENDING_REVIEW` (default): posts waiting for approval, oldest first, 30 per 0-based `page`; their `imageUrl` is a short-lived signed URL. `status=PUBLISHED`: the latest 30 published member posts (no paging), to remove one. Approving needs the `updatedAt` read here.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `MEMBER_POSTS_UNAVAILABLE`: member posts are not enabled for this workspace.", "security": [ { "apiKey": [] @@ -17503,11 +17527,27 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "status", + "in": "query", + "required": false, + "description": "PENDING_REVIEW (default) or PUBLISHED", "schema": { - "type": "string" + "type": "string", + "enum": [ + "PENDING_REVIEW", + "PUBLISHED" + ], + "default": "PENDING_REVIEW" + } + }, + { + "name": "page", + "in": "query", + "required": false, + "description": "0-based page (PENDING_REVIEW only)", + "schema": { + "type": "integer", + "default": 0 } }, { @@ -17520,16 +17560,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CommunityMeetupAttendance" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -17539,7 +17569,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CommunityMeetupAttendanceResult" + "type": "array", + "items": { + "$ref": "#/components/schemas/MemberPostQueueItem" + } } }, "required": [ @@ -17592,14 +17625,14 @@ } } }, - "/products": { - "get": { - "operationId": "getProducts", + "/content/moderation/comments/{id}/hide": { + "post": { + "operationId": "postContentModerationCommentsIdHide", "tags": [ - "products" + "content" ], - "summary": "List digital products and courses", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Products screen (downloadable products and courses, not the merch store): non-deleted products, newest first, with CONFIRMED sales count and revenue.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Hide a community comment", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Hide\" in the dashboard's moderation queue.\n\nHides the comment (and its replies from the count) and resolves its open reports as HIDDEN. Reversible with `/unhide`. Idempotent: hiding a hidden comment returns `changed: false`.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist, is deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -17609,6 +17642,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -17628,10 +17669,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Product" - } + "$ref": "#/components/schemas/CommentModerated" } }, "required": [ @@ -17682,14 +17720,16 @@ } } } - }, + } + }, + "/content/moderation/comments/{id}/unhide": { "post": { - "operationId": "postProducts", + "operationId": "postContentModerationCommentsIdUnhide", "tags": [ - "products" + "content" ], - "summary": "Create a digital product or course", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the dashboard's product wizard. A DOWNLOADABLE needs `fileName`/`filePath` of a file already in the workspace's product files folder; a COURSE needs at least one module with one lesson. Files and lesson videos cannot be uploaded through the API: reference ones uploaded from the dashboard. Created as DRAFT unless `publish: true`. Returns the full product.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a dashboard validation rule failed (e.g. a DOWNLOADABLE without a file, a COURSE without modules or a module without lessons, decimals in a COP price, more than one free preview lesson per module, a QUIZ lesson without questions). `error.message` says which.\n- 400 `INVALID_FILE`: a `filePath`/`samplePath`/lesson file/resource path is not under this workspace's product files folder.\n- 400 `INVALID_LESSON_THUMBNAIL`: a lesson `thumbnailUrl` is not an image of this workspace's media library.\n- 400 `INVALID_LESSON_VIDEO`: a lesson `videoId` is not a course video of this workspace, or is linked to another product.\n- 400 `DUPLICATE_LESSON_VIDEO`: the same `videoId` is used in two lessons.\n- 403 `LIVE_LESSONS_PLAN_REQUIRED`: a lesson has `isLive: true` and the workspace plan does not include streaming (Icon).\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Show a hidden community comment again", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Show\" in the dashboard's moderation queue.\n\nShows the comment again, marks it as cleared (it will not be auto-hidden again) and resolves its open reports as IGNORED. Idempotent.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist, is deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -17699,6 +17739,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -17709,18 +17757,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ProductCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -17728,7 +17766,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ProductDetail" + "$ref": "#/components/schemas/CommentModerated" } }, "required": [ @@ -17738,16 +17776,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -17791,14 +17819,14 @@ } } }, - "/products/{id}": { - "get": { - "operationId": "getProductsId", + "/content/moderation/comments/{id}/ignore-reports": { + "post": { + "operationId": "postContentModerationCommentsIdIgnoreReports", "tags": [ - "products" + "content" ], - "summary": "Get a digital product or course", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same detail the dashboard's product wizard opens: product data, CONFIRMED sales totals and, for courses, modules and lessons in order. Lesson quizzes (with the correct answers) are only included for `ADMIN` keys.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the product does not exist, was deleted or belongs to another workspace.", + "summary": "Dismiss the open reports of a community comment", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Ignore\" in the dashboard's moderation queue.\n\nLeaves the comment as it is, resolves its open reports as IGNORED and takes it out of the queue; it will no longer be auto-hidden. New reports put it back in the queue. Works on deleted comments too.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist or belongs to another workspace.", "security": [ { "apiKey": [] @@ -17835,7 +17863,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ProductDetail" + "$ref": "#/components/schemas/CommentModerated" } }, "required": [ @@ -17886,14 +17914,16 @@ } } } - }, - "patch": { - "operationId": "patchProductsId", + } + }, + "/content/moderation/member-posts/{id}/approve": { + "post": { + "operationId": "postContentModerationMemberPostsIdApprove", "tags": [ - "products" + "content" ], - "summary": "Update a digital product or course", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as saving the dashboard's product wizard. Partial: absent fields keep their saved value. Omit `modules` to leave the course tree untouched (only product fields are written). Sending `modules` replaces the WHOLE tree: modules, lessons and resources are matched by `id` and the ones missing from the list are deleted, along with buyers' progress on those lessons — fetch a fresh `GET /products/{id}` right before and send its tree back with your changes. Changing `type` or `unlockMode` requires sending `modules`. New lessons on a published course with buyers notify them, like the dashboard. Returns the full product.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a dashboard validation rule failed (e.g. a DOWNLOADABLE without a file, a COURSE without modules or a module without lessons, decimals in a COP price, more than one free preview lesson per module, a QUIZ lesson without questions). `error.message` says which.\n- 400 `INVALID_FILE`: a `filePath`/`samplePath`/lesson file/resource path is not under this workspace's product files folder.\n- 400 `INVALID_LESSON_THUMBNAIL`: a lesson `thumbnailUrl` is not an image of this workspace's media library.\n- 400 `INVALID_LESSON_VIDEO`: a lesson `videoId` is not a course video of this workspace, or is linked to another product.\n- 400 `DUPLICATE_LESSON_VIDEO`: the same `videoId` is used in two lessons.\n- 403 `LIVE_LESSONS_PLAN_REQUIRED`: a lesson has `isLive: true` and the workspace plan does not include streaming (Icon).\n- 400 `MODULES_REQUIRED`: `type` or `unlockMode` changes without `modules`.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the product does not exist, was deleted or belongs to another workspace.\n- 409 `COURSE_CHANGED`: the course changed concurrently (e.g. a lesson id no longer exists); read it again and retry.", + "summary": "Approve a pending member post", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same action as \"Approve\" in the dashboard's Moderation → Posts view: the post is published at the top of the feed, its author is notified and mentioned members are notified.\n\nOnly the version you read is approved: send the post's `updatedAt` from `GET /content/moderation/member-posts` as `expectedUpdatedAt`. If the author edited it since, nothing is published (409 `EDITED_SINCE_READ`): re-read and review again.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `MEMBER_POSTS_UNAVAILABLE`: member posts are not enabled for this workspace.\n- 404 `NOT_FOUND`: not a member post of this workspace, or deleted.\n- 409 `ALREADY_REVIEWED`: it is no longer pending.\n- 409 `EDITED_SINCE_READ`: the author edited it after `expectedUpdatedAt`.\n- 502 `IMAGE_PROMOTION_FAILED`: the image could not be published; retry.", "security": [ { "apiKey": [] @@ -17926,7 +17956,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProductUpdate" + "$ref": "#/components/schemas/MemberPostApprove" } } } @@ -17940,7 +17970,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ProductDetail" + "$ref": "#/components/schemas/MemberPostReviewed" } }, "required": [ @@ -17950,16 +17980,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -18009,87 +18029,9 @@ } } } - } - } - }, - "delete": { - "operationId": "deleteProductsId", - "tags": [ - "products" - ], - "summary": "Delete a digital product or course", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Delete\" in the dashboard.\n\nDESTRUCTIVE: the product disappears from the dashboard, the API and the public pages (soft delete). There is no restore endpoint.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the product does not exist, was already deleted or belongs to another workspace.", - "security": [ - { - "apiKey": [] }, - { - "apiKeyHeader": [] - } - ], - "x-ft-destructive": true, - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", + "502": { + "description": "The external provider failed to complete the operation.", "content": { "application/json": { "schema": { @@ -18101,14 +18043,14 @@ } } }, - "/products/{id}/status": { + "/content/moderation/member-posts/{id}/reject": { "post": { - "operationId": "postProductsIdStatus", + "operationId": "postContentModerationMemberPostsIdReject", "tags": [ - "products" + "content" ], - "summary": "Publish or unpublish a digital product or course", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the publish toggle in the dashboard's product list, with the target status explicit: sending the current status is a no-op. Publishing re-checks the plan for live lessons; unpublishing never does.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `LIVE_LESSONS_PLAN_REQUIRED`: the course has live lessons and the workspace plan does not include streaming (Icon).\n- 404 `NOT_FOUND`: the product does not exist, was deleted or belongs to another workspace.", + "summary": "Reject a pending member post", + "description": "Minimum role: `STAFF` (`ADMIN` with `banAuthor: true`). Active workspace via the `X-Workspace-Id` header. Same action as \"Reject\" in the dashboard's Moderation → Posts view.\n\nDESTRUCTIVE: the pending post is rejected (it never gets published), the author is notified in their inbox and the image is purged from storage. The optional `reason` is shown to the author. With `banAuthor` the author is also banned from the community in the same transaction.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `BAN_REQUIRES_ADMIN`: `banAuthor` with a role below ADMIN.\n- 400 `BAD_REQUEST`: invalid `reason`.\n- 404 `NOT_FOUND`: not a member post of this workspace, or deleted.\n- 409 `ALREADY_REVIEWED`: another moderator already reviewed it.", "security": [ { "apiKey": [] @@ -18117,6 +18059,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -18137,11 +18080,11 @@ } ], "requestBody": { - "required": true, + "required": false, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ProductStatusUpdate" + "$ref": "#/components/schemas/MemberPostDecision" } } } @@ -18152,7 +18095,25 @@ "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MemberPostReviewed" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" } } } @@ -18187,6 +18148,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -18200,14 +18171,14 @@ } } }, - "/content/videos/{id}": { - "patch": { - "operationId": "patchContentVideosId", + "/content/moderation/member-posts/{id}/remove": { + "post": { + "operationId": "postContentModerationMemberPostsIdRemove", "tags": [ "content" ], - "summary": "Update an on-demand video", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a video in the dashboard's Content screen. Partial: only the fields sent are validated and written (at least one); absent fields keep their stored value; `null` or `\"\"` clears `description`. Works on drafts and published videos. Uploading a video is not available through the API (the Mux direct upload needs a browser); course lesson videos are managed from their course and answer 404 here.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, or `description` longer than 2000.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video does not exist, was deleted, is a course video or belongs to another workspace.", + "summary": "Remove a published member post", + "description": "Minimum role: `STAFF` (`ADMIN` with `banAuthor: true`). Active workspace via the `X-Workspace-Id` header. Same action as \"Remove\" in the dashboard's Moderation → Posts view.\n\nDESTRUCTIVE: the published post is soft-deleted, the author is notified in their inbox and the image is purged from storage. The optional `reason` is shown to the author. With `banAuthor` the author is also banned from the community in the same transaction.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `BAN_REQUIRES_ADMIN`: `banAuthor` with a role below ADMIN.\n- 400 `BAD_REQUEST`: invalid `reason`.\n- 404 `NOT_FOUND`: not a published member post of this workspace.", "security": [ { "apiKey": [] @@ -18216,6 +18187,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -18236,11 +18208,11 @@ } ], "requestBody": { - "required": true, + "required": false, "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ContentVideoUpdate" + "$ref": "#/components/schemas/MemberPostDecision" } } } @@ -18254,7 +18226,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentVideoSummary" + "$ref": "#/components/schemas/MemberPostReviewed" } }, "required": [ @@ -18315,14 +18287,16 @@ } } } - }, - "delete": { - "operationId": "deleteContentVideosId", + } + }, + "/content/members/{id}/ban": { + "post": { + "operationId": "postContentMembersIdBan", "tags": [ "content" ], - "summary": "Delete an on-demand video", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a video in the dashboard.\n\nDESTRUCTIVE and irreversible: soft-deletes the video and deletes its asset in Mux (the encoded file is gone; it cannot be restored through the API or the dashboard). Members lose access immediately.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video does not exist, was already deleted, is a course video or belongs to another workspace.", + "summary": "Ban a member from the community", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. `{id}` is the member's customer id (`author.customerId` in the moderation queue). Same action as \"Ban\" in the dashboard's moderation queue.\n\nDESTRUCTIVE: the member can no longer post, comment or RSVP in this workspace's community; their RSVPs to upcoming meetups are cancelled (the seat is released); `commentId` (or, with `hideAllComments`, all their comments in this workspace) is hidden and the open reports are resolved as BANNED. Idempotent on the ban itself. Lift it with `DELETE`.\n\nThe ban always comes from a comment of this workspace: the banned member is that comment's author, and `{id}` must match it.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the comment does not exist in this workspace or was not written by `{id}`.", "security": [ { "apiKey": [] @@ -18351,6 +18325,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MemberBanCreate" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -18360,7 +18344,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentMediaDeleted" + "$ref": "#/components/schemas/MemberBanResult" } }, "required": [ @@ -18411,16 +18395,14 @@ } } } - } - }, - "/content/videos/{id}/published": { - "put": { - "operationId": "putContentVideosIdPublished", + }, + "delete": { + "operationId": "deleteContentMembersIdBan", "tags": [ "content" ], - "summary": "Publish or unpublish an on-demand video", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the publish switch in the dashboard. Publishing puts the video in the community feed as a VIDEO post (republishing revives the same post and members are notified once); unpublishing removes it from the feed.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video does not exist, was deleted, is a course video or belongs to another workspace.\n- 409 `VIDEO_NOT_READY`: publishing a video Mux has not finished processing.\n- 409 `MEMBERSHIP_PREREQ`: the workspace has no active membership plan yet; create one first (members-only content needs something to pay for). Only checked when publishing.", + "summary": "Lift a member's community ban", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Lift ban\" in the dashboard. Deletes the ban (leaving an audit log entry); hidden comments stay hidden and cancelled RSVPs stay cancelled.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the member is not banned in this workspace.", "security": [ { "apiKey": [] @@ -18448,16 +18430,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentVideoPublish" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -18467,7 +18439,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentVideoPublished" + "$ref": "#/components/schemas/MemberBanResult" } }, "required": [ @@ -18507,16 +18479,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -18530,14 +18492,14 @@ } } }, - "/content/videos/{id}/series": { - "put": { - "operationId": "putContentVideosIdSeries", + "/content/meetups": { + "get": { + "operationId": "getContentMeetups", "tags": [ "content" ], - "summary": "Move a video into a series or out of it", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as choosing a series for a video in the dashboard. `seriesId: null` leaves the video loose. Does not change whether the video is published.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video, or the `seriesId` (see `error.message`), does not exist, was deleted or belongs to another workspace; course videos also answer 404.", + "summary": "List community meetups", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Meetups screen: the latest 100 meetups by start date (newest first), in any status, with confirmed and pending-request counts.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).", "security": [ { "apiKey": [] @@ -18547,14 +18509,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -18565,16 +18519,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentVideoSeriesAssign" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -18584,7 +18528,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentVideoSeriesResult" + "type": "array", + "items": { + "$ref": "#/components/schemas/CommunityMeetup" + } } }, "required": [ @@ -18635,16 +18582,14 @@ } } } - } - }, - "/content/series": { - "get": { - "operationId": "getContentSeries", + }, + "post": { + "operationId": "postContentMeetups", "tags": [ "content" ], - "summary": "List the video series", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Series of the dashboard's Content screen, published and drafts, newest first, with their video count.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Create a community meetup (draft)", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same form as \"New meetup\" in the dashboard; it is created as DRAFT (publish it with `POST /content/meetups/{id}/publish`). `startsAt`/`endsAt` are local wall times in the workspace's timezone (`YYYY-MM-DDTHH:mm`). An ONLINE meetup keeps `onlineUrl` and drops the address; IN_PERSON the opposite.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 400 `BAD_REQUEST`: malformed wall time, `endsAt` not after `startsAt`, or `onlineUrl` not https.\n- 400 `STARTS_IN_PAST`: the start must be in the future.", "security": [ { "apiKey": [] @@ -18654,24 +18599,6 @@ } ], "parameters": [ - { - "name": "limit", - "in": "query", - "required": false, - "description": "1-100, default 20", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "cursor", - "in": "query", - "required": false, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -18682,8 +18609,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommunityMeetupCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -18691,23 +18628,26 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ContentSeries" - } - }, - "page": { - "$ref": "#/components/schemas/Page" + "$ref": "#/components/schemas/CommunityMeetupDetail" } }, "required": [ - "data", - "page" + "data" ] } } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -18749,14 +18689,16 @@ } } } - }, - "post": { - "operationId": "postContentSeries", + } + }, + "/content/meetups/{id}": { + "get": { + "operationId": "getContentMeetupsId", "tags": [ "content" ], - "summary": "Create a video series", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New series\" in the dashboard. The series is born unpublished and empty; add videos with `PUT /content/videos/{id}/series` and publish it with `PUT /content/series/{id}/published`.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, `description` longer than 2000, or `coverImageUrl` not an absolute URL.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 409 `MEMBERSHIP_PREREQ`: the workspace has no active membership plan yet; create one first (members-only content needs something to pay for).", + "summary": "Get a community meetup with its attendees and requests", + "description": "Minimum role: `STAFF` (includes the name and email of members who requested a seat). Active workspace via the `X-Workspace-Id` header. Same detail as the dashboard: confirmed attendees (with check-in) and RSVP requests (pending first). `local` carries the editable values in the workspace's wall time.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.", "security": [ { "apiKey": [] @@ -18766,6 +18708,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -18776,18 +18726,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentSeriesCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -18795,7 +18735,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentSeries" + "$ref": "#/components/schemas/CommunityMeetupDetail" } }, "required": [ @@ -18805,16 +18745,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -18845,16 +18775,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -18866,16 +18786,14 @@ } } } - } - }, - "/content/series/{id}": { + }, "patch": { - "operationId": "patchContentSeriesId", + "operationId": "patchContentMeetupsId", "tags": [ "content" ], - "summary": "Update a video series", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a series in the dashboard. Partial: only the fields sent are validated and written (at least one); absent fields keep their stored value; `null` clears `description` / `coverImageUrl`.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, `description` longer than 2000, or `coverImageUrl` not an absolute URL.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the series does not exist, was deleted or belongs to another workspace.", + "summary": "Update a community meetup", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same form as editing a meetup in the dashboard. Partial: absent fields keep the stored value (see `local` in the detail); an empty string clears an optional text field. Times are local wall times in the workspace's timezone.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 400 `BAD_REQUEST`: malformed values (see `POST /content/meetups`).\n- 400 `STARTS_IN_PAST`: a past start is only accepted if it is the one already stored.\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.\n- 409 `EVENT_CANCELLED`: a cancelled meetup cannot be edited.\n- 409 `CAPACITY_BELOW_GOING`: `capacity` lower than the members already confirmed.", "security": [ { "apiKey": [] @@ -18908,7 +18826,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ContentSeriesUpdate" + "$ref": "#/components/schemas/CommunityMeetupUpdate" } } } @@ -18922,7 +18840,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentSeries" + "$ref": "#/components/schemas/CommunityMeetupDetail" } }, "required": [ @@ -18972,6 +18890,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -18983,14 +18911,16 @@ } } } - }, - "delete": { - "operationId": "deleteContentSeriesId", + } + }, + "/content/meetups/{id}/publish": { + "post": { + "operationId": "postContentMeetupsIdPublish", "tags": [ "content" ], - "summary": "Delete a video series", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a series in the dashboard.\n\nDESTRUCTIVE: soft-deletes the series; it cannot be restored through the API. Its videos are NOT deleted or unpublished: they are left loose (no series, position reset), so the original grouping and order are lost.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the series does not exist, was already deleted or belongs to another workspace.", + "summary": "Publish a draft community meetup", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Publish\" in the dashboard: the draft becomes visible to members and a notification to the whole community is queued in the same transaction (sent by the background job, not by this request).\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.\n- 409 `NOT_DRAFT`: only a draft can be published.\n- 409 `STARTS_IN_PAST`: its start already passed; update it first.", "security": [ { "apiKey": [] @@ -18999,7 +18929,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -19028,7 +18957,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentMediaDeleted" + "$ref": "#/components/schemas/CommunityMeetupDetail" } }, "required": [ @@ -19068,6 +18997,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -19081,14 +19020,14 @@ } } }, - "/content/series/{id}/published": { - "put": { - "operationId": "putContentSeriesIdPublished", + "/content/meetups/{id}/cancel": { + "post": { + "operationId": "postContentMeetupsIdCancel", "tags": [ "content" ], - "summary": "Publish or unpublish a video series", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the publish switch of a series in the dashboard. Only the series changes: its videos keep their own published state. Publishing again refreshes `publishedAt`.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the series does not exist, was deleted or belongs to another workspace.", + "summary": "Cancel a community meetup", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Cancel meetup\" in the dashboard.\n\nDESTRUCTIVE: the meetup (draft or published) moves to CANCELLED, which is terminal: it cannot be edited or published again. Members who confirmed are notified by email/inbox (queued in the same transaction, sent by the background job). RSVPs are kept as they are.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.\n- 409 `ALREADY_CANCELLED`: it was already cancelled.", "security": [ { "apiKey": [] @@ -19097,6 +19036,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -19116,16 +19056,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ContentSeriesPublish" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -19135,7 +19065,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentSeries" + "$ref": "#/components/schemas/CommunityMeetupDetail" } }, "required": [ @@ -19175,6 +19105,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -19188,14 +19128,14 @@ } } }, - "/content/lives/{id}/reset-key": { - "post": { - "operationId": "postContentLivesIdResetKey", + "/content/meetups/{id}/rsvps/{rsvpId}": { + "patch": { + "operationId": "patchContentMeetupsIdRsvpsRsvpId", "tags": [ "content" ], - "summary": "Rotate a live stream's stream key", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Reset key\" in the dashboard: Mux issues a new stream key and returns it with the RTMPS server.\n\nDESTRUCTIVE: the current key stops working immediately; any encoder (OBS) configured with it can no longer connect and must be updated with the new one. Use it when the key may have leaked.\n\nSECURITY: `streamKey` is a secret that grants broadcasting rights on this stream in the organization's name. It is returned only here and by `POST /content/lives`; store it like a password.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was deleted or belongs to another workspace.\n- 502 `MUX_ERROR`: Mux rejected the request or is not configured; the old key keeps working.", + "summary": "Approve or reject a meetup RSVP request", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as approving/rejecting a request in the dashboard (meetups with `requiresApproval`). The member gets an email with the decision after the change is committed. APPROVE also works on a previously rejected request (the staff can change its mind); REJECT only on a pending one.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup or the request does not exist in this workspace.\n- 409 `NOT_PENDING`: already reviewed.\n- 409 `EVENT_FULL`: no seats left; raise the capacity first.\n- 409 `EVENT_CLOSED`: the meetup is not published or already started.\n- 409 `MEMBER_BANNED`: the member is banned from the community.\n- 409 `NO_MEMBERSHIP`: the member no longer has an active membership.", "security": [ { "apiKey": [] @@ -19204,7 +19144,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -19214,6 +19153,14 @@ "type": "string" } }, + { + "name": "rsvpId", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -19224,6 +19171,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommunityMeetupRsvpReview" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -19233,7 +19190,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentLiveStreamKey" + "$ref": "#/components/schemas/CommunityMeetupRsvpReviewed" } }, "required": [ @@ -19273,8 +19230,8 @@ } } }, - "422": { - "description": "Request body/parameter validation failed.", + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", "content": { "application/json": { "schema": { @@ -19283,8 +19240,8 @@ } } }, - "502": { - "description": "The external provider failed to complete the operation.", + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -19296,14 +19253,14 @@ } } }, - "/content/lives/{id}/chat": { - "get": { - "operationId": "getContentLivesIdChat", + "/content/meetups/{id}/attendance": { + "put": { + "operationId": "putContentMeetupsIdAttendance", "tags": [ "content" ], - "summary": "Chat history of a live stream", - "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same history as \"View chat\" in the dashboard, for a stream on air or already ended: oldest to newest, capped (`truncated: true` when the oldest messages were cut). Contains buyers' display names and messages: treat it as personal data.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was deleted or belongs to another workspace.", + "summary": "Mark or unmark a meetup attendee as checked in", + "description": "Minimum role: `STAFF` (door work, like `POST /tickets/{ticketCode}/checkin`). Active workspace via the `X-Workspace-Id` header. Same action as the \"Attended\" checkbox in the dashboard. Only on a confirmed (GOING) RSVP of a meetup that is not cancelled; repeating the same mark changes nothing (`changed: false`, also when the RSVP is not GOING or does not belong to the meetup).\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `COMMUNITY_UNAVAILABLE`: the community (`community_v2`) is not enabled for this workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (meetups are community content, not ticketed events).\n- 404 `NOT_FOUND`: the meetup does not exist in this workspace.", "security": [ { "apiKey": [] @@ -19331,6 +19288,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CommunityMeetupAttendance" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -19340,7 +19307,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ContentLiveChat" + "$ref": "#/components/schemas/CommunityMeetupAttendanceResult" } }, "required": [ @@ -19393,14 +19360,14 @@ } } }, - "/website": { + "/products": { "get": { - "operationId": "getWebsite", + "operationId": "getProducts", "tags": [ - "website" + "products" ], - "summary": "Get the workspace website configuration", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the dashboard's Website screen: landing texts, social links, accent color, template, section visibility/order, and the public listing state (`published`, `canPublish`, `profileListable`). `customLandingEnabled` says whether the plan allows `PUT /website`.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (workspace configuration is out of its scope).", + "summary": "List digital products and courses", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Products screen (downloadable products and courses, not the merch store): non-deleted products, newest first, with CONFIRMED sales count and revenue.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -19429,7 +19396,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Website" + "type": "array", + "items": { + "$ref": "#/components/schemas/Product" + } } }, "required": [ @@ -19481,13 +19451,13 @@ } } }, - "put": { - "operationId": "putWebsite", + "post": { + "operationId": "postProducts", "tags": [ - "website" + "products" ], - "summary": "Save the workspace website configuration", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Save\" in the dashboard's Website editor. FULL replacement: every field is required; `null` clears an optional text. Read `GET /website` first and send everything back. Shared columns: `name`, `bio`, `instagramUrl`, `tiktokUrl` and `youtubeUrl` are the same workspace columns that `PATCH /organization/profile` edits (`artist.name`, `artist.bio`, `social.*`) — a PUT with `null` here wipes them there too. An empty `name` is not accepted, and unlike the profile it is NOT mirrored to the brand. The profile photo and cover are NOT edited here (see `PATCH /organization`). Returns the saved configuration.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include the custom landing.\n- 400 `INVALID_SECTIONS`: `webSections` is malformed.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Create a digital product or course", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the dashboard's product wizard. A DOWNLOADABLE needs `fileName`/`filePath` of a file already in the workspace's product files folder; a COURSE needs at least one module with one lesson. Files and lesson videos cannot be uploaded through the API: reference ones uploaded from the dashboard. Created as DRAFT unless `publish: true`. Returns the full product.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a dashboard validation rule failed (e.g. a DOWNLOADABLE without a file, a COURSE without modules or a module without lessons, decimals in a COP price, more than one free preview lesson per module, a QUIZ lesson without questions). `error.message` says which.\n- 400 `INVALID_FILE`: a `filePath`/`samplePath`/lesson file/resource path is not under this workspace's product files folder.\n- 400 `INVALID_LESSON_THUMBNAIL`: a lesson `thumbnailUrl` is not an image of this workspace's media library.\n- 400 `INVALID_LESSON_VIDEO`: a lesson `videoId` is not a course video of this workspace, or is linked to another product.\n- 400 `DUPLICATE_LESSON_VIDEO`: the same `videoId` is used in two lessons.\n- 403 `LIVE_LESSONS_PLAN_REQUIRED`: a lesson has `isLive: true` and the workspace plan does not include streaming (Icon).\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -19512,13 +19482,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/WebsiteUpdate" + "$ref": "#/components/schemas/ProductCreate" } } } }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -19526,7 +19496,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Website" + "$ref": "#/components/schemas/ProductDetail" } }, "required": [ @@ -19589,14 +19559,14 @@ } } }, - "/website/published": { - "put": { - "operationId": "putWebsitePublished", + "/products/{id}": { + "get": { + "operationId": "getProductsId", "tags": [ - "website" + "products" ], - "summary": "Publish or unpublish the public profile", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same switch as \"Appear in Artists\" in the dashboard: sets whether the organization's public page is listed. Available on every plan. Idempotent: send the desired state.\n\nErrors (`error.code`):\n- 409 `NO_ORGANIZATION`: the workspace has no umbrella organization.\n- 409 `NOT_PRIMARY_WORKSPACE`: only the organization's primary workspace can publish.\n- 409 `PROFILE_INCOMPLETE`: publishing needs the brand name and profile photo (unpublishing is always allowed).\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Get a digital product or course", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same detail the dashboard's product wizard opens: product data, CONFIRMED sales totals and, for courses, modules and lessons in order. Lesson quizzes (with the correct answers) are only included for `ADMIN` keys.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the product does not exist, was deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -19607,114 +19577,13 @@ ], "parameters": [ { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/WebsitePublished" - } - } - } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/WebsitePublished" - } - }, - "required": [ - "data" - ] - } - } - } - }, - "401": { - "description": "Missing or invalid credential.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "403": { - "description": "Insufficient role or resource not accessible.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "404": { - "description": "Resource does not exist or is out of scope.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "422": { - "description": "Request body/parameter validation failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - } - } - } - }, - "/organization": { - "patch": { - "operationId": "patchOrganization", - "tags": [ - "organization" - ], - "summary": "Update the organization's public identity", - "description": "Minimum role: `ADMIN`, and the user must be OWNER/ADMIN of the umbrella organization of the active workspace (`X-Workspace-Id`). Same action as the identity card in the dashboard's organization settings: public name, profile photo and cover. Partial: absent fields keep their value; `null` clears an image. The name is mirrored to the primary workspace. The slug (public URL) cannot be changed here. Returns the organization.\n\nErrors (`error.code`):\n- 403 `ORG_ADMIN_REQUIRED`: the user is not OWNER/ADMIN of the organization.\n- 409 `NO_ORGANIZATION`: the workspace has no umbrella organization.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", - "security": [ - { - "apiKey": [] }, - { - "apiKeyHeader": [] - } - ], - "parameters": [ { "name": "X-Workspace-Id", "in": "header", @@ -19725,16 +19594,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/OrganizationUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -19744,7 +19603,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/Organization" + "$ref": "#/components/schemas/ProductDetail" } }, "required": [ @@ -19784,16 +19643,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -19805,16 +19654,14 @@ } } } - } - }, - "/organization/analytics": { + }, "patch": { - "operationId": "patchOrganizationAnalytics", + "operationId": "patchProductsId", "tags": [ - "organization" + "products" ], - "summary": "Set the organization's GA4 property", - "description": "Minimum role: `ADMIN`, and the user must be OWNER/ADMIN of the umbrella organization of the active workspace (`X-Workspace-Id`). Same action as the analytics card in the dashboard's organization settings: the brand's own GA4 Measurement ID, added to the checkout of its events next to FreeTicket's. `null` (or an empty string) disconnects it.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: not a GA4 Measurement ID (G-XXXXXXXXXX).\n- 403 `ORG_ADMIN_REQUIRED`: the user is not OWNER/ADMIN of the organization.\n- 409 `NO_ORGANIZATION`: the workspace has no umbrella organization.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Update a digital product or course", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as saving the dashboard's product wizard. Partial: absent fields keep their saved value. Omit `modules` to leave the course tree untouched (only product fields are written). Sending `modules` replaces the WHOLE tree: modules, lessons and resources are matched by `id` and the ones missing from the list are deleted, along with buyers' progress on those lessons — fetch a fresh `GET /products/{id}` right before and send its tree back with your changes. Changing `type` or `unlockMode` requires sending `modules`. New lessons on a published course with buyers notify them, like the dashboard. Returns the full product.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a dashboard validation rule failed (e.g. a DOWNLOADABLE without a file, a COURSE without modules or a module without lessons, decimals in a COP price, more than one free preview lesson per module, a QUIZ lesson without questions). `error.message` says which.\n- 400 `INVALID_FILE`: a `filePath`/`samplePath`/lesson file/resource path is not under this workspace's product files folder.\n- 400 `INVALID_LESSON_THUMBNAIL`: a lesson `thumbnailUrl` is not an image of this workspace's media library.\n- 400 `INVALID_LESSON_VIDEO`: a lesson `videoId` is not a course video of this workspace, or is linked to another product.\n- 400 `DUPLICATE_LESSON_VIDEO`: the same `videoId` is used in two lessons.\n- 403 `LIVE_LESSONS_PLAN_REQUIRED`: a lesson has `isLive: true` and the workspace plan does not include streaming (Icon).\n- 400 `MODULES_REQUIRED`: `type` or `unlockMode` changes without `modules`.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the product does not exist, was deleted or belongs to another workspace.\n- 409 `COURSE_CHANGED`: the course changed concurrently (e.g. a lesson id no longer exists); read it again and retry.", "security": [ { "apiKey": [] @@ -19824,6 +19671,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -19839,7 +19694,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationAnalyticsUpdate" + "$ref": "#/components/schemas/ProductUpdate" } } } @@ -19853,7 +19708,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/OrganizationAnalytics" + "$ref": "#/components/schemas/ProductDetail" } }, "required": [ @@ -19924,16 +19779,14 @@ } } } - } - }, - "/organization/profile": { - "get": { - "operationId": "getOrganizationProfile", + }, + "delete": { + "operationId": "deleteProductsId", "tags": [ - "organization" + "products" ], - "summary": "Get the workspace profile", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the dashboard's Profile screen: artist/venue/organizer data, brand photo and cover (from the umbrella organization), contact and social links. Billing/plan data is not included.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Delete a digital product or course", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Delete\" in the dashboard.\n\nDESTRUCTIVE: the product disappears from the dashboard, the API and the public pages (soft delete). There is no restore endpoint.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the product does not exist, was already deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -19942,7 +19795,16 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -19959,15 +19821,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/OrganizationProfile" - } - }, - "required": [ - "data" - ] + "type": "object" } } } @@ -20013,14 +19867,16 @@ } } } - }, - "patch": { - "operationId": "patchOrganizationProfile", + } + }, + "/products/{id}/status": { + "post": { + "operationId": "postProductsIdStatus", "tags": [ - "organization" + "products" ], - "summary": "Update the workspace profile", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same actions as the four cards of the dashboard's Profile screen, as optional sections: `artist` (name, slug, bio, type, country, timezone), `visual` (brand photo/cover, stored on the umbrella organization), `contact` and `social`. Partial: only the fields sent are written; absent fields keep their value and `null` clears an optional one. Sections are applied in order artist → visual → contact → social; if one fails, the earlier ones stay saved. Changing `artist.slug` changes the workspace's URLs. `visual` and `artist.name` write organization-level columns (the brand photo/cover and the brand name mirror), so they additionally require the user to be OWNER/ADMIN of the umbrella organization — checked before ANY section is written (stricter than the dashboard, same rule as `PATCH /organization`). Returns the updated profile.\n\nErrors (`error.code`):\n- 403 `ORG_ADMIN_REQUIRED`: `visual` or `artist.name` sent by a user who is not OWNER/ADMIN of the organization (nothing is written).\n- 409 `SLUG_TAKEN`: `artist.slug` is used by another workspace, including deleted ones (nothing is written).\n- 409 `ORG_NOT_INITIALIZED`: `visual` sent but the workspace has no umbrella organization (nothing is written).\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Publish or unpublish a digital product or course", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the publish toggle in the dashboard's product list, with the target status explicit: sending the current status is a no-op. Publishing re-checks the plan for live lessons; unpublishing never does.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 403 `LIVE_LESSONS_PLAN_REQUIRED`: the course has live lessons and the workspace plan does not include streaming (Icon).\n- 404 `NOT_FOUND`: the product does not exist, was deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -20030,6 +19886,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -20045,7 +19909,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/OrganizationProfileUpdate" + "$ref": "#/components/schemas/ProductStatusUpdate" } } } @@ -20056,15 +19920,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "data": { - "$ref": "#/components/schemas/OrganizationProfile" - } - }, - "required": [ - "data" - ] + "type": "object" } } } @@ -20099,16 +19955,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -20122,14 +19968,14 @@ } } }, - "/ticket-templates": { - "get": { - "operationId": "getTicketTemplates", + "/content/videos/{id}": { + "patch": { + "operationId": "patchContentVideosId", "tags": [ - "ticket-templates" + "content" ], - "summary": "List the ticket templates", - "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Ticket templates screen: reusable ticket-type definitions (price, capacity, member discount/gate, buyer form fields), ordered for display. Deleted templates are omitted.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (templates are workspace configuration).", + "summary": "Update an on-demand video", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a video in the dashboard's Content screen. Partial: only the fields sent are validated and written (at least one); absent fields keep their stored value; `null` or `\"\"` clears `description`. Works on drafts and published videos. Uploading a video is not available through the API (the Mux direct upload needs a browser); course lesson videos are managed from their course and answer 404 here.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, or `description` longer than 2000.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video does not exist, was deleted, is a course video or belongs to another workspace.", "security": [ { "apiKey": [] @@ -20139,6 +19985,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -20149,6 +20003,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentVideoUpdate" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -20158,10 +20022,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/TicketTemplate" - } + "$ref": "#/components/schemas/ContentVideoSummary" } }, "required": [ @@ -20171,6 +20032,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -20213,13 +20084,13 @@ } } }, - "post": { - "operationId": "postTicketTemplates", + "delete": { + "operationId": "deleteContentVideosId", "tags": [ - "ticket-templates" + "content" ], - "summary": "Create a ticket template", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New template\" in the dashboard. A SELECT field needs at least 2 options (422 otherwise).\n\nErrors (`error.code`):\n- 400 `INVALID_CURRENCY`: the currency is not one the checkout charges.\n- 400 `DISCOUNT_PLAN_INVALID`: `discount.planId` is not an active membership plan of this workspace.\n- 400 `MEMBERS_ONLY_PLAN_INVALID`: `membersOnlyPlanId` cannot gate this workspace's tickets.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Delete an on-demand video", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a video in the dashboard.\n\nDESTRUCTIVE and irreversible: soft-deletes the video and deletes its asset in Mux (the encoded file is gone; it cannot be restored through the API or the dashboard). Members lose access immediately.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video does not exist, was already deleted, is a course video or belongs to another workspace.", "security": [ { "apiKey": [] @@ -20228,7 +20099,16 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -20239,18 +20119,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TicketTemplateCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -20258,7 +20128,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/TicketTemplate" + "$ref": "#/components/schemas/ContentMediaDeleted" } }, "required": [ @@ -20268,16 +20138,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -20321,14 +20181,14 @@ } } }, - "/ticket-templates/{id}": { - "patch": { - "operationId": "patchTicketTemplatesId", + "/content/videos/{id}/published": { + "put": { + "operationId": "putContentVideosIdPublished", "tags": [ - "ticket-templates" + "content" ], - "summary": "Update a ticket template", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a template in the dashboard. Partial: only the fields sent are written; `null` clears an optional one (`discount: null` removes the member discount, `membersOnlyPlanId: null` opens it to everyone). `fields` replaces the whole buyer-form list when sent and is left intact when absent. Ticket types already created from the template are copies and do not change. A legacy currency outside the checkout list is accepted only if unchanged.\n\nErrors (`error.code`):\n- 400 `INVALID_CURRENCY`: the currency is not one the checkout charges.\n- 400 `DISCOUNT_PLAN_INVALID`: `discount.planId` is not an active membership plan of this workspace.\n- 400 `MEMBERS_ONLY_PLAN_INVALID`: `membersOnlyPlanId` cannot gate this workspace's tickets.\n- 404 `NOT_FOUND`: the template does not exist, is deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Publish or unpublish an on-demand video", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the publish switch in the dashboard. Publishing puts the video in the community feed as a VIDEO post (republishing revives the same post and members are notified once); unpublishing removes it from the feed.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video does not exist, was deleted, is a course video or belongs to another workspace.\n- 409 `VIDEO_NOT_READY`: publishing a video Mux has not finished processing.\n- 409 `MEMBERSHIP_PREREQ`: the workspace has no active membership plan yet; create one first (members-only content needs something to pay for). Only checked when publishing.", "security": [ { "apiKey": [] @@ -20361,7 +20221,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TicketTemplateUpdate" + "$ref": "#/components/schemas/ContentVideoPublish" } } } @@ -20375,7 +20235,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/TicketTemplate" + "$ref": "#/components/schemas/ContentVideoPublished" } }, "required": [ @@ -20385,8 +20245,8 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -20395,8 +20255,8 @@ } } }, - "401": { - "description": "Missing or invalid credential.", + "403": { + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -20405,8 +20265,8 @@ } } }, - "403": { - "description": "Insufficient role or resource not accessible.", + "404": { + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -20415,8 +20275,8 @@ } } }, - "404": { - "description": "Resource does not exist or is out of scope.", + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", "content": { "application/json": { "schema": { @@ -20436,14 +20296,16 @@ } } } - }, - "delete": { - "operationId": "deleteTicketTemplatesId", + } + }, + "/content/videos/{id}/series": { + "put": { + "operationId": "putContentVideosIdSeries", "tags": [ - "ticket-templates" + "content" ], - "summary": "Delete a ticket template", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a template in the dashboard.\n\nDESTRUCTIVE: the template is removed from the workspace (soft delete, there is no restore via API). Ticket types already created from it keep working.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the template does not exist, is already deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Move a video into a series or out of it", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as choosing a series for a video in the dashboard. `seriesId: null` leaves the video loose. Does not change whether the video is published.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the video, or the `seriesId` (see `error.message`), does not exist, was deleted or belongs to another workspace; course videos also answer 404.", "security": [ { "apiKey": [] @@ -20452,7 +20314,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -20472,6 +20333,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentVideoSeriesAssign" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -20481,7 +20352,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/WorkspaceConfigDeleted" + "$ref": "#/components/schemas/ContentVideoSeriesResult" } }, "required": [ @@ -20534,14 +20405,14 @@ } } }, - "/ticket-templates/{id}/instantiate": { - "post": { - "operationId": "postTicketTemplatesIdInstantiate", + "/content/series": { + "get": { + "operationId": "getContentSeries", "tags": [ - "ticket-templates" + "content" ], - "summary": "Create a ticket type from a template", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Use template\" in the dashboard: creates a ticket type on `eventDateId` copying the template (price, capacity, discount, members-only gate, buyer form). `name`, `price` and `capacity` override the template's. A discount or gate whose plan is no longer valid is dropped instead of failing. Keys restricted to events may use it only on dates of their events.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the template does not exist, is deleted or belongs to another workspace.\n- 404 `EVENT_DATE_NOT_FOUND`: the event date does not exist or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to events and the date's event is not one of them.\n- 400 `CAPACITY_REQUIRED`: the template has no capacity and `capacity` was not sent.\n- 400 `INVALID_CURRENCY`: the template's legacy currency is not one the checkout charges.", + "summary": "List the video series", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Series of the dashboard's Content screen, published and drafts, newest first, with their video count.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -20552,9 +20423,19 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "limit", + "in": "query", + "required": false, + "description": "1-100, default 20", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "cursor", + "in": "query", + "required": false, "schema": { "type": "string" } @@ -20569,18 +20450,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TicketTemplateInstantiate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -20588,26 +20459,23 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/TicketTemplateInstance" + "type": "array", + "items": { + "$ref": "#/components/schemas/ContentSeries" + } + }, + "page": { + "$ref": "#/components/schemas/Page" } }, "required": [ - "data" + "data", + "page" ] } } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -20649,16 +20517,14 @@ } } } - } - }, - "/master-qrs": { - "get": { - "operationId": "getMasterQrs", + }, + "post": { + "operationId": "postContentSeries", "tags": [ - "master-qrs" + "content" ], - "summary": "List the master box-office QR codes", - "description": "Minimum role: `ADMIN` (also for reading, like the dashboard). Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Box-office QR screen: live (not deleted) QR codes, newest first, with scan counters. `code` and `url` are SECRET: they are what the printed QR encodes and open the public sale flow; they cannot be rotated. Do not log or share them.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (org-wide QR codes span every show).", + "summary": "Create a video series", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New series\" in the dashboard. The series is born unpublished and empty; add videos with `PUT /content/videos/{id}/series` and publish it with `PUT /content/series/{id}/published`.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, `description` longer than 2000, or `coverImageUrl` not an absolute URL.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 409 `MEMBERSHIP_PREREQ`: the workspace has no active membership plan yet; create one first (members-only content needs something to pay for).", "security": [ { "apiKey": [] @@ -20678,8 +20544,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentSeriesCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -20687,10 +20563,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MasterQr" - } + "$ref": "#/components/schemas/ContentSeries" } }, "required": [ @@ -20700,6 +20573,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -20730,6 +20613,16 @@ } } }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -20741,14 +20634,16 @@ } } } - }, - "post": { - "operationId": "postMasterQrs", + } + }, + "/content/series/{id}": { + "patch": { + "operationId": "patchContentSeriesId", "tags": [ - "master-qrs" + "content" ], - "summary": "Create a master box-office QR code", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New QR\" in the dashboard. `eventId` absent/null = org-wide QR (all shows); `ticketTypeId` pins a ticket type of that event (not allowed on an org-wide QR → 422). Returns the QR with its code. `code` and `url` are SECRET: they are what the printed QR encodes and open the public sale flow; they cannot be rotated. Do not log or share them.\n\nErrors (`error.code`):\n- 400 `INVALID_TARGET`: the event is not of this workspace, or the ticket type is not a visible ticket type of a sellable date of that event.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Update a video series", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a series in the dashboard. Partial: only the fields sent are validated and written (at least one); absent fields keep their stored value; `null` clears `description` / `coverImageUrl`.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: `title` empty or longer than 120 characters, `description` longer than 2000, or `coverImageUrl` not an absolute URL.\n- 403 `FEATURE_LOCKED`: the workspace plan does not include Content.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the series does not exist, was deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -20758,6 +20653,14 @@ } ], "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, { "name": "X-Workspace-Id", "in": "header", @@ -20773,13 +20676,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MasterQrCreate" + "$ref": "#/components/schemas/ContentSeriesUpdate" } } } }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -20787,7 +20690,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MasterQr" + "$ref": "#/components/schemas/ContentSeries" } }, "required": [ @@ -20848,16 +20751,14 @@ } } } - } - }, - "/master-qrs/{id}": { - "patch": { - "operationId": "patchMasterQrsId", + }, + "delete": { + "operationId": "deleteContentSeriesId", "tags": [ - "master-qrs" + "content" ], - "summary": "Update a master box-office QR code", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a QR in the dashboard. Partial: `label` and `mode` can be sent alone; the target (`eventId` + `ticketTypeId`, `null` for none / org-wide) must be sent as a pair (422 otherwise). The code does not change, so the printed QR keeps working and now points to the new target.\n\nErrors (`error.code`):\n- 400 `INVALID_TARGET`: the event is not of this workspace, or the ticket type does not belong to it.\n- 404 `NOT_FOUND`: the QR does not exist, is deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Delete a video series", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a series in the dashboard.\n\nDESTRUCTIVE: soft-deletes the series; it cannot be restored through the API. Its videos are NOT deleted or unpublished: they are left loose (no series, position reset), so the original grouping and order are lost.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the series does not exist, was already deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -20866,6 +20767,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -20885,16 +20787,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MasterQrUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -20904,7 +20796,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MasterQr" + "$ref": "#/components/schemas/ContentMediaDeleted" } }, "required": [ @@ -20914,16 +20806,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -20965,14 +20847,16 @@ } } } - }, - "delete": { - "operationId": "deleteMasterQrsId", + } + }, + "/content/series/{id}/published": { + "put": { + "operationId": "putContentSeriesIdPublished", "tags": [ - "master-qrs" + "content" ], - "summary": "Delete a master box-office QR code", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a QR in the dashboard.\n\nDESTRUCTIVE: the QR is deactivated and deleted (soft delete, the scan history is kept); the printed code stops working and cannot be restored via API. To pause it instead, use `PUT /master-qrs/{id}/active`.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the QR does not exist, is already deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Publish or unpublish a video series", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as the publish switch of a series in the dashboard. Only the series changes: its videos keep their own published state. Publishing again refreshes `publishedAt`.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the series does not exist, was deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -20981,7 +20865,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -21001,6 +20884,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentSeriesPublish" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -21010,7 +20903,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/WorkspaceConfigDeleted" + "$ref": "#/components/schemas/ContentSeries" } }, "required": [ @@ -21063,14 +20956,14 @@ } } }, - "/master-qrs/{id}/active": { - "put": { - "operationId": "putMasterQrsIdActive", + "/content/lives/{id}/reset-key": { + "post": { + "operationId": "postContentLivesIdResetKey", "tags": [ - "master-qrs" + "content" ], - "summary": "Activate or deactivate a master box-office QR code", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same switch as in the dashboard's QR table. While inactive, scanning the QR answers 404. Idempotent: send the desired state.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the QR does not exist, is deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "summary": "Rotate a live stream's stream key", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Reset key\" in the dashboard: Mux issues a new stream key and returns it with the RTMPS server.\n\nDESTRUCTIVE: the current key stops working immediately; any encoder (OBS) configured with it can no longer connect and must be updated with the new one. Use it when the key may have leaked.\n\nSECURITY: `streamKey` is a secret that grants broadcasting rights on this stream in the organization's name. It is returned only here and by `POST /content/lives`; store it like a password.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was deleted or belongs to another workspace.\n- 502 `MUX_ERROR`: Mux rejected the request or is not configured; the old key keeps working.", "security": [ { "apiKey": [] @@ -21079,6 +20972,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -21098,16 +20992,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MasterQrActive" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -21117,7 +21001,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MasterQrActive" + "$ref": "#/components/schemas/ContentLiveStreamKey" } }, "required": [ @@ -21166,18 +21050,28 @@ } } } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } } } }, - "/merch/discount-codes/preview": { - "post": { - "operationId": "postMerchDiscountCodesPreview", + "/content/lives/{id}/chat": { + "get": { + "operationId": "getContentLivesIdChat", "tags": [ - "merch" + "content" ], - "summary": "Preview what a merch discount code takes off", - "description": "Requires an enterprise service API key AND a valid `X-Customer-Session`. Creates no order, consumes no use of the code and reserves no stock, so the answer is not a guarantee. It is not read-only: like the catalog and order creation, it first releases this store's expired reservations, cancelling those orders and returning their stock and code uses. It validates the code and computes the amounts for THIS store only (a code of another store does not exist here): 422 `DISCOUNT_INVALID`, 409 `DISCOUNT_EXHAUSTED`, 409 `DISCOUNT_CUSTOMER_LIMIT`, 422 `DISCOUNT_TOTAL_ZERO`, and 409 `VARIANT_UNAVAILABLE` for variants that are not on sale here. It does NOT check product rules (`membersOnly`, `maxPerCustomer`, `maxPerOrder`) or stock: `POST /merch/orders` validates those, and the code again, when the order is created. A live PENDING order of the customer that a new order would replace does not count against the code. The response has no field for the code's type, value or uses, although a client can derive the discount from the amounts. Rate limited: 30 previews/min per customer and 10 failed codes per 10 minutes per customer and per `X-Buyer-Ip`, shared with `POST /merch/orders` (429 `RATE_LIMITED`).", + "summary": "Chat history of a live stream", + "description": "Minimum role: `STAFF`. Active workspace via the `X-Workspace-Id` header. Same history as \"View chat\" in the dashboard, for a stream on air or already ended: oldest to newest, capped (`truncated: true` when the oldest messages were cut). Contains buyers' display names and messages: treat it as personal data.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `NOT_FOUND`: the stream does not exist, was deleted or belongs to another workspace.", "security": [ { "apiKey": [] @@ -21188,43 +21082,23 @@ ], "parameters": [ { - "name": "X-Workspace-Id", - "in": "header", - "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", - "schema": { - "type": "string" - } - }, - { - "name": "X-Buyer-Ip", - "in": "header", - "required": false, - "description": "Optional IPv4/IPv6 of the end buyer, forwarded by the landing server-to-server. Invalid values are ignored.", + "name": "id", + "in": "path", + "required": true, "schema": { "type": "string" } }, { - "name": "X-Customer-Session", + "name": "X-Workspace-Id", "in": "header", "required": false, - "description": "REQUIRED buyer session token (401 without it).", + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", "schema": { "type": "string" } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MerchDiscountPreview" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -21234,7 +21108,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MerchDiscountPreviewResult" + "$ref": "#/components/schemas/ContentLiveChat" } }, "required": [ @@ -21244,18 +21118,8 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { - "description": "Operation error.", + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -21265,7 +21129,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -21275,17 +21139,7 @@ } }, "404": { - "description": "Operation error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -21295,47 +21149,26 @@ } }, "422": { - "description": "Operation error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } } } } } }, - "/merch/orders": { - "post": { - "operationId": "postMerchOrders", + "/website": { + "get": { + "operationId": "getWebsite", "tags": [ - "merch" + "website" ], - "summary": "Create a merch order and reserve its stock", - "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the buyer email is the session's (it is NOT sent in the body) and the order is always linked to that customer. The order belongs to the key's organization store (variant ids from another store respond 409 `VARIANT_UNAVAILABLE`). Creates a PENDING order and reserves the stock for 15 minutes, all-or-nothing: if any variant lacks units nothing is reserved (409 `OUT_OF_STOCK` with `details: [{ variantId, requested, available }]`). Prices, shipping and totals are computed server-side from the catalog (`total = subtotal - discountAmount + shippingFee`; shipping is 0 for pickup or above the free-shipping threshold). `maxPerOrder` is per product, adding all its variants (422 `MAX_PER_ORDER`). A product may also cap the units per person across ALL their orders that are not cancelled or refunded, matching by email or customer, and by buyer document or phone only on orders that are no longer PENDING; a cancelled order whose charge can still appear also counts (422 `MAX_PER_CUSTOMER` with `details: { productIds }`). On those products a customer can use at most 2 distinct documents in the store (422 `TOO_MANY_DOCUMENTS`). The document must be digits for CC, TI and NIT; separators and leading zeros are ignored when comparing; a delivery mode that is disabled, or an inactive pickup point, responds 422 `DELIVERY_UNAVAILABLE`. DANE codes are validated by shape (department 2 digits, city 5 digits starting with the department). Accepts `Idempotency-Key` (unique per store): retrying with the same key returns the order created on the first attempt (201 with `Idempotent-Replay: true`) without reserving stock again; the replay is only returned to the same customer as the original order (otherwise 422 `IDEMPOTENCY_KEY_REUSED`). A customer with a live PENDING order in the store who places another one REPLACES it (the previous order is cancelled and its stock returned in the same transaction), unless that order already has a payment attempt in flight (409 `ACTIVE_ORDER_EXISTS`). A live PENDING order of ANOTHER customer with the same phone (normalized to E.164, any country code) also responds 409 `ACTIVE_ORDER_EXISTS` (the existing order is never revealed). Optional `X-Buyer-Ip` (the buyer's IPv4/IPv6, sent by the landing server-to-server; invalid values are ignored): at most 10 orders per 10 minutes per store and IP (429 `RATE_LIMITED`). Rate limited: 5 orders/min per customer (429 `RATE_LIMITED` with `Retry-After`). Optional `discountCode`, validated server-side against THIS store only (a code of another store, or of the ticketing checkout, does not exist here): it applies to the products, never to shipping, and the free-shipping threshold is evaluated BEFORE the discount. Unknown, inactive or out-of-dates code: 422 `DISCOUNT_INVALID`; no uses left: 409 `DISCOUNT_EXHAUSTED`; this customer already used it as many times as the code allows: 409 `DISCOUNT_CUSTOMER_LIMIT`; a code that would leave the total at 0: 422 `DISCOUNT_TOTAL_ZERO`. Nothing is reserved on any of those. A rejection for the code leaves the previous PENDING order of the customer alive. The use returns to the code if the order expires unpaid or the customer replaces it with another order; it does NOT return on a refund. 10 failed codes per 10 minutes per customer and per `X-Buyer-Ip` respond 429 `RATE_LIMITED`. `POST /merch/discount-codes/preview` shows the result without creating the order. A product marked `membersOnly` in the catalog can only be ordered by a buyer with an active membership in the store's organization (403 `MEMBERS_ONLY` with `details: { productIds }`); a guest has no session and gets the 401 above. 403 `MERCH_STORE_LOCKED` without an active Legend plan; 404 `STORE_NOT_READY` without a ready store (no onboarding or no connected MercadoPago account). `mpPublicKey` is the public key of the brand's own MercadoPago account. The buyer document is never returned.", + "summary": "Get the workspace website configuration", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the dashboard's Website screen: landing texts, social links, accent color, template, section visibility/order, and the public listing state (`published`, `canPublish`, `profileListable`). `customLandingEnabled` says whether the plan allows `PUT /website`.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (workspace configuration is out of its scope).", "security": [ { "apiKey": [] @@ -21353,47 +21186,10 @@ "schema": { "type": "string" } - }, - { - "name": "Idempotency-Key", - "in": "header", - "required": false, - "description": "Client-chosen idempotency key (max. 255 characters). Retrying with the SAME key returns the order created by the first attempt instead of reserving stock again. Unique per store.", - "schema": { - "type": "string" - } - }, - { - "name": "X-Buyer-Ip", - "in": "header", - "required": false, - "description": "Optional IPv4/IPv6 of the end buyer, forwarded by the landing server-to-server. Invalid values are ignored. Limits 10 orders per 10 minutes per store and IP.", - "schema": { - "type": "string" - } - }, - { - "name": "X-Customer-Session", - "in": "header", - "required": false, - "description": "REQUIRED buyer session token (401 without it). Its customer is the buyer identity: email, rate limits, idempotency replay and ownership.", - "schema": { - "type": "string" - } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MerchOrderCreate" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -21401,7 +21197,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MerchOrder" + "$ref": "#/components/schemas/Website" } }, "required": [ @@ -21411,18 +21207,8 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { - "description": "Operation error.", + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -21432,7 +21218,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -21442,17 +21228,7 @@ } }, "404": { - "description": "Operation error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -21462,47 +21238,24 @@ } }, "422": { - "description": "Operation error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } } } } - } - }, - "/merch/products": { - "get": { - "operationId": "getMerchProducts", + }, + "put": { + "operationId": "putWebsite", "tags": [ - "merch" + "website" ], - "summary": "List the merch store's products (all statuses)", - "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` in the active workspace (`X-Workspace-Id`). The store is ALWAYS the one of the workspace's organization. Returns every non-deleted product, DRAFT and PUBLISHED, with its non-deleted variants (active or not), in display order. Prices are COP integers, VAT included; `stock` is the units available right now.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "summary": "Save the workspace website configuration", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Save\" in the dashboard's Website editor. FULL replacement: every field is required; `null` clears an optional text. Read `GET /website` first and send everything back. Shared columns: `name`, `bio`, `instagramUrl`, `tiktokUrl` and `youtubeUrl` are the same workspace columns that `PATCH /organization/profile` edits (`artist.name`, `artist.bio`, `social.*`) — a PUT with `null` here wipes them there too. An empty `name` is not accepted, and unlike the profile it is NOT mirrored to the brand. The profile photo and cover are NOT edited here (see `PATCH /organization`). Returns the saved configuration.\n\nErrors (`error.code`):\n- 403 `FEATURE_LOCKED`: the workspace plan does not include the custom landing.\n- 400 `INVALID_SECTIONS`: `webSections` is malformed.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -21522,6 +21275,16 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WebsiteUpdate" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -21531,10 +21294,7 @@ "type": "object", "properties": { "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/MerchAdminProduct" - } + "$ref": "#/components/schemas/Website" } }, "required": [ @@ -21544,6 +21304,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -21555,7 +21325,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -21565,7 +21335,7 @@ } }, "404": { - "description": "Operation error.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -21585,14 +21355,16 @@ } } } - }, - "post": { - "operationId": "postMerchProducts", + } + }, + "/website/published": { + "put": { + "operationId": "putWebsitePublished", "tags": [ - "merch" + "website" ], - "summary": "Create a merch product with its options and variants", - "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Same action as the dashboard's product creator: the product, its options and the FULL variant matrix are created in one transaction (all or nothing). The product is ALWAYS created as `DRAFT`; publish it with `PATCH /merch/products/{id}/status`. The variant labels are built by the server from the options. Photos: upload them first with `POST /merch/products/images/upload-url` and pass the `publicUrl`s in `imageUrls`, or set them afterwards with `PUT /merch/products/{id}/images`. Returns the created product.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a dashboard rule failed (variants that do not match the options, repeated SKU, `compareAtPrice` not greater than `price`, invalid slug or SKU characters…); `message` says which.\n- 409 `SLUG_TAKEN`: the slug already exists in the store.\n- 409 `SKU_TAKEN`: a SKU is already used by another product of the store.\n- 422 `INVALID_IMAGE_URL`: an image URL is not a photo uploaded for this organization.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "summary": "Publish or unpublish the public profile", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same switch as \"Appear in Artists\" in the dashboard: sets whether the organization's public page is listed. Available on every plan. Idempotent: send the desired state.\n\nErrors (`error.code`):\n- 409 `NO_ORGANIZATION`: the workspace has no umbrella organization.\n- 409 `NOT_PRIMARY_WORKSPACE`: only the organization's primary workspace can publish.\n- 409 `PROFILE_INCOMPLETE`: publishing needs the brand name and profile photo (unpublishing is always allowed).\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -21617,13 +21389,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MerchProductCreate" + "$ref": "#/components/schemas/WebsitePublished" } } } }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -21631,7 +21403,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MerchAdminProduct" + "$ref": "#/components/schemas/WebsitePublished" } }, "required": [ @@ -21641,16 +21413,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -21662,7 +21424,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -21672,7 +21434,7 @@ } }, "404": { - "description": "Operation error.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -21704,14 +21466,14 @@ } } }, - "/merch/products/{id}/status": { + "/organization": { "patch": { - "operationId": "patchMerchProductsIdStatus", + "operationId": "patchOrganization", "tags": [ - "merch" + "organization" ], - "summary": "Publish or unpublish a merch product", - "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Same rules as the dashboard: idempotent (setting the current status is a no-op 200); publishing requires the store onboarding to be complete, a connected MercadoPago account and at least one active variant. A PUBLISHED product shows up in `GET /merch/catalog`; `DRAFT` hides it (existing orders are kept).\n\nErrors (`error.code`):\n- 404 `PRODUCT_NOT_FOUND`: no such product in this store.\n- 409 `STORE_NOT_ONBOARDED`: finish the store setup in the dashboard before publishing.\n- 409 `STORE_PAYMENTS_NOT_CONNECTED`: connect the MercadoPago account in the dashboard (Tienda → Cobros) before publishing.\n- 409 `NO_ACTIVE_VARIANT`: the product has no active variant.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "summary": "Update the organization's public identity", + "description": "Minimum role: `ADMIN`, and the user must be OWNER/ADMIN of the umbrella organization of the active workspace (`X-Workspace-Id`). Same action as the identity card in the dashboard's organization settings: public name, profile photo and cover. Partial: absent fields keep their value; `null` clears an image. The name is mirrored to the primary workspace. The slug (public URL) cannot be changed here. Returns the organization.\n\nErrors (`error.code`):\n- 403 `ORG_ADMIN_REQUIRED`: the user is not OWNER/ADMIN of the organization.\n- 409 `NO_ORGANIZATION`: the workspace has no umbrella organization.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -21721,14 +21483,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -21744,7 +21498,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MerchProductStatusUpdate" + "$ref": "#/components/schemas/OrganizationUpdate" } } } @@ -21755,17 +21509,15 @@ "content": { "application/json": { "schema": { - "type": "object" - } - } - } - }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/Organization" + } + }, + "required": [ + "data" + ] } } } @@ -21781,7 +21533,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -21791,7 +21543,7 @@ } }, "404": { - "description": "Operation error.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -21823,14 +21575,14 @@ } } }, - "/merch/products/{id}/images": { - "put": { - "operationId": "putMerchProductsIdImages", + "/organization/analytics": { + "patch": { + "operationId": "patchOrganizationAnalytics", "tags": [ - "merch" + "organization" ], - "summary": "Set the ordered photos of a merch product", - "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Replaces the product's photos with `imageUrls` (in order; the first is the cover; max 10, no repeats). Each URL must be a `publicUrl` returned by `POST /merch/products/images/upload-url` for this organization, or one the product already has: the server never downloads an external URL. Photos removed from the list are deleted from storage. `[]` clears them.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: more than 10 photos, repeated or malformed URLs.\n- 404 `PRODUCT_NOT_FOUND`: no such product in this store.\n- 422 `INVALID_IMAGE_URL`: a URL is not a photo uploaded for this organization.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "summary": "Set the organization's GA4 property", + "description": "Minimum role: `ADMIN`, and the user must be OWNER/ADMIN of the umbrella organization of the active workspace (`X-Workspace-Id`). Same action as the analytics card in the dashboard's organization settings: the brand's own GA4 Measurement ID, added to the checkout of its events next to FreeTicket's. `null` (or an empty string) disconnects it.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: not a GA4 Measurement ID (G-XXXXXXXXXX).\n- 403 `ORG_ADMIN_REQUIRED`: the user is not OWNER/ADMIN of the organization.\n- 409 `NO_ORGANIZATION`: the workspace has no umbrella organization.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -21840,14 +21592,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -21863,7 +21607,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MerchProductImagesUpdate" + "$ref": "#/components/schemas/OrganizationAnalyticsUpdate" } } } @@ -21874,7 +21618,15 @@ "content": { "application/json": { "schema": { - "type": "object" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/OrganizationAnalytics" + } + }, + "required": [ + "data" + ] } } } @@ -21900,7 +21652,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -21910,7 +21662,17 @@ } }, "404": { - "description": "Operation error.", + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", "content": { "application/json": { "schema": { @@ -21932,14 +21694,14 @@ } } }, - "/merch/products/images/upload-url": { - "post": { - "operationId": "postMerchProductsImagesUploadUrl", + "/organization/profile": { + "get": { + "operationId": "getOrganizationProfile", "tags": [ - "merch" + "organization" ], - "summary": "Get a signed upload URL for a merch product photo", - "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Returns a single-use signed `uploadUrl` in the organization's merch folder and the photo's final `publicUrl`. Flow: call this, `PUT` the file bytes to `uploadUrl` with header `Content-Type: ` (no Authorization header), then pass `publicUrl` in `imageUrls` of `POST /merch/products` or `PUT /merch/products/{id}/images`. JPG, PNG or WebP, up to 6 MB. Rate limited to 30 URLs per 5 minutes per user (shared with the dashboard).\n\nErrors (`error.code`):\n- 429 `RATE_LIMITED`: too many uploads; retry after `Retry-After`.\n- 502 `UPLOAD_URL_FAILED`: storage did not sign the URL; retry.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "summary": "Get the workspace profile", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same data as the dashboard's Profile screen: artist/venue/organizer data, brand photo and cover (from the umbrella organization), contact and social links. Billing/plan data is not included.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -21959,18 +21721,8 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MerchImageUploadRequest" - } - } - } - }, "responses": { - "201": { + "200": { "description": "OK", "content": { "application/json": { @@ -21978,7 +21730,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MerchImageUpload" + "$ref": "#/components/schemas/OrganizationProfile" } }, "required": [ @@ -21988,16 +21740,6 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { "description": "Missing or invalid credential.", "content": { @@ -22009,7 +21751,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -22019,7 +21761,7 @@ } }, "404": { - "description": "Operation error.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -22037,49 +21779,16 @@ } } } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } - } - }, - "502": { - "description": "The external provider failed to complete the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } } } - } - }, - "/merch/orders/lookup": { - "post": { - "operationId": "postMerchOrdersLookup", + }, + "patch": { + "operationId": "patchOrganizationProfile", "tags": [ - "merch" + "organization" ], - "summary": "Look up one of the session buyer's merch orders by code", - "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it). Only orders of the key's organization store that belong to the session's customer are visible, found by the public `code` (e.g. `M-7K3Q9ZTA`, case-insensitive). An unknown code, a code from another brand and a code of another customer all respond the same 404 `ORDER_NOT_FOUND`. The buyer document is never returned. Rate limited: 10 lookups/min per key and code (429 `RATE_LIMITED` with `Retry-After`). Lookups keep working after the brand's Legend plan lapses (the order was already placed); 404 `STORE_NOT_READY` when the brand has no store.", + "summary": "Update the workspace profile", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same actions as the four cards of the dashboard's Profile screen, as optional sections: `artist` (name, slug, bio, type, country, timezone), `visual` (brand photo/cover, stored on the umbrella organization), `contact` and `social`. Partial: only the fields sent are written; absent fields keep their value and `null` clears an optional one. Sections are applied in order artist → visual → contact → social; if one fails, the earlier ones stay saved. Changing `artist.slug` changes the workspace's URLs. `visual` and `artist.name` write organization-level columns (the brand photo/cover and the brand name mirror), so they additionally require the user to be OWNER/ADMIN of the umbrella organization — checked before ANY section is written (stricter than the dashboard, same rule as `PATCH /organization`). Returns the updated profile.\n\nErrors (`error.code`):\n- 403 `ORG_ADMIN_REQUIRED`: `visual` or `artist.name` sent by a user who is not OWNER/ADMIN of the organization (nothing is written).\n- 409 `SLUG_TAKEN`: `artist.slug` is used by another workspace, including deleted ones (nothing is written).\n- 409 `ORG_NOT_INITIALIZED`: `visual` sent but the workspace has no umbrella organization (nothing is written).\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -22097,15 +21806,6 @@ "schema": { "type": "string" } - }, - { - "name": "X-Customer-Session", - "in": "header", - "required": false, - "description": "REQUIRED buyer session token (401 without it). Orders are scoped to its customer.", - "schema": { - "type": "string" - } } ], "requestBody": { @@ -22113,7 +21813,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/MerchOrderLookup" + "$ref": "#/components/schemas/OrganizationProfileUpdate" } } } @@ -22127,7 +21827,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MerchOrder" + "$ref": "#/components/schemas/OrganizationProfile" } }, "required": [ @@ -22137,18 +21837,8 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { - "description": "Operation error.", + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -22168,7 +21858,7 @@ } }, "404": { - "description": "Operation error.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -22177,8 +21867,8 @@ } } }, - "422": { - "description": "Request body/parameter validation failed.", + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", "content": { "application/json": { "schema": { @@ -22187,38 +21877,27 @@ } } }, - "429": { - "description": "Too many requests: rate limit exceeded.", + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } } } } } }, - "/merch/orders/{code}/payment/card": { - "post": { - "operationId": "postMerchOrdersCodePaymentCard", + "/ticket-templates": { + "get": { + "operationId": "getTicketTemplates", "tags": [ - "merch" + "ticket-templates" ], - "summary": "Charge a merch order with the Payment Brick token", - "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it). Only orders of the key's organization store that belong to the session's customer are reachable (an unknown code, a code from another brand and a code of another customer all respond the same 404 `ORDER_NOT_FOUND`). Receives the token the Payment Brick produced on the landing's domain and charges it through the MercadoPago Payments API with the brand's own MercadoPago account (FreeTicket's fee is retained per order), using the order total from the database (never one sent by the client); the optional `issuerId` the Brick returns is forwarded as is; the reservation is extended (capped at 45 minutes after creation) before the charge. Card only. `status` is `approved`, `pending` (normal: bank authentication or processing, also for an unrecognized MercadoPago status; confirmed later by webhook — poll `/merch/orders/lookup`) or `rejected` (business decline, reason in `message`; the order stays pending until its reservation expires, so the buyer can retry with another card) — all three return 200. Responds 409 `RESERVATION_EXPIRED` when the reservation lapsed (start a new order), 409 `ORDER_NOT_PAYABLE` when the order is no longer pending, 409 `PAYMENT_IN_PROGRESS` when another charge of the order is still in flight (pending bank authentication or processing, or a concurrent request with a different token): poll `/merch/orders/lookup` instead of charging another card — a definitively rejected charge never blocks a new attempt, and retrying with the SAME token is allowed (idempotent at MercadoPago), 409 `MERCH_PAYMENTS_UNAVAILABLE` when the brand's MercadoPago account cannot charge right now (its authorization was revoked or expired): nothing was charged and this is NOT a declined card — do not show a rejection, tell the buyer the store cannot take payments for the moment, 409 `PAYMENT_REFUNDED` when the card was approved after the reservation expired and the stock ran out (the amount is refunded automatically), 409 `PAYMENT_REFUND_PENDING` when that happened but the automatic refund was REJECTED (the brand's MercadoPago account could not return it): the buyer was charged and has NOT been refunded yet, so tell them to contact the brand's support with the order code (the message includes the brand's support contact) instead of saying it was refunded, 502 `PAYMENT_GATEWAY_ERROR` when MercadoPago did not answer or failed (timeout, network, 5xx): the payment may still confirm via webhook, so until it is resolved another card gets 409 `PAYMENT_IN_PROGRESS` — the block lifts when MercadoPago reports the charge rejected, or about 90 seconds later if MercadoPago has no record of it. 403 `MERCH_STORE_LOCKED` when the brand's Legend plan is not active; 404 `STORE_NOT_READY` when the brand has no store or no connected MercadoPago account. Limited to 10 attempts per minute per API key, customer and order code (429 with `Retry-After`).", + "summary": "List the ticket templates", + "description": "Minimum role: `VIEWER`. Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Ticket templates screen: reusable ticket-type definitions (price, capacity, member discount/gate, buyer form fields), ordered for display. Deleted templates are omitted.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (templates are workspace configuration).", "security": [ { "apiKey": [] @@ -22228,14 +21907,6 @@ } ], "parameters": [ - { - "name": "code", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -22244,27 +21915,8 @@ "schema": { "type": "string" } - }, - { - "name": "X-Customer-Session", - "in": "header", - "required": false, - "description": "REQUIRED buyer session token (401 without it). Orders are scoped to its customer.", - "schema": { - "type": "string" - } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MerchCardPayment" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -22274,7 +21926,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/MerchCardPaymentResult" + "type": "array", + "items": { + "$ref": "#/components/schemas/TicketTemplate" + } } }, "required": [ @@ -22284,18 +21939,8 @@ } } }, - "400": { - "description": "Bad request: malformed parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "401": { - "description": "Operation error.", + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -22305,7 +21950,7 @@ } }, "403": { - "description": "Operation error.", + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -22315,17 +21960,7 @@ } }, "404": { - "description": "Operation error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -22343,49 +21978,16 @@ } } } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } - } - }, - "502": { - "description": "The external provider failed to complete the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } } } - } - }, - "/sales/{id}/refund": { + }, "post": { - "operationId": "postSalesIdRefund", + "operationId": "postTicketTemplates", "tags": [ - "sales" + "ticket-templates" ], - "summary": "Refund a sale (moving the funds depends on the payment gateway)", - "description": "Marks the sale as REFUNDED and releases the associated numbered seats. IMPORTANT: whether the money goes back to the buyer depends on the payment gateway and the payment method used. Sales charged through MercadoPago are fully refunded against the MercadoPago API (stable idempotency key per sale, so retries never refund twice) and marked only once MercadoPago confirms. A 503 GATEWAY_REFUND_PENDING means MercadoPago did not answer clearly: the sale stays CONFIRMED and repeating the same call is safe. Sales charged through Wompi by CARD are voided against the payment gateway before being marked. In every other case this endpoint does NOT trigger the actual refund: the money is NOT returned automatically and a 200 only confirms the accounting status change. Those refunds must be handled separately in the payment gateway's dashboard. PARTIAL REFUND BY TICKET: send `items` with the ids of the sale items to refund (the `id` field of GET /sales/{id}/tickets). Each item refunds its prorated share of the sale total (by item subtotal; shares always add up to the exact total). The refunded tickets are invalidated at the door and their quota returns to stock; when no live item remains the sale becomes REFUNDED. Only MercadoPago (or uncharged / cash sales) support partial refunds: Wompi and Bold answer 409 GATEWAY_REFUND_NOT_SUPPORTED. Items already checked in answer 409 ITEM_ALREADY_CHECKED_IN — also for a FULL refund (no `items`, or all of them): a sale with any checked-in ticket is never refunded whole; refund the unused tickets by item; items from another sale answer 422 ITEM_NOT_IN_SALE; a refund already in flight over the same items answers 409 REFUND_IN_PROGRESS (retry exactly the same items). `block_seats: true` (also valid for a full refund) keeps the refunded numbered seats OUT of sale: seats.io moves them from booked straight to a blocked status, never through free. The `refund` object in the response reports the refunded amount and what happened to the seats. Wompi payment methods without API refunds (PSE, Nequi, Bancolombia transfer) respond 409: return the money in the Wompi dashboard and repeat the call with {\"acknowledge_manual\": true} to reflect the accounting status. A 502 means the gateway rejected the void and the sale remains CONFIRMED.", + "summary": "Create a ticket template", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New template\" in the dashboard. A SELECT field needs at least 2 options (422 otherwise).\n\nErrors (`error.code`):\n- 400 `INVALID_CURRENCY`: the currency is not one the checkout charges.\n- 400 `DISCOUNT_PLAN_INVALID`: `discount.planId` is not an active membership plan of this workspace.\n- 400 `MEMBERS_ONLY_PLAN_INVALID`: `membersOnlyPlanId` cannot gate this workspace's tickets.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -22395,14 +21997,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -22418,13 +22012,13 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SaleRefundRequest" + "$ref": "#/components/schemas/TicketTemplateCreate" } } } }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -22432,7 +22026,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/SaleRefundResult" + "$ref": "#/components/schemas/TicketTemplate" } }, "required": [ @@ -22442,8 +22036,8 @@ } } }, - "401": { - "description": "Missing or invalid credential.", + "400": { + "description": "Bad request: malformed parameters.", "content": { "application/json": { "schema": { @@ -22452,8 +22046,8 @@ } } }, - "403": { - "description": "Insufficient role or resource not accessible.", + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -22462,8 +22056,8 @@ } } }, - "404": { - "description": "Resource does not exist or is out of scope.", + "403": { + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -22472,8 +22066,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "404": { + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -22483,27 +22077,7 @@ } }, "422": { - "description": "Operation error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "502": { - "description": "The external provider failed to complete the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, - "503": { - "description": "Service unavailable: an external dependency is down or initialization failed.", + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -22515,14 +22089,14 @@ } } }, - "/sales/{id}/items/{itemId}/transfer": { - "post": { - "operationId": "postSalesIdItemsItemIdTransfer", + "/ticket-templates/{id}": { + "patch": { + "operationId": "patchTicketTemplatesId", "tags": [ - "sales" + "ticket-templates" ], - "summary": "Transfer one ticket of a sale to another person (destructive)", - "description": "DESTRUCTIVE: changes the ticket holder and voids the previous QR code (the ticket code is rotated and any installed Apple Wallet pass stops working). The new holder receives the ticket by email and the buyer is notified. Same rules as the dashboard and the buyer: the recipient must already have a verified FreeTicket buyer account (the holder name comes from that account), each ticket can be transferred only once (no staff override) and only until the show starts. 422 RECIPIENT_NOT_REGISTERED / SELF_TRANSFER: fix the recipient. 409 NOT_CONFIRMED, ALREADY_TRANSFERRED, CHECKED_IN, REFUNDED, ADDON, PRESALE_NOT_TRANSFERABLE, MULTI_QUANTITY, EVENT_STARTED or CONFLICT (the ticket changed in flight; re-read and retry). Not idempotent: a retry after success answers 409 ALREADY_TRANSFERRED. Minimum role: `ADMIN`.", + "summary": "Update a ticket template", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a template in the dashboard. Partial: only the fields sent are written; `null` clears an optional one (`discount: null` removes the member discount, `membersOnlyPlanId: null` opens it to everyone). `fields` replaces the whole buyer-form list when sent and is left intact when absent. Ticket types already created from the template are copies and do not change. A legacy currency outside the checkout list is accepted only if unchanged.\n\nErrors (`error.code`):\n- 400 `INVALID_CURRENCY`: the currency is not one the checkout charges.\n- 400 `DISCOUNT_PLAN_INVALID`: `discount.planId` is not an active membership plan of this workspace.\n- 400 `MEMBERS_ONLY_PLAN_INVALID`: `membersOnlyPlanId` cannot gate this workspace's tickets.\n- 404 `NOT_FOUND`: the template does not exist, is deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -22531,7 +22105,6 @@ "apiKeyHeader": [] } ], - "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -22541,14 +22114,6 @@ "type": "string" } }, - { - "name": "itemId", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -22564,7 +22129,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/SaleItemTransferRequest" + "$ref": "#/components/schemas/TicketTemplateUpdate" } } } @@ -22578,7 +22143,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/SaleItemTransfer" + "$ref": "#/components/schemas/TicketTemplate" } }, "required": [ @@ -22588,8 +22153,8 @@ } } }, - "401": { - "description": "Missing or invalid credential.", + "400": { + "description": "Bad request: malformed parameters.", "content": { "application/json": { "schema": { @@ -22598,8 +22163,8 @@ } } }, - "403": { - "description": "Insufficient role or resource not accessible.", + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -22608,8 +22173,8 @@ } } }, - "404": { - "description": "Resource does not exist or is out of scope.", + "403": { + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -22618,8 +22183,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "404": { + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -22639,16 +22204,14 @@ } } } - } - }, - "/sales/{id}/recipient": { - "patch": { - "operationId": "patchSalesIdRecipient", + }, + "delete": { + "operationId": "deleteTicketTemplatesId", "tags": [ - "sales" + "ticket-templates" ], - "summary": "Correct the recipient of a courtesy sale and resend its tickets", - "description": "DESTRUCTIVE when the email changes (previous QR codes are voided). Only for courtesy sales issued from the dashboard (confirmed, `is_courtesy`); any other sale answers 404. Updates the recipient's name and email and resends the tickets to the corrected address. When the email changes, the ticket codes of the non-transferred tickets are rotated, so the QR codes sent to the wrong address stop working (`ticketCodesRotated: true`). Minimum role: `ADMIN`.", + "summary": "Delete a ticket template", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a template in the dashboard.\n\nDESTRUCTIVE: the template is removed from the workspace (soft delete, there is no restore via API). Ticket types already created from it keep working.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the template does not exist, is already deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -22677,16 +22240,6 @@ } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CourtesyRecipientUpdate" - } - } - } - }, "responses": { "200": { "description": "OK", @@ -22696,7 +22249,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CourtesyRecipient" + "$ref": "#/components/schemas/WorkspaceConfigDeleted" } }, "required": [ @@ -22749,14 +22302,14 @@ } } }, - "/tickets/{ticketCode}/resend": { + "/ticket-templates/{id}/instantiate": { "post": { - "operationId": "postTicketsTicketCodeResend", + "operationId": "postTicketTemplatesIdInstantiate", "tags": [ - "tickets" + "ticket-templates" ], - "summary": "Resend the confirmation email with the ticket", - "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header.", + "summary": "Create a ticket type from a template", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"Use template\" in the dashboard: creates a ticket type on `eventDateId` copying the template (price, capacity, discount, members-only gate, buyer form). `name`, `price` and `capacity` override the template's. A discount or gate whose plan is no longer valid is dropped instead of failing. Keys restricted to events may use it only on dates of their events.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the template does not exist, is deleted or belongs to another workspace.\n- 404 `EVENT_DATE_NOT_FOUND`: the event date does not exist or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to events and the date's event is not one of them.\n- 400 `CAPACITY_REQUIRED`: the template has no capacity and `capacity` was not sent.\n- 400 `INVALID_CURRENCY`: the template's legacy currency is not one the checkout charges.", "security": [ { "apiKey": [] @@ -22767,7 +22320,7 @@ ], "parameters": [ { - "name": "ticketCode", + "name": "id", "in": "path", "required": true, "schema": { @@ -22784,8 +22337,18 @@ } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TicketTemplateInstantiate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -22793,7 +22356,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/ResendTicket" + "$ref": "#/components/schemas/TicketTemplateInstance" } }, "required": [ @@ -22803,8 +22366,8 @@ } } }, - "401": { - "description": "Missing or invalid credential.", + "400": { + "description": "Bad request: malformed parameters.", "content": { "application/json": { "schema": { @@ -22813,8 +22376,8 @@ } } }, - "403": { - "description": "Insufficient role or resource not accessible.", + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -22823,8 +22386,8 @@ } } }, - "404": { - "description": "Resource does not exist or is out of scope.", + "403": { + "description": "Insufficient role or resource not accessible.", "content": { "application/json": { "schema": { @@ -22833,8 +22396,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "404": { + "description": "Resource does not exist or is out of scope.", "content": { "application/json": { "schema": { @@ -22852,29 +22415,18 @@ } } } - }, - "502": { - "description": "The external provider failed to complete the operation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } } } } }, - "/customer/orders": { + "/master-qrs": { "get": { - "operationId": "getCustomerOrders", + "operationId": "getMasterQrs", "tags": [ - "customer", - "orders" + "master-qrs" ], - "summary": "The purchase the buyer left unfinished for this event date", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, results are additionally scoped to the workspace pinned to it; without a key, any of the buyer's own unfinished purchases is visible. Returns the PENDING sale whose inventory hold is STILL ALIVE that the buyer has for that event date —with its seats, its total and when it expires—, or `order: null` if there is none. This is what lets reloading the checkout, or coming back from signing in, RESUME the purchase instead of starting from scratch: the seats remain held in that person's name. If `paymentOpened` is true the payment is already open and `POST /customer/orders/{id}/payment` returns the SAME signed configuration; to discard it and pick other seats, use `POST /customer/orders/{id}/release`.", + "summary": "List the master box-office QR codes", + "description": "Minimum role: `ADMIN` (also for reading, like the dashboard). Active workspace via the `X-Workspace-Id` header. Same list as the dashboard's Box-office QR screen: live (not deleted) QR codes, newest first, with scan counters. `code` and `url` are SECRET: they are what the printed QR encodes and open the public sale flow; they cannot be rotated. Do not log or share them.\n\nErrors (`error.code`):\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events (org-wide QR codes span every show).", "security": [ { "apiKey": [] @@ -22884,15 +22436,6 @@ } ], "parameters": [ - { - "name": "eventDateId", - "in": "query", - "required": false, - "description": "Required. The event date being queried.", - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -22912,7 +22455,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CustomerOrderCurrent" + "type": "array", + "items": { + "$ref": "#/components/schemas/MasterQr" + } } }, "required": [ @@ -22953,7 +22499,7 @@ } }, "422": { - "description": "Operation error.", + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -22965,13 +22511,12 @@ } }, "post": { - "operationId": "postCustomerOrders", + "operationId": "postMasterQrs", "tags": [ - "customer", - "orders" + "master-qrs" ], - "summary": "Create the ticket reservation (step 1 of the headless purchase)", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL: with a key, the date and the ticket type must belong to the workspace pinned to it (anything else is 404); without a key, it is enough for the ticket type to exist and be on sale (same eligibility as the first-party checkout). Reserves inventory and creates the PENDING sale with the SAME rules as the first-party checkout (stock under lock, seats validated against seats.io, per-buyer limit, presale, memberships and virtual queue turn). The buyer email comes from the session, never from the body. Rejections carry a stable `reason` in `error.details.reason` (`sold_out`, `queue_turn_required`, `seats_not_held`, `members_only`, `members_only_withdrawn` — a members-only ticket whose artist withdrew the permission or left the lineup: it is no longer sold even to members —, …). With `pending_sale_in_progress` the inventory is taken by a half-paid purchase FROM THE SAME buyer: `error.details.pendingSaleId` and `pendingReference` identify it, and the right step is to reopen its payment with `POST /customer/orders/{pendingSaleId}/payment` (idempotent) instead of reserving again. If `free` is true the sale is already confirmed and `/payment` must NOT be called. Next step: `POST /customer/orders/{id}/payment`.", + "summary": "Create a master box-office QR code", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as \"New QR\" in the dashboard. `eventId` absent/null = org-wide QR (all shows); `ticketTypeId` pins a ticket type of that event (not allowed on an org-wide QR → 422). Returns the QR with its code. `code` and `url` are SECRET: they are what the printed QR encodes and open the public sale flow; they cannot be rotated. Do not log or share them.\n\nErrors (`error.code`):\n- 400 `INVALID_TARGET`: the event is not of this workspace, or the ticket type is not a visible ticket type of a sellable date of that event.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -22989,15 +22534,6 @@ "schema": { "type": "string" } - }, - { - "name": "X-Purchase-Session", - "in": "header", - "required": false, - "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", - "schema": { - "type": "string" - } } ], "requestBody": { @@ -23005,7 +22541,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerOrderCreateRequest" + "$ref": "#/components/schemas/MasterQrCreate" } } } @@ -23019,7 +22555,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CustomerOrderCreateResult" + "$ref": "#/components/schemas/MasterQr" } }, "required": [ @@ -23029,6 +22565,16 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { "description": "Missing or invalid credential.", "content": { @@ -23059,8 +22605,8 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -23068,9 +22614,76 @@ } } } + } + } + } + }, + "/master-qrs/{id}": { + "patch": { + "operationId": "patchMasterQrsId", + "tags": [ + "master-qrs" + ], + "summary": "Update a master box-office QR code", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as editing a QR in the dashboard. Partial: `label` and `mode` can be sent alone; the target (`eventId` + `ticketTypeId`, `null` for none / org-wide) must be sent as a pair (422 otherwise). The code does not change, so the printed QR keeps working and now points to the new target.\n\nErrors (`error.code`):\n- 400 `INVALID_TARGET`: the event is not of this workspace, or the ticket type does not belong to it.\n- 404 `NOT_FOUND`: the QR does not exist, is deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MasterQrUpdate" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MasterQr" + } + }, + "required": [ + "data" + ] + } + } + } }, - "422": { - "description": "Request body/parameter validation failed.", + "400": { + "description": "Bad request: malformed parameters.", "content": { "application/json": { "schema": { @@ -23079,29 +22692,38 @@ } } }, - "429": { - "description": "Too many requests: rate limit exceeded.", + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } } } }, - "503": { - "description": "Service unavailable: an external dependency is down or initialization failed.", + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", "content": { "application/json": { "schema": { @@ -23111,17 +22733,14 @@ } } } - } - }, - "/customer/orders/{id}/payment": { - "post": { - "operationId": "postCustomerOrdersIdPayment", + }, + "delete": { + "operationId": "deleteMasterQrsId", "tags": [ - "customer", - "orders" + "master-qrs" ], - "summary": "Open payment for a reservation (Bold or MercadoPago, depending on the event)", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). The payment rail is chosen on the SERVER: Bold-eligible events (legend plan + allowlist) return the SIGNED configuration of the embedded Bold Payment Button (`apiKey` + `renderMode: \"embedded\"` + `integritySignature`, …), which the landing page mounts with `new BoldCheckout({...})`; all others return `publicKey` + `amount` + `currency` + `reference` + `payerEmail` to mount the MercadoPago Payment Brick (`POST .../payment/card` to charge, `POST .../payment/pse` for PSE). The landing page tells the rails apart by the SHAPE of the response (`apiKey`/`renderMode` ⇒ Bold, `publicKey` ⇒ MercadoPago), never by a separate flag. The sale must belong to the session buyer (and, with a key, to the workspace pinned to it): anything else is 404. Responds 409 with code `PAYMENT_UNAVAILABLE` if the reservation expired, the sale is no longer pending, or (Bold only) the event has no legend plan or a payment attempt is already in flight with another gateway. `{id}` accepts the sale id or its `reference`. Limited to 10 opens per minute per buyer (429 with `Retry-After`).", + "summary": "Delete a master box-office QR code", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same action as deleting a QR in the dashboard.\n\nDESTRUCTIVE: the QR is deactivated and deleted (soft delete, the scan history is kept); the printed code stops working and cannot be restored via API. To pause it instead, use `PUT /master-qrs/{id}/active`.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the QR does not exist, is already deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -23130,6 +22749,7 @@ "apiKeyHeader": [] } ], + "x-ft-destructive": true, "parameters": [ { "name": "id", @@ -23147,15 +22767,6 @@ "schema": { "type": "string" } - }, - { - "name": "X-Purchase-Session", - "in": "header", - "required": false, - "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", - "schema": { - "type": "string" - } } ], "responses": { @@ -23167,7 +22778,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CustomerOrderStartPayment" + "$ref": "#/components/schemas/WorkspaceConfigDeleted" } }, "required": [ @@ -23207,16 +22818,6 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } - }, "422": { "description": "Request body/parameter validation failed.", "content": { @@ -23226,40 +22827,18 @@ } } } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } - } } } } }, - "/customer/orders/{id}/payment/card": { - "post": { - "operationId": "postCustomerOrdersIdPaymentCard", + "/master-qrs/{id}/active": { + "put": { + "operationId": "putMasterQrsIdActive", "tags": [ - "customer", - "orders" + "master-qrs" ], - "summary": "Charge with the MercadoPago Payment Brick token", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). Receives the token the Payment Brick produced on the landing page's domain and charges through the Orders API using the sale amount (never one sent by the client); `payer.email` travels in the body but is ignored — the payer is ALWAYS the sale's. `status` is `approved`, `pending` (normal, may require additional authentication from the bank) or `rejected` (business decline; the reason is in `message`) — all three are returned with 200. With `rejected`, `saleAlive` tells what happened to the purchase: `false` = it was cancelled and a new one must be started; `true` = this payment was declined but the purchase is still pending because another payment is in progress on it (do not start a new purchase: wait and check the order). Responds 409 with code `PAYMENT_UNAVAILABLE` if the reservation expired, the sale is no longer pending, a payment attempt is in flight with another gateway, the event only charges through Bold, or MercadoPago returned an error that cannot be classified as a decline. The sale must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. `{id}` accepts the sale id or its `reference`. Limited to 10 attempts per minute per buyer (429 with `Retry-After`).", + "summary": "Activate or deactivate a master box-office QR code", + "description": "Minimum role: `ADMIN`. Active workspace via the `X-Workspace-Id` header. Same switch as in the dashboard's QR table. While inactive, scanning the QR answers 404. Idempotent: send the desired state.\n\nErrors (`error.code`):\n- 404 `NOT_FOUND`: the QR does not exist, is deleted or belongs to another workspace.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.", "security": [ { "apiKey": [] @@ -23285,15 +22864,6 @@ "schema": { "type": "string" } - }, - { - "name": "X-Purchase-Session", - "in": "header", - "required": false, - "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", - "schema": { - "type": "string" - } } ], "requestBody": { @@ -23301,7 +22871,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/CustomerOrderMercadoPagoChargeRequest" + "$ref": "#/components/schemas/MasterQrActive" } } } @@ -23315,7 +22885,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CustomerOrderMercadoPagoChargeResult" + "$ref": "#/components/schemas/MasterQrActive" } }, "required": [ @@ -23355,8 +22925,76 @@ } } }, - "409": { - "description": "Conflict: the resource does not allow this operation in its current state.", + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/merch/catalog": { + "get": { + "operationId": "getMerchCatalog", + "tags": [ + "merch" + ], + "summary": "Merch store catalog of the key's brand", + "description": "Requires an enterprise service API key (Legend headless landing, called server-side); the store is ALWAYS the one of the key's organization. Returns the store settings (brand, support, shipping fees by zone — Bogotá is DANE 11001 —, free-shipping threshold, delivery modes), the PUBLISHED products with their active variants and `stock` (units available right now, already net of open 15-minute reservations), the active pickup points (only when pickup is enabled) and the public key of the brand's own MercadoPago account for the Payment Brick. Prices are COP integers, VAT included; the buyer pays no service fee. Preview: with a valid `X-Merch-Preview` token (issued by the dashboard for this key's store, 1 hour) the response also includes DRAFT products (each product carries `status`), answers even while the store onboarding is pending, sets `preview: true` and `Cache-Control: private, no-store`; an invalid or expired token silently returns the public catalog. Preview never enables ordering: `POST /merch/orders` only sells PUBLISHED products. 403 `MERCH_STORE_LOCKED` when the brand's Legend plan is not active; 404 `STORE_NOT_READY` when the brand has no store, its onboarding is incomplete or it has no connected MercadoPago account (a valid preview token is exempt). `mpPublicKey` is the public key of the brand's own MercadoPago account.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Merch-Preview", + "in": "header", + "required": false, + "description": "Optional preview token from the dashboard's 'Vista previa' link (`ft_preview` query param on the landing). Valid for this key's store: includes DRAFT products, no caching. Invalid or expired: ignored.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MerchCatalog" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", "content": { "application/json": { "schema": { @@ -23365,7 +23003,7 @@ } } }, - "422": { + "403": { "description": "Operation error.", "content": { "application/json": { @@ -23375,39 +23013,37 @@ } } }, - "429": { - "description": "Too many requests: rate limit exceeded.", + "404": { + "description": "Operation error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } } } } } } }, - "/customer/orders/{id}/payment/pse": { + "/merch/discount-codes/preview": { "post": { - "operationId": "postCustomerOrdersIdPaymentPse", + "operationId": "postMerchDiscountCodesPreview", "tags": [ - "customer", - "orders" + "merch" ], - "summary": "Open a PSE payment through MercadoPago (redirect)", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). Creates a MercadoPago preference restricted to PSE and returns `redirectUrl` (`init_point`): the landing page must REDIRECT the browser there, not mount it in an iframe. The buyer picks their bank and confirms the transfer inside MercadoPago; on return, they land on `GET /api/mp/return` (our domain), which issues a 302 to the `returnUrl` sent in `POST /customer/orders` — the landing page must call `GET /customer/orders/{id}` for the authoritative status, never infer it from the return URL. The sale is confirmed by webhook when the bank settles the payment (asynchronous: it may take a while). Responds 409 with code `PAYMENT_UNAVAILABLE` if the reservation expired, the sale is no longer pending, a payment attempt is in flight with another gateway, or the event only charges through Bold. The sale must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. `{id}` accepts the sale id or its `reference`. Limited to 10 opens per minute per buyer (429 with `Retry-After`).", + "summary": "Preview what a merch discount code takes off", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session`. Creates no order, consumes no use of the code and reserves no stock, so the answer is not a guarantee. It is not read-only: like the catalog and order creation, it first releases this store's expired reservations, cancelling those orders and returning their stock and code uses. It validates the code and computes the amounts for THIS store only (a code of another store does not exist here): 422 `DISCOUNT_INVALID`, 409 `DISCOUNT_EXHAUSTED`, 409 `DISCOUNT_CUSTOMER_LIMIT`, 422 `DISCOUNT_TOTAL_ZERO`, and 409 `VARIANT_UNAVAILABLE` for variants that are not on sale here. It does NOT check product rules (`membersOnly`, `maxPerCustomer`, `maxPerOrder`) or stock: `POST /merch/orders` validates those, and the code again, when the order is created. A live PENDING order of the customer that a new order would replace does not count against the code. The response has no field for the code's type, value or uses, although a client can derive the discount from the amounts. Rate limited: 30 previews/min per customer and 10 failed codes per 10 minutes per customer and per `X-Buyer-Ip`, shared with `POST /merch/orders` (429 `RATE_LIMITED`).", "security": [ { "apiKey": [] @@ -23418,32 +23054,43 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", "schema": { "type": "string" } }, { - "name": "X-Workspace-Id", + "name": "X-Buyer-Ip", "in": "header", "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "description": "Optional IPv4/IPv6 of the end buyer, forwarded by the landing server-to-server. Invalid values are ignored.", "schema": { "type": "string" } }, { - "name": "X-Purchase-Session", + "name": "X-Customer-Session", "in": "header", "required": false, - "description": "Purchase session id (`POST /customer/purchase-sessions`). Required when the event's workspace enforces a single purchase session; if present, it is always validated. The requirement is decided by the EVENT, not the API key: it applies if the owning workspace, a linked artist or a catalog seller of the show has the flag, with or without a key. Rejections (409; uppercase `error.code` and the slug in `error.details.reason`): `PURCHASE_SESSION_REQUIRED` (missing, or belongs to another buyer or another event date), `PURCHASE_SESSION_SUPERSEDED` (another tab or device replaced it), `PURCHASE_SESSION_EXPIRED` (the map clock ran out before the order was created), `PURCHASE_SESSION_BUSY` (an order is already in flight with this session) and, on `POST /customer/orders` with seats, `HOLD_TOKEN_MISMATCH` (the `holdToken` is not the session's, or belongs to a replaced session or another buyer even if the header is absent). Payment POSTs accept the buyer's live session or the session that created THAT order, as long as no other session has been opened since. Rejecting a new payment NEVER affects a payment already in flight.", + "description": "REQUIRED buyer session token (401 without it).", "schema": { "type": "string" } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchDiscountPreview" + } + } + } + }, "responses": { "200": { "description": "OK", @@ -23453,7 +23100,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CustomerOrderMercadoPagoPse" + "$ref": "#/components/schemas/MerchDiscountPreviewResult" } }, "required": [ @@ -23463,8 +23110,18 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { - "description": "Missing or invalid credential.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23474,7 +23131,7 @@ } }, "403": { - "description": "Insufficient role or resource not accessible.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23484,7 +23141,7 @@ } }, "404": { - "description": "Resource does not exist or is out of scope.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23504,7 +23161,7 @@ } }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23537,15 +23194,14 @@ } } }, - "/customer/orders/{id}/release": { + "/merch/orders": { "post": { - "operationId": "postCustomerOrdersIdRelease", + "operationId": "postMerchOrders", "tags": [ - "customer", - "orders" + "merch" ], - "summary": "Release a reservation the buyer will not pay for", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). Abandons the PENDING sale and returns its inventory (and its seats) to stock, so the buyer can start over without waiting for the reservation to expire. It is the counterpart of `pending_sale_in_progress`: when `POST /customer/orders` rejects with that `reason`, the landing page can offer *continue paying* (`/payment`, idempotent) or *start over* (this route). It ONLY releases with evidence that nobody started the payment: if Bold reports any transaction, if a provider response is already stored, or if the payment goes through a rail we cannot query, it responds 409 with `details.reason` = `payment_in_flight` and the sale is left intact. If the gateway does not respond, 503 (`gateway_unreachable`): retry later. The sale must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. `{id}` accepts the sale id or its `reference`. Limited to 10 calls per minute per buyer.", + "summary": "Create a merch order and reserve its stock", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the buyer email is the session's (it is NOT sent in the body) and the order is always linked to that customer. The order belongs to the key's organization store (variant ids from another store respond 409 `VARIANT_UNAVAILABLE`). Creates a PENDING order and reserves the stock for 15 minutes, all-or-nothing: if any variant lacks units nothing is reserved (409 `OUT_OF_STOCK` with `details: [{ variantId, requested, available }]`). Prices, shipping and totals are computed server-side from the catalog (`total = subtotal - discountAmount + shippingFee`; shipping is 0 for pickup or above the free-shipping threshold). `maxPerOrder` is per product, adding all its variants (422 `MAX_PER_ORDER`). A product may also cap the units per person across ALL their orders that are not cancelled or refunded, matching by email or customer, and by buyer document or phone only on orders that are no longer PENDING; a cancelled order whose charge can still appear also counts (422 `MAX_PER_CUSTOMER` with `details: { productIds }`). On those products a customer can use at most 2 distinct documents in the store (422 `TOO_MANY_DOCUMENTS`). The document must be digits for CC, TI and NIT; separators and leading zeros are ignored when comparing; a delivery mode that is disabled, or an inactive pickup point, responds 422 `DELIVERY_UNAVAILABLE`. DANE codes are validated by shape (department 2 digits, city 5 digits starting with the department). Accepts `Idempotency-Key` (unique per store): retrying with the same key returns the order created on the first attempt (201 with `Idempotent-Replay: true`) without reserving stock again; the replay is only returned to the same customer as the original order (otherwise 422 `IDEMPOTENCY_KEY_REUSED`). A customer with a live PENDING order in the store who places another one REPLACES it (the previous order is cancelled and its stock returned in the same transaction), unless that order already has a payment attempt in flight (409 `ACTIVE_ORDER_EXISTS`). A live PENDING order of ANOTHER customer with the same phone (normalized to E.164, any country code) also responds 409 `ACTIVE_ORDER_EXISTS` (the existing order is never revealed). Optional `X-Buyer-Ip` (the buyer's IPv4/IPv6, sent by the landing server-to-server; invalid values are ignored): at most 10 orders per 10 minutes per store and IP (429 `RATE_LIMITED`). Rate limited: 5 orders/min per customer (429 `RATE_LIMITED` with `Retry-After`). Optional `discountCode`, validated server-side against THIS store only (a code of another store, or of the ticketing checkout, does not exist here): it applies to the products, never to shipping, and the free-shipping threshold is evaluated BEFORE the discount. Unknown, inactive or out-of-dates code: 422 `DISCOUNT_INVALID`; no uses left: 409 `DISCOUNT_EXHAUSTED`; this customer already used it as many times as the code allows: 409 `DISCOUNT_CUSTOMER_LIMIT`; a code that would leave the total at 0: 422 `DISCOUNT_TOTAL_ZERO`. Nothing is reserved on any of those. A rejection for the code leaves the previous PENDING order of the customer alive. The use returns to the code if the order expires unpaid or the customer replaces it with another order; it does NOT return on a refund. 10 failed codes per 10 minutes per customer and per `X-Buyer-Ip` respond 429 `RATE_LIMITED`. `POST /merch/discount-codes/preview` shows the result without creating the order. A product marked `membersOnly` in the catalog can only be ordered by a buyer with an active membership in the store's organization (403 `MEMBERS_ONLY` with `details: { productIds }`); a guest has no session and gets the 401 above. 403 `MERCH_STORE_LOCKED` without an active Legend plan; 404 `STORE_NOT_READY` without a ready store (no onboarding or no connected MercadoPago account). `mpPublicKey` is the public key of the brand's own MercadoPago account. The buyer document is never returned.", "security": [ { "apiKey": [] @@ -23556,25 +23212,54 @@ ], "parameters": [ { - "name": "id", - "in": "path", - "required": true, + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", "schema": { "type": "string" } }, { - "name": "X-Workspace-Id", + "name": "Idempotency-Key", "in": "header", "required": false, - "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "description": "Client-chosen idempotency key (max. 255 characters). Retrying with the SAME key returns the order created by the first attempt instead of reserving stock again. Unique per store.", + "schema": { + "type": "string" + } + }, + { + "name": "X-Buyer-Ip", + "in": "header", + "required": false, + "description": "Optional IPv4/IPv6 of the end buyer, forwarded by the landing server-to-server. Invalid values are ignored. Limits 10 orders per 10 minutes per store and IP.", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "REQUIRED buyer session token (401 without it). Its customer is the buyer identity: email, rate limits, idempotency replay and ownership.", "schema": { "type": "string" } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchOrderCreate" + } + } + } + }, "responses": { - "200": { + "201": { "description": "OK", "content": { "application/json": { @@ -23582,7 +23267,7 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CustomerOrderRelease" + "$ref": "#/components/schemas/MerchOrder" } }, "required": [ @@ -23592,8 +23277,18 @@ } } }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, "401": { - "description": "Missing or invalid credential.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23603,7 +23298,7 @@ } }, "403": { - "description": "Insufficient role or resource not accessible.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23613,7 +23308,7 @@ } }, "404": { - "description": "Resource does not exist or is out of scope.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23633,7 +23328,7 @@ } }, "422": { - "description": "Request body/parameter validation failed.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23662,29 +23357,18 @@ "$ref": "#/components/headers/RateLimitPolicy" } } - }, - "503": { - "description": "Service unavailable: an external dependency is down or initialization failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - } } } } }, - "/customer/orders/{id}": { + "/merch/products": { "get": { - "operationId": "getCustomerOrdersId", + "operationId": "getMerchProducts", "tags": [ - "customer", - "orders" + "merch" ], - "summary": "Status of a headless purchase (and its tickets, once paid)", - "description": "Requires the `X-Customer-Session` header. The enterprise service API key is OPTIONAL (with a key, results are additionally scoped to the workspace pinned to it). `{id}` accepts the `reference` (FT-…) or the sale id. If the sale is still PENDING and its payment goes through Bold, the authoritative payment status is re-read from Bold; between re-reads it responds with the internal status, which the webhook keeps up to date. `status` is `approved`, `pending` or `rejected`; `pending` is a NORMAL state (asynchronous payment methods take time) and the landing page must retry. `tickets` —with each ticket's `ticketCode`— is only present when `status` is `approved`. The purchase must belong to the session's buyer (and, with a key, to the workspace pinned to it): anything else is 404. The route MAY rate-limit polling and respond 429: honor `Retry-After` and apply backoff. Polling every ~2 s fits comfortably, but do not treat any threshold as a guarantee.", + "summary": "List the merch store's products (all statuses)", + "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` in the active workspace (`X-Workspace-Id`). The store is ALWAYS the one of the workspace's organization. Returns every non-deleted product, DRAFT and PUBLISHED, with its non-deleted variants (active or not), in display order. Prices are COP integers, VAT included; `stock` is the units available right now.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", "security": [ { "apiKey": [] @@ -23694,14 +23378,6 @@ } ], "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, { "name": "X-Workspace-Id", "in": "header", @@ -23721,7 +23397,10 @@ "type": "object", "properties": { "data": { - "$ref": "#/components/schemas/CustomerOrderStatus" + "type": "array", + "items": { + "$ref": "#/components/schemas/MerchAdminProduct" + } } }, "required": [ @@ -23742,7 +23421,7 @@ } }, "403": { - "description": "Insufficient role or resource not accessible.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23752,7 +23431,7 @@ } }, "404": { - "description": "Resource does not exist or is out of scope.", + "description": "Operation error.", "content": { "application/json": { "schema": { @@ -23770,317 +23449,3786 @@ } } } - }, - "429": { - "description": "Too many requests: rate limit exceeded.", + } + } + }, + "post": { + "operationId": "postMerchProducts", + "tags": [ + "merch" + ], + "summary": "Create a merch product with its options and variants", + "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Same action as the dashboard's product creator: the product, its options and the FULL variant matrix are created in one transaction (all or nothing). The product is ALWAYS created as `DRAFT`; publish it with `PATCH /merch/products/{id}/status`. The variant labels are built by the server from the options. Photos: upload them first with `POST /merch/products/images/upload-url` and pass the `publicUrl`s in `imageUrls`, or set them afterwards with `PUT /merch/products/{id}/images`. Returns the created product.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: a dashboard rule failed (variants that do not match the options, repeated SKU, `compareAtPrice` not greater than `price`, invalid slug or SKU characters…); `message` says which.\n- 409 `SLUG_TAKEN`: the slug already exists in the store.\n- 409 `SKU_TAKEN`: a SKU is already used by another product of the store.\n- 422 `INVALID_IMAGE_URL`: an image URL is not a photo uploaded for this organization.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchProductCreate" + } + } + } + }, + "responses": { + "201": { + "description": "OK", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Error" + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MerchAdminProduct" + } + }, + "required": [ + "data" + ] } } - }, - "headers": { - "Retry-After": { - "$ref": "#/components/headers/RetryAfter" - }, - "RateLimit": { - "$ref": "#/components/headers/RateLimit" - }, - "RateLimit-Policy": { - "$ref": "#/components/headers/RateLimitPolicy" - } } - } - } - } - } - }, - "components": { - "schemas": { - "Error": { - "type": "object", - "properties": { - "error": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "retryable": { - "type": "boolean" - }, - "details": {} - }, - "required": [ - "code", - "message", - "retryable" - ], - "additionalProperties": false - } - }, - "required": [ - "error" - ], - "additionalProperties": false - }, - "Warning": { - "type": "object", - "properties": { - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "field": { - "type": "string" }, - "activeWorkspaceId": { - "type": "string" + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "activeWorkspaceName": { - "type": "string" + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "accessibleWorkspaces": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "403": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "suggestedWorkspaceId": { - "type": "string" + "404": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "suggestedWorkspaceName": { - "type": "string" + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "ids": { - "type": "array", - "items": { - "type": "string" + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } } } - }, - "required": [ - "code", - "message" + } + } + }, + "/merch/products/{id}/status": { + "patch": { + "operationId": "patchMerchProductsIdStatus", + "tags": [ + "merch" ], - "additionalProperties": false - }, - "Page": { - "type": "object", - "properties": { - "nextCursor": { - "type": [ - "string", - "null" - ] - }, - "hasMore": { - "type": "boolean" + "summary": "Publish or unpublish a merch product", + "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Same rules as the dashboard: idempotent (setting the current status is a no-op 200); publishing requires the store onboarding to be complete, a connected MercadoPago account and at least one active variant. A PUBLISHED product shows up in `GET /merch/catalog`; `DRAFT` hides it (existing orders are kept).\n\nErrors (`error.code`):\n- 404 `PRODUCT_NOT_FOUND`: no such product in this store.\n- 409 `STORE_NOT_ONBOARDED`: finish the store setup in the dashboard before publishing.\n- 409 `STORE_PAYMENTS_NOT_CONNECTED`: connect the MercadoPago account in the dashboard (Tienda → Cobros) before publishing.\n- 409 `NO_ACTIVE_VARIANT`: the product has no active variant.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "security": [ + { + "apiKey": [] }, - "total": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + { + "apiKeyHeader": [] } - }, - "required": [ - "nextCursor", - "hasMore" ], - "additionalProperties": false - }, - "Workspace": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } }, - "slug": { - "type": "string" + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } } - }, - "required": [ - "id", - "name", - "slug" ], - "additionalProperties": false - }, - "WorkspaceAccess": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "role": { - "type": "string", - "enum": [ - "SUPER_ADMIN", - "ADMIN", - "STAFF", - "VIEWER", - "MINCULTURA", - "MERCH_MANAGER" - ], - "description": "The user's effective role IN THIS workspace." - }, - "sections": { - "anyOf": [ - { - "type": "array", - "items": { - "type": "string" - } - }, - { - "type": "null" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchProductStatusUpdate" } - ], - "description": "Enabled sections (slugs). null = unrestricted; [] = access expired or revoked." + } } }, - "required": [ - "id", - "name", - "slug", - "role", - "sections" - ], - "additionalProperties": false - }, - "Me": { - "type": "object", - "properties": { - "userId": { - "type": "string" + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } }, - "name": { - "type": "string" + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "email": { - "type": "string" + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "role": { - "type": "string", - "enum": [ - "SUPER_ADMIN", - "ADMIN", - "STAFF", - "VIEWER", - "MINCULTURA", - "MERCH_MANAGER" - ], - "description": "DEPRECATED: effective role in the ACTIVE workspace. Use the `role` of each `workspaces` row instead. Kept for compatibility with already-published clients." + "403": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "activeWorkspaceId": { - "type": [ - "string", - "null" - ] + "404": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } }, - "workspaces": { - "type": "array", - "items": { - "$ref": "#/components/schemas/WorkspaceAccess" + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } } }, - "scope": { - "type": "string", - "enum": [ - "read", - "write" - ], - "description": "Scope of the API key in use. `read` = only GET/HEAD; any mutating method answers 403." + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } } - }, - "required": [ - "userId", - "name", - "email", - "role", - "activeWorkspaceId", - "workspaces", - "scope" + } + } + }, + "/merch/products/{id}/images": { + "put": { + "operationId": "putMerchProductsIdImages", + "tags": [ + "merch" ], - "additionalProperties": false - }, - "SignupRequest": { - "type": "object", - "properties": { - "email": { - "type": "string", - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" - }, - "name": { - "type": "string", - "minLength": 2, - "maxLength": 120 + "summary": "Set the ordered photos of a merch product", + "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Replaces the product's photos with `imageUrls` (in order; the first is the cover; max 10, no repeats). Each URL must be a `publicUrl` returned by `POST /merch/products/images/upload-url` for this organization, or one the product already has: the server never downloads an external URL. Photos removed from the list are deleted from storage. `[]` clears them.\n\nErrors (`error.code`):\n- 400 `BAD_REQUEST`: more than 10 photos, repeated or malformed URLs.\n- 404 `PRODUCT_NOT_FOUND`: no such product in this store.\n- 422 `INVALID_IMAGE_URL`: a URL is not a photo uploaded for this organization.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "security": [ + { + "apiKey": [] }, - "workspaceName": { - "type": "string", - "minLength": 2, - "maxLength": 80 + { + "apiKeyHeader": [] } - }, - "required": [ - "email", - "name" ], - "additionalProperties": false - }, - "SignupResponse": { - "type": "object", - "properties": { - "user_id": { - "type": "string" - }, - "status": { - "type": "string", - "const": "pending_verification" + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } }, - "verification_sent_to": { - "type": "string" + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } } - }, - "required": [ - "user_id", - "status", - "verification_sent_to" ], - "additionalProperties": false - }, - "WorkspaceCreate": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 2, - "maxLength": 80 - }, - "slug": { - "type": "string", - "minLength": 2, - "maxLength": 50, - "pattern": "^[a-z0-9-]+$" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchProductImagesUpdate" + } + } } }, - "required": [ - "name", + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/merch/products/images/upload-url": { + "post": { + "operationId": "postMerchProductsImagesUploadUrl", + "tags": [ + "merch" + ], + "summary": "Get a signed upload URL for a merch product photo", + "description": "Roles: `ADMIN`, `SUPER_ADMIN` or `MERCH_MANAGER` (write key). Returns a single-use signed `uploadUrl` in the organization's merch folder and the photo's final `publicUrl`. Flow: call this, `PUT` the file bytes to `uploadUrl` with header `Content-Type: ` (no Authorization header), then pass `publicUrl` in `imageUrls` of `POST /merch/products` or `PUT /merch/products/{id}/images`. JPG, PNG or WebP, up to 6 MB. Rate limited to 30 URLs per 5 minutes per user (shared with the dashboard).\n\nErrors (`error.code`):\n- 429 `RATE_LIMITED`: too many uploads; retry after `Retry-After`.\n- 502 `UPLOAD_URL_FAILED`: storage did not sign the URL; retry.\n- 400 `BAD_REQUEST`: the body is not valid JSON (endpoints with a body).\n- 403 `FORBIDDEN`: the key's role cannot manage the store catalog (allowed: `ADMIN`, `SUPER_ADMIN`, `MERCH_MANAGER`).\n- 403 `MERCH_STORE_LOCKED`: the brand's settlement workspace has no active Legend plan.\n- 403 `EVENT_SCOPE_FORBIDDEN`: the key is restricted to specific events.\n- 404 `STORE_NOT_FOUND`: the workspace's organization has no merch store yet (it is created from the dashboard).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchImageUploadRequest" + } + } + } + }, + "responses": { + "201": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MerchImageUpload" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/merch/orders/lookup": { + "post": { + "operationId": "postMerchOrdersLookup", + "tags": [ + "merch" + ], + "summary": "Look up one of the session buyer's merch orders by code", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it). Only orders of the key's organization store that belong to the session's customer are visible, found by the public `code` (e.g. `M-7K3Q9ZTA`, case-insensitive). An unknown code, a code from another brand and a code of another customer all respond the same 404 `ORDER_NOT_FOUND`. The buyer document is never returned. Rate limited: 10 lookups/min per key and code (429 `RATE_LIMITED` with `Retry-After`). Lookups keep working after the brand's Legend plan lapses (the order was already placed); 404 `STORE_NOT_READY` when the brand has no store.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "REQUIRED buyer session token (401 without it). Orders are scoped to its customer.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchOrderLookup" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MerchOrder" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + } + } + } + }, + "/merch/orders/{code}/payment/card": { + "post": { + "operationId": "postMerchOrdersCodePaymentCard", + "tags": [ + "merch" + ], + "summary": "Charge a merch order with the Payment Brick token", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it). Only orders of the key's organization store that belong to the session's customer are reachable (an unknown code, a code from another brand and a code of another customer all respond the same 404 `ORDER_NOT_FOUND`). Receives the token the Payment Brick produced on the landing's domain and charges it through the MercadoPago Payments API with the brand's own MercadoPago account (FreeTicket's fee is retained per order), using the order total from the database (never one sent by the client); the optional `issuerId` the Brick returns is forwarded as is; the reservation is extended (capped at 45 minutes after creation) before the charge. Card only. `status` is `approved`, `pending` (normal: bank authentication or processing, also for an unrecognized MercadoPago status; confirmed later by webhook — poll `/merch/orders/lookup`) or `rejected` (business decline, reason in `message`; the order stays pending until its reservation expires, so the buyer can retry with another card) — all three return 200. Responds 409 `RESERVATION_EXPIRED` when the reservation lapsed (start a new order), 409 `ORDER_NOT_PAYABLE` when the order is no longer pending, 409 `PAYMENT_IN_PROGRESS` when another charge of the order is still in flight (pending bank authentication or processing, or a concurrent request with a different token): poll `/merch/orders/lookup` instead of charging another card — a definitively rejected charge never blocks a new attempt, and retrying with the SAME token is allowed (idempotent at MercadoPago), 409 `MERCH_PAYMENTS_UNAVAILABLE` when the brand's MercadoPago account cannot charge right now (its authorization was revoked or expired): nothing was charged and this is NOT a declined card — do not show a rejection, tell the buyer the store cannot take payments for the moment, 409 `PAYMENT_REFUNDED` when the card was approved after the reservation expired and the stock ran out (the amount is refunded automatically), 409 `PAYMENT_REFUND_PENDING` when that happened but the automatic refund was REJECTED (the brand's MercadoPago account could not return it): the buyer was charged and has NOT been refunded yet, so tell them to contact the brand's support with the order code (the message includes the brand's support contact) instead of saying it was refunded, 502 `PAYMENT_GATEWAY_ERROR` when MercadoPago did not answer or failed (timeout, network, 5xx): the payment may still confirm via webhook, so until it is resolved another card gets 409 `PAYMENT_IN_PROGRESS` — the block lifts when MercadoPago reports the charge rejected, or about 90 seconds later if MercadoPago has no record of it. 403 `MERCH_STORE_LOCKED` when the brand's Legend plan is not active; 404 `STORE_NOT_READY` when the brand has no store or no connected MercadoPago account. Limited to 10 attempts per minute per API key, customer and order code (429 with `Retry-After`).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "code", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "REQUIRED buyer session token (401 without it). Orders are scoped to its customer.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MerchCardPayment" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/MerchCardPaymentResult" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "400": { + "description": "Bad request: malformed parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "401": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Operation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/feed": { + "get": { + "operationId": "getCustomerCommunityFeed", + "tags": [ + "customer" + ], + "summary": "Community feed for a buyer", + "description": "Requires an enterprise service API key; the organization comes from the key. The `X-Customer-Session` header is OPTIONAL: without it, with an unknown or expired token, or when the buyer has no current membership in the key's organization, the redacted version is returned. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After` (retry; it does not mean the session ended). Rate limited: 1200 requests/min per key and 120/min per buyer and key, shared across `/customer/community/*` (429 `RATE_LIMITED` with `Retry-After`). Every response, errors included, is `Cache-Control: private, no-store`. Posts of the organization, newest first, with a stable opaque cursor (`page.nextCursor` → `?cursor=`; an invalid or empty cursor responds 422 `INVALID_CURSOR`). A current member also gets approved member posts when the community is enabled for the organization; other readers only get the organization's posts, with members-only ones redacted (`locked: true`). `pinned` says the post is pinned, with the same meaning as in the permalink; where the community is enabled, the pinned post additionally comes FIRST on the first page, on top of `limit` (that page may carry `limit + 1` items), and is not repeated in its chronological place on later pages. `channel` filters by a channel slug from `GET /customer/community/channels` (unknown, archived, or community not enabled: 404). Never returns drafts, posts pending review, deleted posts or posts scheduled for the future. Comments are paginated at `GET /customer/community/posts/{id}/comments`.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "cursor", + "in": "query", + "required": false, + "description": "Opaque `page.nextCursor` from the previous page.", + "schema": { + "type": "string" + } + }, + { + "name": "channel", + "in": "query", + "required": false, + "description": "Channel slug. Omit for all channels.", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Page size, 1-50.", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "OPTIONAL buyer session token. Unlocks members-only content and the buyer's own state when the buyer has a current membership.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerCommunityPost" + } + }, + "page": { + "$ref": "#/components/schemas/Page" + } + }, + "required": [ + "data", + "page" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/posts/{id}": { + "get": { + "operationId": "getCustomerCommunityPostsId", + "tags": [ + "customer" + ], + "summary": "Community post permalink", + "description": "Requires an enterprise service API key; the organization comes from the key. The `X-Customer-Session` header is OPTIONAL: without it, with an unknown or expired token, or when the buyer has no current membership in the key's organization, the redacted version is returned. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After` (retry; it does not mean the session ended). Rate limited: 1200 requests/min per key and 120/min per buyer and key, shared across `/customer/community/*` (429 `RATE_LIMITED` with `Retry-After`). Every response, errors included, is `Cache-Control: private, no-store`. `{id}` is the post id or, for an ARTICLE, its `slug`. Same redaction as the feed, plus `body` (the article in Markdown), which is null when `locked`. 404 for a post of another organization, a draft, a post pending review, a deleted post, one scheduled for the future, or a member post read without a current membership.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "OPTIONAL buyer session token. Unlocks members-only content and the buyer's own state when the buyer has a current membership.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityPostDetail" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/posts/{id}/comments": { + "get": { + "operationId": "getCustomerCommunityPostsIdComments", + "tags": [ + "customer" + ], + "summary": "Visible comments of a community post", + "description": "Requires an enterprise service API key; the organization comes from the key. The `X-Customer-Session` header is OPTIONAL: without it, with an unknown or expired token, or when the buyer has no current membership in the key's organization, the redacted version is returned. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After` (retry; it does not mean the session ended). Rate limited: 1200 requests/min per key and 120/min per buyer and key, shared across `/customer/community/*` (429 `RATE_LIMITED` with `Retry-After`). Every response, errors included, is `Cache-Control: private, no-store`. Flat list, oldest first, with `parentId` for replies (one level): a parent always comes before its replies, so threads can be built while paginating (`page.nextCursor` → `?cursor=`; an invalid or empty cursor responds 422 `INVALID_CURSOR`). Only visible comments: deleted ones, ones hidden by moderation and replies to a hidden comment are never returned. Authors are exposed by public alias and avatar only. `{id}` accepts what `GET /customer/community/posts/{id}` accepts, with the same 404 cases; a post that is `locked` for the reader responds 403 `MEMBERSHIP_REQUIRED`.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "description": "Opaque `page.nextCursor` from the previous page.", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Page size, 1-50.", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "OPTIONAL buyer session token. Unlocks members-only content and the buyer's own state when the buyer has a current membership.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerCommunityComment" + } + }, + "page": { + "$ref": "#/components/schemas/Page" + } + }, + "required": [ + "data", + "page" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "post": { + "operationId": "postCustomerCommunityPostsIdComments", + "tags": [ + "customer" + ], + "summary": "Comment on a community post", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. Creates a comment, or a reply when `parentId` is sent (one level of threading: the parent must be a visible top-level comment of the SAME post; 404 `PARENT_NOT_FOUND` if it does not exist, belongs to another post (of this or another organization), was deleted or is hidden, 422 `INVALID_PARENT` if it is itself a reply). `{id}` accepts what `GET /customer/community/posts/{id}` accepts, with the same 404 cases. Interacting follows the portal's rule: 403 `BANNED` for a buyer expelled from this community; on a members-only post or a member's post, 403 `MEMBERSHIP_REQUIRED` without a current membership. A member's post read from outside the community does not exist (404), like in the reads. Responds 201 with the created comment. With an `Idempotency-Key`, a retry with the SAME `body` and `parentId` responds 200 with the comment created by the first attempt instead of creating another one. 409 `IDEMPOTENCY_KEY_REUSED` if the key was used with a different `body` or `parentId` (the key binds the whole request), or if that comment was deleted or hidden by moderation since. Database limit: 8 comments per minute per buyer. The comment text is never logged.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + }, + { + "name": "Idempotency-Key", + "in": "header", + "required": false, + "description": "Client-chosen idempotency key (max. 255 characters). Retrying with the SAME key and the SAME body, by the same buyer on the same post, returns the comment created by the first attempt instead of creating another one; a different body with the same key is 409.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerCommunityCommentCreate" + } + } + } + }, + "responses": { + "200": { + "description": "Idempotent replay: the comment created by the first attempt with the same Idempotency-Key.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityComment" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "201": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityComment" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/channels": { + "get": { + "operationId": "getCustomerCommunityChannels", + "tags": [ + "customer" + ], + "summary": "Community channels for a buyer", + "description": "Requires an enterprise service API key; the organization comes from the key. The `X-Customer-Session` header is OPTIONAL: without it, with an unknown or expired token, or when the buyer has no current membership in the key's organization, the redacted version is returned. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After` (retry; it does not mean the session ended). Rate limited: 1200 requests/min per key and 120/min per buyer and key, shared across `/customer/community/*` (429 `RATE_LIMITED` with `Retry-After`). Every response, errors included, is `Cache-Control: private, no-store`. Active channels of the organization's community, Announcements first; with a buyer session, the channel of the buyer's city comes right after. Read-only: unlike `GET /content/channels`, it never creates the default channels, so an organization that has not opened its community yet returns an empty list. Pass a channel `slug` as `?channel=` to `GET /customer/community/feed`.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "OPTIONAL buyer session token. Unlocks members-only content and the buyer's own state when the buyer has a current membership.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CommunityChannel" + } + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/meetups": { + "get": { + "operationId": "getCustomerCommunityMeetups", + "tags": [ + "customer" + ], + "summary": "Upcoming community meetups for a buyer", + "description": "Requires an enterprise service API key; the organization comes from the key. The `X-Customer-Session` header is OPTIONAL: without it, with an unknown or expired token, or when the buyer has no current membership in the key's organization, the redacted version is returned. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After` (retry; it does not mean the session ended). Rate limited: 1200 requests/min per key and 120/min per buyer and key, shared across `/customer/community/*` (429 `RATE_LIMITED` with `Retry-After`). Every response, errors included, is `Cache-Control: private, no-store`. PUBLISHED meetups that have not ended (upcoming or in progress), soonest first; drafts and cancelled meetups are never listed. Without a current membership the meetup is a teaser (`locked: true`): only `id`, `title`, `format`, `status`, `startsAt`, `endsAt`, `timeZone` and `isClosed` are real; `description`, `city`, `locationName`, `capacity`, `goingCount`, `myRsvp`, `locationDetail` and `onlineUrl` are null and `isFull` / `requiresApproval` are false. `locationDetail` and `onlineUrl` are only returned to a current member whose own RSVP is `GOING` (and never to a banned buyer). When the community is not enabled for the organization the list is empty and the detail responds 404.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "limit", + "in": "query", + "required": false, + "description": "Maximum meetups, 1-50.", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "OPTIONAL buyer session token. Unlocks members-only content and the buyer's own state when the buyer has a current membership.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerCommunityMeetup" + } + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/meetups/{id}": { + "get": { + "operationId": "getCustomerCommunityMeetupsId", + "tags": [ + "customer" + ], + "summary": "Community meetup for a buyer", + "description": "Requires an enterprise service API key; the organization comes from the key. The `X-Customer-Session` header is OPTIONAL: without it, with an unknown or expired token, or when the buyer has no current membership in the key's organization, the redacted version is returned. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After` (retry; it does not mean the session ended). Rate limited: 1200 requests/min per key and 120/min per buyer and key, shared across `/customer/community/*` (429 `RATE_LIMITED` with `Retry-After`). Every response, errors included, is `Cache-Control: private, no-store`. A PUBLISHED or CANCELLED meetup of the key's organization (a cancelled or past one still resolves, with `status` and `isClosed` saying so). 404 for a draft or a meetup of another organization. Without a current membership the meetup is a teaser (`locked: true`): only `id`, `title`, `format`, `status`, `startsAt`, `endsAt`, `timeZone` and `isClosed` are real; `description`, `city`, `locationName`, `capacity`, `goingCount`, `myRsvp`, `locationDetail` and `onlineUrl` are null and `isFull` / `requiresApproval` are false. `locationDetail` and `onlineUrl` are only returned to a current member whose own RSVP is `GOING` (and never to a banned buyer). When the community is not enabled for the organization the list is empty and the detail responds 404.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "OPTIONAL buyer session token. Unlocks members-only content and the buyer's own state when the buyer has a current membership.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityMeetup" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/me": { + "get": { + "operationId": "getCustomerCommunityMe", + "tags": [ + "customer" + ], + "summary": "Buyer's state in the community", + "description": "Requires an enterprise service API key; the organization comes from the key. The `X-Customer-Session` header is OPTIONAL: without it, with an unknown or expired token, or when the buyer has no current membership in the key's organization, the redacted version is returned. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After` (retry; it does not mean the session ended). Rate limited: 1200 requests/min per key and 120/min per buyer and key, shared across `/customer/community/*` (429 `RATE_LIMITED` with `Retry-After`). Every response, errors included, is `Cache-Control: private, no-store`. Without a valid buyer session it responds 200 with every flag false (never 401). A banned buyer keeps reading as before (`member` does not change) but `canInteract` is false. Reacting to or commenting on a members-only post additionally requires `member`.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": false, + "description": "OPTIONAL buyer session token. Unlocks members-only content and the buyer's own state when the buyer has a current membership.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityMe" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/posts/{id}/reactions": { + "post": { + "operationId": "postCustomerCommunityPostsIdReactions", + "tags": [ + "customer" + ], + "summary": "React to a community post", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. No request body. Puts the buyer's reaction on the post and returns `{ reacted: true }`. Idempotent: repeating it changes nothing (one reaction per buyer and post). The reaction count is never returned. Interacting follows the portal's rule: 403 `BANNED` for a buyer expelled from this community; on a members-only post or a member's post, 403 `MEMBERSHIP_REQUIRED` without a current membership. A member's post read from outside the community does not exist (404), like in the reads. Database limit: 30 new reactions per minute per buyer.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityReaction" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteCustomerCommunityPostsIdReactions", + "tags": [ + "customer" + ], + "summary": "Remove the buyer's reaction from a community post", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. No request body. Removes the buyer's reaction and returns `{ reacted: false }`. Idempotent: without a reaction it is a no-op. Removing one's own reaction is always allowed, also for a banned buyer or one whose membership ended (like cancelling an RSVP): it only requires the post to exist for this reader in the key's organization (404 otherwise, same cases as `GET /customer/community/posts/{id}`).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityReaction" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/posts/{id}/report": { + "post": { + "operationId": "postCustomerCommunityPostsIdReport", + "tags": [ + "customer" + ], + "summary": "Report another member's community post", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. Only member posts can be reported (a post published by the organization responds 404, and so does everything when member posts are not enabled). Idempotent per (post, buyer): reporting again responds 200 with `duplicate: true` and counts nothing. 409 `OWN_CONTENT` for the buyer's own post. Interacting follows the portal's rule: 403 `BANNED` for a buyer expelled from this community; on a members-only post or a member's post, 403 `MEMBERSHIP_REQUIRED` without a current membership. A member's post read from outside the community does not exist (404), like in the reads. Database limit: 20 reports per hour per buyer. The reason and detail are stored for the community's moderation queue and never logged.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + }, + { + "name": "Idempotency-Key", + "in": "header", + "required": false, + "description": "Optional (max. 255 characters; longer responds 422). This operation is idempotent by itself: one report per buyer and target, so a retry returns `duplicate: true` with or without the key.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerCommunityReportCreate" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityReport" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/comments/{id}": { + "delete": { + "operationId": "deleteCustomerCommunityCommentsId", + "tags": [ + "customer" + ], + "summary": "Delete the buyer's own community comment", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. Soft-deletes the buyer's own comment; deleting a top-level comment also removes its live replies (`deletedIds`). 404 for someone else's comment (the API does not confirm it exists), and for a comment already deleted, hidden by moderation or of another organization. 409 `UNDER_REVIEW` while the comment, or any of the replies it would take with it, has open reports (the community's team is reviewing it); nothing is deleted. A banned buyer or one without a current membership can still delete their own comments.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "x-ft-destructive": true, + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityCommentDeleted" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/comments/{id}/report": { + "post": { + "operationId": "postCustomerCommunityCommentsIdReport", + "tags": [ + "customer" + ], + "summary": "Report a community comment", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. Idempotent per (comment, buyer): reporting again responds 200 with `duplicate: true` and counts nothing. 404 for a comment that is deleted, hidden by moderation, of another organization, on a post the buyer cannot read, or when the community is not enabled. 409 `OWN_CONTENT` for the buyer's own comment. Interacting follows the portal's rule: 403 `BANNED` for a buyer expelled from this community; on a members-only post or a member's post, 403 `MEMBERSHIP_REQUIRED` without a current membership. A member's post read from outside the community does not exist (404), like in the reads. Database limit: 20 reports per hour per buyer. The reason and detail are stored for the community's moderation queue and never logged.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + }, + { + "name": "Idempotency-Key", + "in": "header", + "required": false, + "description": "Optional (max. 255 characters; longer responds 422). This operation is idempotent by itself: one report per buyer and target, so a retry returns `duplicate: true` with or without the key.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerCommunityReportCreate" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityReport" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/community/meetups/{id}/rsvp": { + "post": { + "operationId": "postCustomerCommunityMeetupsIdRsvp", + "tags": [ + "customer" + ], + "summary": "RSVP to a community meetup", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. Confirms the buyer's attendance and returns the updated meetup (same shape as `GET /customer/community/meetups/{id}`): `myRsvp` is `GOING`, or `PENDING` when the meetup requires approval (the organization's team decides). Requires a CURRENT MEMBERSHIP in the key's organization: 403 `MEMBERSHIP_REQUIRED` otherwise (the community's creator without a membership cannot RSVP either) and 403 `BANNED` for an expelled buyer. 409 `MEETUP_FULL` when there are no seats left, 409 `MEETUP_CLOSED` when it already started or was cancelled, 409 `RSVP_DECLINED` when the team declined this buyer's request. 404 for a draft, a meetup of another organization or when the community is not enabled. Naturally idempotent (one RSVP per buyer and meetup): repeating it returns the same state without taking another seat. Database limit: RSVPs on 10 different meetups per minute per buyer (repeating a current RSVP never counts).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + }, + { + "name": "Idempotency-Key", + "in": "header", + "required": false, + "description": "Optional (max. 255 characters; longer responds 422). This operation is idempotent by itself: one RSVP per buyer and meetup, so a retry returns the same state with or without the key.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityMeetup" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + }, + "delete": { + "operationId": "deleteCustomerCommunityMeetupsIdRsvp", + "tags": [ + "customer" + ], + "summary": "Cancel the buyer's RSVP to a community meetup", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session, never from the body. Verified email is not required (same as the portal). If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. Rate limited (429 `RATE_LIMITED` with `Retry-After`): the limits of `/customer/community/*` plus 30 writes/min per buyer and key, and a per-buyer limit stored in the database for each action. Every response is `Cache-Control: private, no-store`. Anything of another organization responds 404. Cancels the buyer's attendance (freeing the seat) or withdraws a pending request, and returns the updated meetup. Does NOT require a current membership and is allowed for a banned buyer: giving up one's own seat is never a privilege (without a current membership the returned meetup is the teaser). Repeating it is a no-op. 409 `MEETUP_CLOSED` once the meetup started. 404 for a draft, a meetup of another organization or when the community is not enabled.", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerCommunityMeetup" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/lives/{id}/chat": { + "get": { + "operationId": "getCustomerLivesIdChat", + "tags": [ + "customer" + ], + "summary": "Recent chat messages of a live stream", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. A live stream of another organization (or deleted) responds 404. Every response, errors included, is `Cache-Control: private, no-store`. Audience: whoever can watch the live reads the chat — a current membership in the organization, the community's creator or, for a live tied to a show date, a CONFIRMED ticket for that date. Otherwise 403 `MEMBERSHIP_REQUIRED`, even when the live itself is public. Writing additionally requires not being banned from the community and the live being on air (`ACTIVE`). Returns the latest `limit` messages (default 100, max 200), oldest first, with the same shape as the Realtime `chat` event, so the backlog and the live channel merge by `id` (order: `sentAt`, then `id`). Authors are exposed only by a per-live pseudonym (`authorId`) and their display name. A banned buyer still reads. Rate limited: 600 requests/min per key and 30/min per buyer and key (429 `RATE_LIMITED` with `Retry-After`).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "description": "Number of messages, 1-200.", + "schema": { + "type": "integer", + "default": 100 + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerLiveChatBacklog" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/lives/{id}/chat/token": { + "post": { + "operationId": "postCustomerLivesIdChatToken", + "tags": [ + "customer" + ], + "summary": "Read-only Realtime token for a live stream's chat", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. A live stream of another organization (or deleted) responds 404. Every response, errors included, is `Cache-Control: private, no-store`. Audience: whoever can watch the live reads the chat — a current membership in the organization, the community's creator or, for a live tied to a show date, a CONFIRMED ticket for that date. Otherwise 403 `MEMBERSHIP_REQUIRED`, even when the live itself is public. Writing additionally requires not being banned from the community and the live being on air (`ACTIVE`). Returns a short-lived JWT to subscribe the browser directly to the private Supabase Realtime channel `topic` (`live:`, Broadcast event `chat` with a `CustomerLiveChatMessage` payload, plus Presence) using `realtime.url` and `realtime.apiKey`. The token is READ-ONLY for the chat: it does not write in the channel and does not identify the buyer (no chat identity, no customer id). Post through `POST /customer/lives/{id}/chat/messages` from your server. `canWrite` / `writeBlockedReason` tell whether the buyer may post now (`BANNED`, or `LIVE_NOT_ACTIVE` when the live is not on air); a banned buyer still reads. Lifetime: 30 minutes when access comes from a ticket for the show date, 60 minutes with a membership (`expiresAt` is the token's own `exp`). `me.authorId` is the buyer's pseudonym in this live, the same `authorId` as the buyer's own messages. 503 `REALTIME_DISABLED` when Realtime is not configured. Rate limited: 600 requests/min per key and 10/min per buyer and key (429 `RATE_LIMITED` with `Retry-After`).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerLiveChatToken" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + }, + "/customer/lives/{id}/chat/messages": { + "post": { + "operationId": "postCustomerLivesIdChatMessages", + "tags": [ + "customer" + ], + "summary": "Post a message in a live stream's chat", + "description": "Requires an enterprise service API key AND a valid `X-Customer-Session` (401 without it); the organization comes from the key and the buyer from the session. If the session cannot be verified right now it responds 503 `SESSION_UNAVAILABLE` with `Retry-After`. A live stream of another organization (or deleted) responds 404. Every response, errors included, is `Cache-Control: private, no-store`. Audience: whoever can watch the live reads the chat — a current membership in the organization, the community's creator or, for a live tied to a show date, a CONFIRMED ticket for that date. Otherwise 403 `MEMBERSHIP_REQUIRED`, even when the live itself is public. Writing additionally requires not being banned from the community and the live being on air (`ACTIVE`). Call it from your server (BFF), never from the browser. Access, ban and the live being on air are re-checked on EVERY message: 403 `MEMBERSHIP_REQUIRED` without access, 403 `BANNED` for a buyer expelled from the community, 409 `LIVE_NOT_ACTIVE` when the live is not on air. The text is collapsed to one line and must be 1-280 characters (422 `EMPTY` / `TOO_LONG`). The author's name and pseudonym come from the session, never from the body. Responds 201 with the message, which every subscriber of the Realtime channel (the sender included) also receives as the `chat` event. If the broadcast fails nothing is stored: 502 `SEND_FAILED` (retry with the same key). 503 `CHAT_DISABLED` when the chat is not configured. Rate limited (429 `RATE_LIMITED` with `Retry-After`): one message per second per buyer and live, 20/min per buyer and key, and 1200/min per key (provisional value, may change once real live traffic is measured).", + "security": [ + { + "apiKey": [] + }, + { + "apiKeyHeader": [] + } + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "X-Workspace-Id", + "in": "header", + "required": false, + "description": "Active workspace to operate on. Optional: when omitted, the default workspace of the user who owns the key is used (pickActiveOrg).", + "schema": { + "type": "string" + } + }, + { + "name": "X-Customer-Session", + "in": "header", + "required": true, + "description": "REQUIRED buyer session token (401 without it).", + "schema": { + "type": "string" + } + }, + { + "name": "Idempotency-Key", + "in": "header", + "required": true, + "description": "REQUIRED (max. 255 characters; missing responds 422 `IDEMPOTENCY_KEY_REQUIRED`). The message id is derived from the organization, the buyer, the live, this key and the normalized `text`: a retry with the SAME key and the SAME text yields the SAME message id, so subscribers and the history never see it twice. The same key with a DIFFERENT text is a different message (a new id), never a replay of the first. Use a new key for each new message.", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CustomerLiveChatMessageCreate" + } + } + } + }, + "responses": { + "201": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CustomerLiveChatMessageCreated" + } + }, + "required": [ + "data" + ] + } + } + } + }, + "401": { + "description": "Missing or invalid credential.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "403": { + "description": "Insufficient role or resource not accessible.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "404": { + "description": "Resource does not exist or is out of scope.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "409": { + "description": "Conflict: the resource does not allow this operation in its current state.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "422": { + "description": "Request body/parameter validation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "429": { + "description": "Too many requests: rate limit exceeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "headers": { + "Retry-After": { + "$ref": "#/components/headers/RetryAfter" + }, + "RateLimit": { + "$ref": "#/components/headers/RateLimit" + }, + "RateLimit-Policy": { + "$ref": "#/components/headers/RateLimitPolicy" + } + } + }, + "502": { + "description": "The external provider failed to complete the operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + }, + "503": { + "description": "Service unavailable: an external dependency is down or initialization failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Error": { + "type": "object", + "properties": { + "error": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "retryable": { + "type": "boolean" + }, + "details": {} + }, + "required": [ + "code", + "message", + "retryable" + ], + "additionalProperties": false + } + }, + "required": [ + "error" + ], + "additionalProperties": false + }, + "Warning": { + "type": "object", + "properties": { + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "field": { + "type": "string" + }, + "activeWorkspaceId": { + "type": "string" + }, + "activeWorkspaceName": { + "type": "string" + }, + "accessibleWorkspaces": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "suggestedWorkspaceId": { + "type": "string" + }, + "suggestedWorkspaceName": { + "type": "string" + }, + "ids": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "code", + "message" + ], + "additionalProperties": false + }, + "Page": { + "type": "object", + "properties": { + "nextCursor": { + "type": [ + "string", + "null" + ] + }, + "hasMore": { + "type": "boolean" + }, + "total": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "nextCursor", + "hasMore" + ], + "additionalProperties": false + }, + "Workspace": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "slug" + ], + "additionalProperties": false + }, + "WorkspaceAccess": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "SUPER_ADMIN", + "ADMIN", + "STAFF", + "VIEWER", + "MINCULTURA", + "MERCH_MANAGER" + ], + "description": "The user's effective role IN THIS workspace." + }, + "sections": { + "anyOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "null" + } + ], + "description": "Enabled sections (slugs). null = unrestricted; [] = access expired or revoked." + } + }, + "required": [ + "id", + "name", + "slug", + "role", + "sections" + ], + "additionalProperties": false + }, + "Me": { + "type": "object", + "properties": { + "userId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "role": { + "type": "string", + "enum": [ + "SUPER_ADMIN", + "ADMIN", + "STAFF", + "VIEWER", + "MINCULTURA", + "MERCH_MANAGER" + ], + "description": "DEPRECATED: effective role in the ACTIVE workspace. Use the `role` of each `workspaces` row instead. Kept for compatibility with already-published clients." + }, + "activeWorkspaceId": { + "type": [ + "string", + "null" + ] + }, + "workspaces": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WorkspaceAccess" + } + }, + "scope": { + "type": "string", + "enum": [ + "read", + "write" + ], + "description": "Scope of the API key in use. `read` = only GET/HEAD; any mutating method answers 403." + } + }, + "required": [ + "userId", + "name", + "email", + "role", + "activeWorkspaceId", + "workspaces", + "scope" + ], + "additionalProperties": false + }, + "SignupRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "name": { + "type": "string", + "minLength": 2, + "maxLength": 120 + }, + "workspaceName": { + "type": "string", + "minLength": 2, + "maxLength": 80 + } + }, + "required": [ + "email", + "name" + ], + "additionalProperties": false + }, + "SignupResponse": { + "type": "object", + "properties": { + "user_id": { + "type": "string" + }, + "status": { + "type": "string", + "const": "pending_verification" + }, + "verification_sent_to": { + "type": "string" + } + }, + "required": [ + "user_id", + "status", + "verification_sent_to" + ], + "additionalProperties": false + }, + "WorkspaceCreate": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 2, + "maxLength": 80 + }, + "slug": { + "type": "string", + "minLength": 2, + "maxLength": 50, + "pattern": "^[a-z0-9-]+$" + } + }, + "required": [ + "name", "slug" ], "additionalProperties": false @@ -25201,14 +28349,16 @@ }, "name": { "type": "string", - "minLength": 1 + "minLength": 1, + "maxLength": 100 }, "description": { "type": "string" }, "price": { "type": "number", - "minimum": 0 + "minimum": 0, + "maximum": 9999999999 }, "currency": { "default": "COP", @@ -25289,7 +28439,8 @@ "properties": { "name": { "type": "string", - "minLength": 1 + "minLength": 1, + "maxLength": 100 }, "description": { "type": [ @@ -25299,7 +28450,8 @@ }, "price": { "type": "number", - "minimum": 0 + "minimum": 0, + "maximum": 9999999999 }, "currency": { "description": "Solo COP; se tolera la moneda ya guardada si no cambia.", @@ -26676,790 +29828,487 @@ } }, "required": [ - "reference", - "name", + "reference", + "name", + "email", + "phone", + "documentType", + "documentNumber", + "ticketCode", + "quantity", + "checkedInAt", + "checkedInSource", + "eventId", + "eventName", + "eventDateId", + "eventDateStartsAt", + "ticketTypeId", + "ticketTypeName", + "saleStatus", + "createdAt" + ], + "additionalProperties": false + }, + "ExportSubscriber": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "plan": { + "type": "string" + }, + "status": { + "type": "string" + }, + "since": { + "type": "string" + }, + "expiresAt": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "name", + "email", + "plan", + "status", + "since", + "expiresAt" + ], + "additionalProperties": false + }, + "EventArtistsReplace": { + "type": "object", + "properties": { + "artistIds": { + "maxItems": 50, + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 64 + } + }, + "inviteEmails": { + "maxItems": 20, + "type": "array", + "items": { + "type": "string", + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + } + }, + "required": [ + "artistIds" + ], + "additionalProperties": false + }, + "ArtistSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": [ + "string", + "null" + ] + }, + "logoUrl": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "slug", + "logoUrl" + ], + "additionalProperties": false + }, + "ArtistInvitation": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "PENDING", + "EXPIRED" + ] + }, + "expiresAt": { + "type": "string" + }, + "createdAt": { + "type": "string" + } + }, + "required": [ + "id", "email", - "phone", - "documentType", - "documentNumber", - "ticketCode", - "quantity", - "checkedInAt", - "checkedInSource", - "eventId", - "eventName", - "eventDateId", - "eventDateStartsAt", - "ticketTypeId", - "ticketTypeName", - "saleStatus", + "status", + "expiresAt", "createdAt" ], "additionalProperties": false }, - "ExportSubscriber": { + "EventArtistUnlink": { "type": "object", "properties": { - "name": { + "eventId": { "type": "string" }, - "email": { + "organizationId": { "type": "string" }, - "plan": { + "unlinked": { + "type": "boolean" + } + }, + "required": [ + "eventId", + "organizationId", + "unlinked" + ], + "additionalProperties": false + }, + "ArtistInvitationDeleted": { + "type": "object", + "properties": { + "id": { "type": "string" }, - "status": { + "deleted": { + "type": "boolean", + "const": true + } + }, + "required": [ + "id", + "deleted" + ], + "additionalProperties": false + }, + "EventViewer": { + "type": "object", + "properties": { + "id": { "type": "string" }, - "since": { + "email": { "type": "string" }, - "expiresAt": { - "type": [ - "string", - "null" - ] + "createdAt": { + "type": "string" } }, "required": [ - "name", + "id", "email", - "plan", - "status", - "since", - "expiresAt" + "createdAt" ], "additionalProperties": false }, - "MerchOrderCreate": { + "EventViewerInvite": { "type": "object", "properties": { - "buyer": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 2, - "maxLength": 120 - }, - "phone": { - "type": "string", - "pattern": "^\\+?[0-9 -]{7,20}$" - }, - "documentType": { - "type": "string", - "enum": [ - "CC", - "CE", - "PP", - "NIT", - "TI", - "PEP" - ] - }, - "document": { - "type": "string", - "minLength": 3, - "maxLength": 20 - } - }, - "required": [ - "name", - "phone", - "documentType", - "document" - ], - "additionalProperties": false + "email": { + "type": "string", + "maxLength": 255, + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + }, + "required": [ + "email" + ], + "additionalProperties": false + }, + "EventViewerInviteResult": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "delivery": { - "oneOf": [ - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "const": "SHIPPING" - }, - "departmentCode": { - "type": "string", - "pattern": "^\\d{2}$" - }, - "department": { - "type": "string", - "minLength": 1, - "maxLength": 80 - }, - "cityCode": { - "type": "string", - "pattern": "^\\d{5}$" - }, - "city": { - "type": "string", - "minLength": 1, - "maxLength": 80 - }, - "address": { - "type": "string", - "minLength": 5, - "maxLength": 200 - }, - "addressExtra": { - "anyOf": [ - { - "type": "string", - "maxLength": 200 - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "kind", - "departmentCode", - "department", - "cityCode", - "city", - "address" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "const": "PICKUP" - }, - "pickupPointId": { - "type": "string", - "minLength": 1, - "maxLength": 64 - } - }, - "required": [ - "kind", - "pickupPointId" - ], - "additionalProperties": false - } - ] + "email": { + "type": "string" }, - "items": { - "minItems": 1, - "maxItems": 20, - "type": "array", - "items": { - "type": "object", - "properties": { - "variantId": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "quantity": { - "type": "integer", - "minimum": 1, - "maximum": 50 - } - }, - "required": [ - "variantId", - "quantity" - ], - "additionalProperties": false - } + "createdAt": { + "type": "string" }, - "discountCode": { - "description": "Optional discount code of this store (case-insensitive). It applies to products only, never to shipping.", - "anyOf": [ - { - "type": "string", - "minLength": 1, - "maxLength": 40 - }, - { - "type": "null" - } - ] + "newAccount": { + "deprecated": true, + "description": "Deprecated, never sent: it revealed whether the email already had a FreeTicket account.", + "type": "boolean" } }, "required": [ - "buyer", - "delivery", - "items" + "id", + "email", + "createdAt" ], "additionalProperties": false }, - "MerchDiscountPreview": { + "EventViewerRevoke": { "type": "object", "properties": { - "discountCode": { - "type": "string", - "minLength": 1, - "maxLength": 40 + "id": { + "type": "string" }, - "items": { - "minItems": 1, - "maxItems": 20, - "type": "array", - "items": { - "type": "object", - "properties": { - "variantId": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "quantity": { - "type": "integer", - "minimum": 1, - "maximum": 50 - } - }, - "required": [ - "variantId", - "quantity" - ], - "additionalProperties": false - } + "eventId": { + "type": "string" }, - "delivery": { - "oneOf": [ - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "const": "SHIPPING" - }, - "cityCode": { - "type": "string", - "pattern": "^\\d{5}$" - } - }, - "required": [ - "kind", - "cityCode" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "kind": { - "type": "string", - "const": "PICKUP" - } - }, - "required": [ - "kind" - ], - "additionalProperties": false - } - ] + "revoked": { + "type": "boolean" } }, "required": [ - "discountCode", - "items", - "delivery" + "id", + "eventId", + "revoked" ], "additionalProperties": false }, - "MerchDiscountPreviewResult": { + "EventValidator": { "type": "object", "properties": { - "discountCode": { - "type": "string", - "description": "The code as the store saved it." + "id": { + "type": "string" }, - "subtotal": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "Products before the discount." + "userId": { + "description": "Only present when the person is a member of the active workspace.", + "type": "string" }, - "discountAmount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "name": { + "description": "Only present when the person is a member of the active workspace.", + "type": "string" }, - "shippingFee": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "email": { + "type": "string" }, - "total": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "`total = subtotal - discountAmount + shippingFee`." + "isActive": { + "type": "boolean" + }, + "allEvents": { + "type": "boolean" } }, "required": [ - "discountCode", - "subtotal", - "discountAmount", - "shippingFee", - "total" + "id", + "email", + "isActive", + "allEvents" ], "additionalProperties": false }, - "MerchOrderLookup": { + "EventValidatorCreate": { "type": "object", "properties": { - "code": { + "name": { "type": "string", - "minLength": 3, - "maxLength": 20 + "minLength": 2, + "maxLength": 100 + }, + "email": { + "type": "string", + "maxLength": 255, + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" } }, "required": [ - "code" + "name", + "email" ], "additionalProperties": false }, - "MerchCardPayment": { + "EventValidatorCreateResult": { "type": "object", "properties": { - "token": { - "type": "string", - "minLength": 1, - "description": "Card token returned by the Payment Brick when tokenizing." + "id": { + "type": "string" }, - "paymentMethodId": { - "type": "string", - "minLength": 1, - "description": "`payment_method_id` returned by the Brick (e.g. `visa`, `debmaster`)." + "userId": { + "description": "Only present when the person is a member of the active workspace.", + "type": "string" }, - "installments": { - "default": 1, - "type": "integer", - "minimum": 1, - "maximum": 36 + "name": { + "description": "Only present when the person is a member of the active workspace.", + "type": "string" }, - "issuerId": { - "description": "`issuer_id` returned by the Brick (card issuer). Optional: forwarded to MercadoPago as is when present.", - "type": "string", - "pattern": "^\\d{1,12}$" + "email": { + "type": "string" }, - "payer": { - "type": "object", - "properties": { - "identification": { - "type": "object", - "properties": { - "type": { - "type": "string", - "minLength": 1 - }, - "number": { - "type": "string", - "minLength": 1 - } - }, - "required": [ - "type", - "number" - ], - "additionalProperties": false - } - }, - "additionalProperties": false + "isActive": { + "type": "boolean" + }, + "allEvents": { + "type": "boolean" + }, + "invited": { + "type": "boolean" } }, "required": [ - "token", - "paymentMethodId", - "installments" + "id", + "email", + "isActive", + "allEvents", + "invited" ], "additionalProperties": false }, - "MerchCardPaymentResult": { + "StaffInviteResend": { "type": "object", "properties": { - "status": { + "id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "sent": { + "type": "boolean" + } + }, + "required": [ + "id", + "email", + "sent" + ], + "additionalProperties": false + }, + "StaffAccessUpdate": { + "type": "object", + "properties": { + "accessType": { "type": "string", "enum": [ - "approved", - "pending", - "rejected" - ], - "description": "`pending` is normal (bank authentication): the order is confirmed by webhook, poll the lookup. `rejected` is a business decline: the order stays pending until its reservation expires and the buyer can retry with another card." + "admin", + "validador", + "personalizado", + "lectura" + ] + }, + "sections": { + "maxItems": 50, + "type": "array", + "items": { + "type": "string", + "enum": [ + "inicio", + "eventos", + "validar", + "membresias", + "contenido", + "productos", + "pagina_web", + "comunicacion", + "informes", + "liquidaciones", + "tienda", + "perfil" + ] + } }, - "code": { - "type": "string" + "validatorEventIds": { + "maxItems": 200, + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 64 + } }, - "message": { - "description": "Human-readable message. Only present with `rejected`.", - "type": "string" + "viewerEventIds": { + "maxItems": 200, + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 64 + } + }, + "expiresAt": { + "anyOf": [ + { + "type": "string", + "pattern": "^\\d{4}-\\d{2}-\\d{2}$" + }, + { + "type": "null" + } + ] } }, "required": [ - "status", - "code" + "accessType" ], "additionalProperties": false }, - "MerchOrder": { + "StaffAccess": { "type": "object", "properties": { - "code": { + "userId": { "type": "string" }, - "status": { + "accessType": { "type": "string", "enum": [ - "PENDING", - "PAID", - "PREPARING", - "SHIPPED", - "DELIVERED", - "READY_FOR_PICKUP", - "PICKED_UP", - "CANCELLED", - "REFUNDED" - ] - }, - "currency": { - "type": "string", - "const": "COP" - }, - "reservedUntil": { - "type": [ - "string", - "null" - ] - }, - "createdAt": { - "type": "string" - }, - "paidAt": { - "type": [ - "string", - "null" + "admin", + "validador", + "personalizado", + "lectura" ] }, - "buyer": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "name": { - "type": "string" - }, - "phone": { - "type": "string" - } - }, - "required": [ - "email", - "name", - "phone" - ], - "additionalProperties": false - }, - "fulfillment": { + "role": { "type": "string", "enum": [ - "SHIPPING", - "PICKUP" - ] - }, - "shipping": { - "anyOf": [ - { - "type": "object", - "properties": { - "departmentCode": { - "type": [ - "string", - "null" - ] - }, - "department": { - "type": [ - "string", - "null" - ] - }, - "cityCode": { - "type": [ - "string", - "null" - ] - }, - "city": { - "type": [ - "string", - "null" - ] - }, - "address": { - "type": [ - "string", - "null" - ] - }, - "addressExtra": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "departmentCode", - "department", - "cityCode", - "city", - "address", - "addressExtra" - ], - "additionalProperties": false - }, - { - "type": "null" - } - ] - }, - "pickupPoint": { - "anyOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "address": { - "type": "string" - }, - "city": { - "type": [ - "string", - "null" - ] - }, - "schedule": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "name", - "address", - "city", - "schedule" - ], - "additionalProperties": false - }, - { - "type": "null" - } + "ADMIN", + "STAFF", + "VIEWER" ] }, - "items": { + "sections": { "type": "array", "items": { - "type": "object", - "properties": { - "variantId": { - "type": "string" - }, - "productName": { - "type": "string" - }, - "variantLabel": { - "type": "string" - }, - "sku": { - "type": "string" - }, - "quantity": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "unitPrice": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "imageUrl": { - "description": "First image of the variant's product at read time; null if the product has no image or was deleted.", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "variantId", - "productName", - "variantLabel", - "sku", - "quantity", - "unitPrice", - "imageUrl" - ], - "additionalProperties": false + "type": "string" } }, - "subtotal": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "Products before the discount, in COP." - }, - "discountCode": { - "description": "Discount code frozen on the order; null if none was used.", - "type": [ - "string", - "null" - ] - }, - "discountAmount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "COP taken off the products: `total = subtotal - discountAmount + shippingFee`." - }, - "shippingFee": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "total": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "tracking": { - "anyOf": [ - { - "type": "object", - "properties": { - "carrier": { - "type": [ - "string", - "null" - ] - }, - "carrierName": { - "type": [ - "string", - "null" - ] - }, - "carrierLabel": { - "type": [ - "string", - "null" - ] - }, - "trackingNumber": { - "type": [ - "string", - "null" - ] - }, - "trackingUrl": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "carrier", - "carrierName", - "carrierLabel", - "trackingNumber", - "trackingUrl" - ], - "additionalProperties": false - }, - { - "type": "null" - } - ] + "validatorEventIds": { + "type": "array", + "items": { + "type": "string" + } }, - "statusDates": { - "type": "object", - "properties": { - "paidAt": { - "type": [ - "string", - "null" - ] - }, - "preparingAt": { - "type": [ - "string", - "null" - ] - }, - "shippedAt": { - "type": [ - "string", - "null" - ] - }, - "deliveredAt": { - "type": [ - "string", - "null" - ] - }, - "readyForPickupAt": { - "type": [ - "string", - "null" - ] - }, - "pickedUpAt": { - "type": [ - "string", - "null" - ] - }, - "cancelledAt": { - "type": [ - "string", - "null" - ] - }, - "refundedAt": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "paidAt", - "preparingAt", - "shippedAt", - "deliveredAt", - "readyForPickupAt", - "pickedUpAt", - "cancelledAt", - "refundedAt" - ], - "additionalProperties": false + "viewerEventIds": { + "type": "array", + "items": { + "type": "string" + } }, - "mpPublicKey": { - "description": "Public key of the brand's own MercadoPago account, for the Payment Brick. null when the store has no connected account.", + "expiresAt": { "type": [ "string", "null" @@ -27467,1797 +30316,1414 @@ } }, "required": [ - "code", - "status", - "currency", - "reservedUntil", - "createdAt", - "paidAt", - "buyer", - "fulfillment", - "shipping", - "pickupPoint", - "items", - "subtotal", - "discountCode", - "discountAmount", - "shippingFee", - "total", - "tracking", - "statusDates", - "mpPublicKey" + "userId", + "accessType", + "role", + "sections", + "validatorEventIds", + "viewerEventIds", + "expiresAt" ], "additionalProperties": false }, - "MerchCatalog": { + "SaleCreate": { "type": "object", "properties": { - "store": { + "buyer": { "type": "object", "properties": { - "brandName": { - "type": "string" - }, - "brandLogoUrl": { - "type": [ - "string", - "null" - ] - }, - "landingUrl": { - "type": [ - "string", - "null" - ] - }, - "support": { - "type": "object", - "properties": { - "phone": { - "type": [ - "string", - "null" - ] - }, - "isWhatsapp": { - "type": "boolean" - }, - "email": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "phone", - "isWhatsapp", - "email" - ], - "additionalProperties": false - }, - "shipping": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "feeBogota": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "feeNational": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "freeShippingThreshold": { - "anyOf": [ - { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - { - "type": "null" - } - ] - } - }, - "required": [ - "enabled", - "feeBogota", - "feeNational", - "freeShippingThreshold" - ], - "additionalProperties": false + "name": { + "type": "string", + "minLength": 1 }, - "pickupEnabled": { - "type": "boolean" + "email": { + "type": "string", + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "phone": { + "type": "string", + "minLength": 1 } }, "required": [ - "brandName", - "brandLogoUrl", - "landingUrl", - "support", - "shipping", - "pickupEnabled" + "name", + "email" ], "additionalProperties": false }, - "products": { + "items": { + "minItems": 1, "type": "array", "items": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "slug": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "imageUrls": { - "type": "array", - "items": { - "type": "string" - } - }, - "options": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "values": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "name", - "values" - ], - "additionalProperties": false - } + "ticketTypeId": { + "type": "string", + "minLength": 1 }, - "maxPerOrder": { + "quantity": { "type": "integer", - "minimum": -9007199254740991, + "minimum": 1, "maximum": 9007199254740991 }, - "membersOnly": { - "type": "boolean", - "description": "Only a buyer with an active membership in this organization can order it; anyone else gets 403 `MEMBERS_ONLY`. Show a lock." - }, - "status": { - "type": "string", - "enum": [ - "PUBLISHED", - "DRAFT" - ], - "description": "`DRAFT` only appears in preview responses (valid `X-Merch-Preview`). Drafts cannot be ordered." - }, - "variants": { + "seats": { "type": "array", "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "sku": { - "type": "string" - }, - "label": { - "type": "string" - }, - "attributes": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": {} - }, - "price": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "compareAtPrice": { - "anyOf": [ - { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - { - "type": "null" - } - ] - }, - "stock": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - } - }, - "required": [ - "id", - "sku", - "label", - "attributes", - "price", - "compareAtPrice", - "stock" - ], - "additionalProperties": false + "type": "string", + "minLength": 1 } } }, "required": [ - "id", - "slug", - "name", - "description", - "imageUrls", - "options", - "maxPerOrder", - "membersOnly", - "status", - "variants" - ], - "additionalProperties": false - } - }, - "pickupPoints": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "address": { - "type": "string" - }, - "city": { - "type": [ - "string", - "null" - ] - }, - "schedule": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "name", - "address", - "city", - "schedule" + "ticketTypeId", + "quantity" ], "additionalProperties": false } }, - "currency": { + "channel": { + "default": "ADMIN", "type": "string", - "const": "COP" - }, - "mpPublicKey": { - "description": "Public key of the brand's own MercadoPago account, for the Payment Brick. null in a preview when the store has no connected account yet.", - "type": [ - "string", - "null" + "enum": [ + "WEB", + "MOBILE", + "POS", + "ADMIN" ] }, - "preview": { - "type": "boolean", - "description": "`true` when the response honored a valid `X-Merch-Preview` token: it includes DRAFT products and the landing must not allow checkout." + "comp": { + "default": false, + "type": "boolean" + }, + "notes": { + "type": "string" } }, "required": [ - "store", - "products", - "pickupPoints", - "currency", - "mpPublicKey", - "preview" + "buyer", + "items", + "channel", + "comp" ], "additionalProperties": false }, - "ContentVideo": { + "SaleCancelRequest": { + "type": "object", + "properties": { + "acknowledge_open_payment": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "SaleRefundRequest": { + "type": "object", + "properties": { + "acknowledge_manual": { + "type": "boolean" + }, + "items": { + "minItems": 1, + "maxItems": 200, + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 64 + } + }, + "block_seats": { + "type": "boolean" + } + }, + "additionalProperties": false + }, + "SaleRefundResult": { "type": "object", "properties": { "id": { "type": "string" }, - "title": { + "reference": { "type": "string" }, - "description": { + "status": { + "type": "string", + "enum": [ + "PENDING", + "CONFIRMED", + "ABANDONED", + "CANCELLED", + "REFUNDED" + ] + }, + "channel": { + "type": "string" + }, + "subtotal": { + "type": "number" + }, + "discountAmount": { + "type": "number" + }, + "serviceFee": { + "type": "number" + }, + "iva": { + "type": "number" + }, + "total": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "buyerName": { + "type": "string" + }, + "buyerEmail": { + "type": "string" + }, + "buyerPhone": { "type": [ "string", "null" ] }, - "durationSeconds": { - "anyOf": [ - { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - { - "type": "null" - } + "buyerDocumentType": { + "type": [ + "string", + "null" ] }, - "posterUrl": { + "buyerDocumentNumber": { "type": [ "string", "null" ] }, - "series": { - "anyOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" - } - }, - "required": [ - "id", - "title" - ], - "additionalProperties": false - }, - { - "type": "null" - } + "organizationId": { + "type": [ + "string", + "null" ] }, - "memberOnly": { - "type": "boolean", - "description": "true = only current members of the organization can play it." - }, - "publishedAt": { + "paymentProvider": { "type": [ "string", "null" ] - } - }, - "required": [ - "id", - "title", - "description", - "durationSeconds", - "posterUrl", - "series", - "memberOnly", - "publishedAt" - ], - "additionalProperties": false - }, - "ContentMediaDeleted": { - "type": "object", - "properties": { - "id": { - "type": "string" }, - "deleted": { - "type": "boolean", - "const": true - } - }, - "required": [ - "id", - "deleted" - ], - "additionalProperties": false - }, - "ContentVideoUpdate": { - "type": "object", - "properties": { - "title": { - "type": "string" + "paymentRef": { + "type": [ + "string", + "null" + ] }, - "description": { - "description": "`null` or empty clears the description.", + "confirmedAt": { "type": [ "string", "null" ] }, - "memberOnly": { - "description": "true = only current members can play it.", - "type": "boolean" - } - }, - "additionalProperties": false - }, - "ContentVideoSummary": { - "type": "object", - "properties": { - "id": { + "createdAt": { "type": "string" }, - "title": { - "type": "string" + "failureReason": { + "type": [ + "string", + "null" + ] }, - "description": { + "paymentStatus": { + "description": "Status of the latest payment event. Usually the payment gateway's RAW status in its own vocabulary. Values prefixed with `FT_` come from FreeTicket, not the gateway: currently `FT_SALE_APPROVED_POST_CONFIRM`, which marks that the gateway re-notified an already-confirmed charge — this is how Bold reports its refunds. A CONFIRMED sale with this status may have money refunded that is not yet recorded.", "type": [ "string", "null" ] }, - "memberOnly": { - "type": "boolean" + "declineCode": { + "type": [ + "string", + "null" + ] + }, + "refund": { + "type": "object", + "properties": { + "amount": { + "type": [ + "number", + "null" + ] + }, + "refundedItemIds": { + "type": "array", + "items": { + "type": "string" + } + }, + "saleRefunded": { + "type": "boolean" + }, + "gatewayRefunded": { + "type": "boolean" + }, + "seats": { + "type": "string", + "enum": [ + "blocked", + "block_failed", + "released", + "release_failed", + "none" + ] + } + }, + "required": [ + "amount", + "refundedItemIds", + "saleRefunded", + "gatewayRefunded", + "seats" + ], + "additionalProperties": false } }, "required": [ "id", - "title", - "description", - "memberOnly" + "reference", + "status", + "channel", + "subtotal", + "discountAmount", + "serviceFee", + "iva", + "total", + "currency", + "buyerName", + "buyerEmail", + "buyerPhone", + "buyerDocumentType", + "buyerDocumentNumber", + "organizationId", + "paymentProvider", + "paymentRef", + "confirmedAt", + "createdAt", + "failureReason", + "paymentStatus", + "declineCode" ], "additionalProperties": false }, - "ContentVideoPublish": { + "SaleItemTransferRequest": { "type": "object", "properties": { - "published": { - "type": "boolean" + "email": { + "type": "string", + "maxLength": 254, + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + }, + "required": [ + "email" + ], + "additionalProperties": false + }, + "SaleItemTransfer": { + "type": "object", + "properties": { + "saleId": { + "type": "string" + }, + "itemId": { + "type": "string" + }, + "ticketCode": { + "type": "string", + "description": "New ticket code (the previous QR is void)." + }, + "holderName": { + "type": "string" + }, + "holderEmail": { + "type": "string" + }, + "transferredAt": { + "type": "string" } }, "required": [ - "published" + "saleId", + "itemId", + "ticketCode", + "holderName", + "holderEmail", + "transferredAt" ], "additionalProperties": false }, - "ContentVideoPublished": { + "CourtesyRecipientUpdate": { "type": "object", "properties": { - "id": { - "type": "string" + "name": { + "type": "string", + "minLength": 2, + "maxLength": 120 }, - "published": { - "type": "boolean" + "email": { + "type": "string", + "maxLength": 254, + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" } }, "required": [ - "id", - "published" + "name", + "email" ], "additionalProperties": false }, - "ContentVideoSeriesAssign": { + "CourtesyRecipient": { "type": "object", "properties": { - "seriesId": { - "anyOf": [ - { - "type": "string", - "minLength": 1 - }, - { - "type": "null" - } - ], - "description": "Series to put the video in; `null` removes it from its series." + "saleId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "resent": { + "type": "boolean" + }, + "ticketCodesRotated": { + "type": "boolean", + "description": "true when the email changed: the previous QR codes are void (transferred tickets keep theirs)." } }, "required": [ - "seriesId" + "saleId", + "name", + "email", + "resent", + "ticketCodesRotated" ], "additionalProperties": false }, - "ContentVideoSeriesResult": { + "CourtesySeats": { "type": "object", "properties": { - "id": { + "eventDateId": { "type": "string" }, - "seriesId": { - "type": [ - "string", - "null" - ] + "eventId": { + "type": "string" + }, + "ticketTypes": { + "type": "array", + "items": { + "type": "object", + "properties": { + "ticketTypeId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "labels": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Blocked seat labels of this ticket type's category that no live sale claims, in natural order." + } + }, + "required": [ + "ticketTypeId", + "name", + "labels" + ], + "additionalProperties": false + } } }, "required": [ - "id", - "seriesId" + "eventDateId", + "eventId", + "ticketTypes" ], "additionalProperties": false }, - "ContentSeries": { + "ReportByEventRow": { "type": "object", "properties": { - "id": { + "eventId": { "type": "string" }, - "title": { + "eventName": { "type": "string" }, - "description": { - "type": [ - "string", - "null" - ] - }, - "coverImageUrl": { - "type": [ - "string", - "null" - ] - }, - "memberOnly": { - "type": "boolean" - }, - "published": { - "type": "boolean" + "revenue": { + "type": "number" }, - "publishedAt": { - "type": [ - "string", - "null" - ] + "ticketsSold": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "videoCount": { + "salesCount": { "type": "integer", "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "Videos in the series (published or not, course videos excluded)." + "maximum": 9007199254740991 }, - "createdAt": { - "type": "string" + "available": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 } }, "required": [ - "id", - "title", - "description", - "coverImageUrl", - "memberOnly", - "published", - "publishedAt", - "videoCount", - "createdAt" + "eventId", + "eventName", + "revenue", + "ticketsSold", + "salesCount", + "available" ], "additionalProperties": false }, - "ContentSeriesCreate": { + "ReportTimeseriesRow": { "type": "object", "properties": { - "title": { - "type": "string", - "description": "1–120 characters." + "bucket": { + "type": "string" }, - "description": { - "description": "Up to 2000 characters.", - "type": [ - "string", - "null" - ] + "revenue": { + "type": "number" }, - "coverImageUrl": { - "description": "Absolute URL of the cover.", - "type": [ - "string", - "null" - ] + "ticketsSold": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "memberOnly": { - "description": "Default true.", - "type": "boolean" + "salesCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 } }, "required": [ - "title" + "bucket", + "revenue", + "ticketsSold", + "salesCount" ], "additionalProperties": false }, - "ContentSeriesUpdate": { + "ReportFinancialsRow": { "type": "object", "properties": { - "title": { + "eventId": { "type": "string" }, - "description": { - "description": "`null` clears it.", - "type": [ - "string", - "null" - ] + "eventName": { + "type": "string" }, - "coverImageUrl": { - "description": "`null` clears it.", - "type": [ - "string", - "null" - ] + "eventDateId": { + "type": "string" }, - "memberOnly": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - "ContentSeriesPublish": { - "type": "object", - "properties": { - "published": { + "startsAt": { + "type": "string" + }, + "past": { "type": "boolean" - } - }, - "required": [ - "published" - ], - "additionalProperties": false - }, - "ContentLiveCreate": { - "type": "object", - "properties": { - "title": { - "type": "string", - "description": "1–120 characters." }, - "eventDateId": { - "description": "Show date to tie the stream to (owned by the workspace or with the workspace as a linked artist). One stream per date.", + "unitsSold": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "gross": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "facial": { + "type": "number" + }, + "paymentFee": { + "type": "number" + }, + "wompiSalesWithoutRate": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "gmf": { + "type": "number" + }, + "net": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "settlementStatus": { + "anyOf": [ + { + "type": "string", + "enum": [ + "SENT", + "AWAITING_PAYMENT", + "PAID" + ] + }, + { + "type": "null" + } + ] + }, + "settlementId": { "type": [ "string", "null" ] }, - "memberOnly": { - "description": "Default true. Ignored (stream is public) when the workspace has no active membership plan.", - "type": "boolean" - }, - "scheduledAt": { - "description": "Wall-clock time \"YYYY-MM-DDTHH:mm\" in the WORKSPACE time zone (not UTC, no offset). Must be in the future and at most 2 years ahead. Absent: inherits the show date's start time when `eventDateId` is set.", + "settlementAmount": { "type": [ - "string", + "number", "null" ] } }, "required": [ - "title" + "eventId", + "eventName", + "eventDateId", + "startsAt", + "past", + "unitsSold", + "gross", + "platformFee", + "facial", + "paymentFee", + "wompiSalesWithoutRate", + "gmf", + "net", + "currency", + "settlementStatus", + "settlementId", + "settlementAmount" ], "additionalProperties": false }, - "ContentLiveCreated": { + "Settlement": { "type": "object", "properties": { "id": { "type": "string" }, - "title": { - "type": "string" + "reference": { + "type": "string", + "description": "Human-readable settlement id. EVENT: `LQ-EVT-ddmmaaaa-EVENT-NAME-FTCO`. MEMBERSHIP: `LQ-MEM-ddmmaaaa-ORG-MEMBERSHIP-yyyymmdd-yyyymmdd-FTCO` (creation date, workspace name, membership name, period start and end), so two settlements of the same workspace never share it. Derived, not stored: use `id` as the key." }, - "memberOnly": { - "type": "boolean" + "kind": { + "type": "string", + "enum": [ + "EVENT", + "MEMBERSHIP" + ], + "description": "EVENT = settlement of an event/function's ticket sales. MEMBERSHIP = settlement of the workspace's membership charges for a period (then `event` and `eventDate` are null and `period`/`membershipPlan` are set)." }, - "scheduledAt": { - "description": "UTC ISO 8601.", - "type": [ - "string", - "null" + "label": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "SENT", + "AWAITING_PAYMENT", + "PAID" ] }, - "eventDateId": { + "amount": { + "type": "number" + }, + "grossAmount": { "type": [ - "string", + "number", "null" ] }, - "rtmpUrl": { - "type": "string", - "description": "RTMPS ingest server for OBS / the encoder." + "unitsSold": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] }, - "streamKey": { - "type": "string", - "description": "SECRET. RTMP stream key: whoever has it can broadcast on this stream in the organization's name. Store it like a password; it is never returned by any read endpoint. Rotate it with `POST /content/lives/{id}/reset-key`." - } - }, - "required": [ - "id", - "title", - "memberOnly", - "scheduledAt", - "eventDateId", - "rtmpUrl", - "streamKey" - ], - "additionalProperties": false - }, - "ContentLiveStreamKey": { - "type": "object", - "properties": { - "id": { + "currency": { "type": "string" }, - "rtmpUrl": { - "type": "string" + "notes": { + "type": [ + "string", + "null" + ] }, - "streamKey": { - "type": "string", - "description": "SECRET. RTMP stream key: whoever has it can broadcast on this stream in the organization's name. Store it like a password; it is never returned by any read endpoint. Rotate it with `POST /content/lives/{id}/reset-key`." - } - }, - "required": [ - "id", - "rtmpUrl", - "streamKey" - ], - "additionalProperties": false - }, - "ContentLiveUpdate": { - "type": "object", - "properties": { - "scheduledAt": { - "description": "Wall-clock time \"YYYY-MM-DDTHH:mm\" in the WORKSPACE time zone (not UTC, no offset). Must be in the future and at most 2 years ahead. `null` removes the scheduled time. Only while the stream is IDLE.", + "rejectionReason": { "type": [ "string", "null" ] }, - "memberOnly": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - "ContentLiveSettings": { - "type": "object", - "properties": { - "id": { - "type": "string" + "event": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "eventDate": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "startsAt": { + "type": "string" + } + }, + "required": [ + "id", + "startsAt" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "period": { + "anyOf": [ + { + "type": "object", + "properties": { + "start": { + "type": "string", + "description": "First day of the period (yyyy-mm-dd), inclusive." + }, + "end": { + "type": "string", + "description": "Last day of the period (yyyy-mm-dd), inclusive." + } + }, + "required": [ + "start", + "end" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ], + "description": "Settled period for MEMBERSHIP settlements (calendar days, Bogota time, both ends inclusive). null for EVENT." + }, + "membershipPlan": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ], + "description": "Membership plan the settlement covers (MEMBERSHIP only). null for EVENT." }, - "memberOnly": { + "hasDocument": { "type": "boolean" }, - "scheduledAt": { - "description": "UTC ISO 8601.", - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "memberOnly", - "scheduledAt" - ], - "additionalProperties": false - }, - "ContentLiveChat": { - "type": "object", - "properties": { - "messages": { + "paymentProofs": { "type": "array", "items": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "authorId": { + "fileName": { "type": "string" - }, - "name": { + } + }, + "required": [ + "fileName" + ], + "additionalProperties": false + } + }, + "allocations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "bankAccountId": { "type": "string" }, - "text": { - "type": "string" + "percentage": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "sentAt": { - "type": "string" + "amount": { + "type": "number" }, - "host": { - "description": "Present (true) on messages sent by the organization.", - "type": "boolean" + "mode": { + "type": "string", + "enum": [ + "PERCENT", + "AMOUNT" + ] } }, "required": [ - "id", - "authorId", - "name", - "text", - "sentAt" + "bankAccountId", + "percentage" ], "additionalProperties": false } }, - "truncated": { - "type": "boolean", - "description": "true if the history cap was reached and the oldest messages are missing." - } - }, - "required": [ - "messages", - "truncated" - ], - "additionalProperties": false - }, - "ContentLive": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "title": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "IDLE", - "ACTIVE", - "COMPLETED", - "DISABLED" - ], - "description": "ACTIVE = streaming right now (live banner)." - }, - "memberOnly": { - "type": "boolean" - }, - "startedAt": { + "requestedAt": { "type": [ "string", "null" ] }, - "endedAt": { + "paidAt": { "type": [ "string", "null" ] }, - "hasRecording": { - "type": "boolean", - "description": "true if a playable recording remains after the stream." + "createdAt": { + "type": "string" } }, "required": [ "id", - "title", + "reference", + "kind", + "label", "status", - "memberOnly", - "startedAt", - "endedAt", - "hasRecording" + "amount", + "grossAmount", + "unitsSold", + "currency", + "notes", + "rejectionReason", + "event", + "eventDate", + "period", + "membershipPlan", + "hasDocument", + "paymentProofs", + "allocations", + "requestedAt", + "paidAt", + "createdAt" ], "additionalProperties": false }, - "EventArtistsReplace": { - "type": "object", - "properties": { - "artistIds": { - "maxItems": 50, - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 64 - } - }, - "inviteEmails": { - "maxItems": 20, - "type": "array", - "items": { - "type": "string", - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" - } - } - }, - "required": [ - "artistIds" - ], - "additionalProperties": false + "DiscountType": { + "type": "string", + "enum": [ + "PERCENT", + "FIXED" + ] }, - "ArtistSummary": { + "Discount": { "type": "object", "properties": { "id": { "type": "string" }, - "name": { + "code": { "type": "string" }, - "slug": { + "type": { + "$ref": "#/components/schemas/DiscountType" + }, + "value": { + "type": "number" + }, + "eventId": { "type": [ "string", "null" ] }, - "logoUrl": { + "active": { + "type": "boolean" + }, + "maxUses": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "uses": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "startsAt": { "type": [ "string", "null" ] - } - }, - "required": [ - "id", - "name", - "slug", - "logoUrl" - ], - "additionalProperties": false - }, - "ArtistInvitation": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "email": { - "type": "string" }, - "status": { - "type": "string", - "enum": [ - "PENDING", - "EXPIRED" + "endsAt": { + "type": [ + "string", + "null" ] }, - "expiresAt": { - "type": "string" - }, "createdAt": { "type": "string" } }, "required": [ "id", - "email", - "status", - "expiresAt", - "createdAt" - ], - "additionalProperties": false - }, - "EventArtistUnlink": { - "type": "object", - "properties": { - "eventId": { - "type": "string" - }, - "organizationId": { - "type": "string" - }, - "unlinked": { - "type": "boolean" - } - }, - "required": [ + "code", + "type", + "value", "eventId", - "organizationId", - "unlinked" - ], - "additionalProperties": false - }, - "ArtistInvitationDeleted": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "deleted": { - "type": "boolean", - "const": true - } - }, - "required": [ - "id", - "deleted" - ], - "additionalProperties": false - }, - "EventViewer": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "email": { - "type": "string" - }, - "createdAt": { - "type": "string" - } - }, - "required": [ - "id", - "email", + "active", + "maxUses", + "uses", + "startsAt", + "endsAt", "createdAt" ], "additionalProperties": false }, - "EventViewerInvite": { + "DiscountCreate": { "type": "object", "properties": { - "email": { + "code": { "type": "string", - "maxLength": 255, - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" - } - }, - "required": [ - "email" - ], - "additionalProperties": false - }, - "EventViewerInviteResult": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "email": { - "type": "string" + "minLength": 1 }, - "createdAt": { - "type": "string" + "type": { + "$ref": "#/components/schemas/DiscountType" }, - "newAccount": { - "deprecated": true, - "description": "Deprecated, never sent: it revealed whether the email already had a FreeTicket account.", - "type": "boolean" - } - }, - "required": [ - "id", - "email", - "createdAt" - ], - "additionalProperties": false - }, - "EventViewerRevoke": { - "type": "object", - "properties": { - "id": { - "type": "string" + "value": { + "type": "number", + "exclusiveMinimum": 0 }, "eventId": { - "type": "string" - }, - "revoked": { - "type": "boolean" - } - }, - "required": [ - "id", - "eventId", - "revoked" - ], - "additionalProperties": false - }, - "EventValidator": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "userId": { - "description": "Only present when the person is a member of the active workspace.", - "type": "string" - }, - "name": { - "description": "Only present when the person is a member of the active workspace.", - "type": "string" - }, - "email": { - "type": "string" + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } + ] }, - "isActive": { - "type": "boolean" + "maxUses": { + "anyOf": [ + { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] }, - "allEvents": { - "type": "boolean" - } - }, - "required": [ - "id", - "email", - "isActive", - "allEvents" - ], - "additionalProperties": false - }, - "EventValidatorCreate": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 2, - "maxLength": 100 + "startsAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + }, + { + "type": "null" + } + ] }, - "email": { - "type": "string", - "maxLength": 255, - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + "endsAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + }, + { + "type": "null" + } + ] } }, "required": [ - "name", - "email" + "code", + "type", + "value" ], "additionalProperties": false }, - "EventValidatorCreateResult": { + "DiscountUpdate": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "userId": { - "description": "Only present when the person is a member of the active workspace.", - "type": "string" - }, - "name": { - "description": "Only present when the person is a member of the active workspace.", - "type": "string" + "active": { + "type": "boolean" }, - "email": { - "type": "string" + "value": { + "type": "number", + "exclusiveMinimum": 0 }, - "isActive": { - "type": "boolean" + "maxUses": { + "anyOf": [ + { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] }, - "allEvents": { - "type": "boolean" + "startsAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + }, + { + "type": "null" + } + ] }, - "invited": { - "type": "boolean" + "endsAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + }, + { + "type": "null" + } + ] } }, - "required": [ - "id", - "email", - "isActive", - "allEvents", - "invited" - ], "additionalProperties": false }, - "StaffInviteResend": { + "Webhook": { "type": "object", "properties": { "id": { "type": "string" }, - "email": { + "url": { "type": "string" }, - "sent": { + "events": { + "type": "array", + "items": { + "type": "string" + } + }, + "active": { "type": "boolean" + }, + "lastDeliveryAt": { + "type": [ + "string", + "null" + ] + }, + "lastDeliveryStatus": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "failureCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" } }, "required": [ "id", - "email", - "sent" + "url", + "events", + "active", + "lastDeliveryAt", + "lastDeliveryStatus", + "failureCount", + "createdAt", + "updatedAt" ], "additionalProperties": false }, - "StaffAccessUpdate": { + "WebhookUpdate": { "type": "object", "properties": { - "accessType": { + "url": { "type": "string", - "enum": [ - "admin", - "validador", - "personalizado", - "lectura" - ] + "format": "uri" }, - "sections": { - "maxItems": 50, + "events": { + "minItems": 1, "type": "array", "items": { "type": "string", "enum": [ - "inicio", - "eventos", - "validar", - "membresias", - "contenido", - "productos", - "pagina_web", - "comunicacion", - "informes", - "liquidaciones", - "tienda", - "perfil" + "sale.confirmed", + "sale.refunded" ] } }, - "validatorEventIds": { - "maxItems": 200, - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 64 - } - }, - "viewerEventIds": { - "maxItems": 200, - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 64 - } - }, - "expiresAt": { - "anyOf": [ - { - "type": "string", - "pattern": "^\\d{4}-\\d{2}-\\d{2}$" - }, - { - "type": "null" - } - ] + "active": { + "type": "boolean" } }, - "required": [ - "accessType" - ], "additionalProperties": false }, - "StaffAccess": { + "WebhookCreated": { "type": "object", "properties": { - "userId": { + "id": { "type": "string" }, - "accessType": { - "type": "string", - "enum": [ - "admin", - "validador", - "personalizado", - "lectura" - ] - }, - "role": { - "type": "string", - "enum": [ - "ADMIN", - "STAFF", - "VIEWER" - ] - }, - "sections": { - "type": "array", - "items": { - "type": "string" - } + "url": { + "type": "string" }, - "validatorEventIds": { + "events": { "type": "array", "items": { "type": "string" } }, - "viewerEventIds": { - "type": "array", - "items": { - "type": "string" - } + "active": { + "type": "boolean" }, - "expiresAt": { + "lastDeliveryAt": { "type": [ "string", "null" ] - } - }, - "required": [ - "userId", - "accessType", - "role", - "sections", - "validatorEventIds", - "viewerEventIds", - "expiresAt" - ], - "additionalProperties": false - }, - "SaleCreate": { - "type": "object", - "properties": { - "buyer": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 1 - }, - "email": { - "type": "string", - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "lastDeliveryStatus": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "phone": { - "type": "string", - "minLength": 1 + { + "type": "null" } - }, - "required": [ - "name", - "email" - ], - "additionalProperties": false + ] }, - "items": { - "minItems": 1, - "type": "array", - "items": { - "type": "object", - "properties": { - "ticketTypeId": { - "type": "string", - "minLength": 1 - }, - "quantity": { - "type": "integer", - "minimum": 1, - "maximum": 9007199254740991 - }, - "seats": { - "type": "array", - "items": { - "type": "string", - "minLength": 1 - } - } - }, - "required": [ - "ticketTypeId", - "quantity" - ], - "additionalProperties": false - } + "failureCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "channel": { - "default": "ADMIN", - "type": "string", - "enum": [ - "WEB", - "MOBILE", - "POS", - "ADMIN" - ] + "createdAt": { + "type": "string" }, - "comp": { - "default": false, - "type": "boolean" + "updatedAt": { + "type": "string" }, - "notes": { + "signingSecret": { "type": "string" } }, "required": [ - "buyer", - "items", - "channel", - "comp" + "id", + "url", + "events", + "active", + "lastDeliveryAt", + "lastDeliveryStatus", + "failureCount", + "createdAt", + "updatedAt", + "signingSecret" ], "additionalProperties": false }, - "SaleCancelRequest": { - "type": "object", - "properties": { - "acknowledge_open_payment": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - "CourtesySeats": { + "WebhookCreate": { "type": "object", "properties": { - "eventDateId": { - "type": "string" - }, - "eventId": { - "type": "string" + "url": { + "type": "string", + "format": "uri" }, - "ticketTypes": { + "events": { + "minItems": 1, "type": "array", "items": { - "type": "object", - "properties": { - "ticketTypeId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "labels": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Blocked seat labels of this ticket type's category that no live sale claims, in natural order." - } - }, - "required": [ - "ticketTypeId", - "name", - "labels" - ], - "additionalProperties": false - } + "type": "string", + "enum": [ + "sale.confirmed", + "sale.refunded" + ] + }, + "description": "Subset of: sale.confirmed, sale.refunded" + }, + "secret": { + "type": "string", + "minLength": 1 } }, "required": [ - "eventDateId", - "eventId", - "ticketTypes" + "url", + "events" ], "additionalProperties": false }, - "ReportByEventRow": { + "Subscriber": { "type": "object", "properties": { - "eventId": { + "id": { "type": "string" }, - "eventName": { - "type": "string" + "customerName": { + "type": [ + "string", + "null" + ] }, - "revenue": { - "type": "number" + "customerEmail": { + "type": "string" }, - "ticketsSold": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "status": { + "type": "string", + "enum": [ + "PENDING", + "ACTIVE", + "EXPIRED", + "CANCELLED", + "PAUSED" + ] }, - "salesCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "startedAt": { + "type": [ + "string", + "null" + ] }, - "available": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "currentPeriodEnd": { + "type": [ + "string", + "null" + ] } }, "required": [ - "eventId", - "eventName", - "revenue", - "ticketsSold", - "salesCount", - "available" + "id", + "customerName", + "customerEmail", + "status", + "startedAt", + "currentPeriodEnd" ], "additionalProperties": false }, - "ReportTimeseriesRow": { + "SubscriptionCancelResult": { "type": "object", "properties": { - "bucket": { + "id": { "type": "string" }, - "revenue": { - "type": "number" - }, - "ticketsSold": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "status": { + "type": "string", + "enum": [ + "PENDING", + "ACTIVE", + "EXPIRED", + "CANCELLED", + "PAUSED" + ] }, - "salesCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "cancelledAt": { + "type": [ + "string", + "null" + ] } }, "required": [ - "bucket", - "revenue", - "ticketsSold", - "salesCount" + "id", + "status", + "cancelledAt" ], "additionalProperties": false }, - "ReportFinancialsRow": { + "SaleTicket": { "type": "object", "properties": { - "eventId": { + "id": { "type": "string" }, - "eventName": { + "ticketCode": { "type": "string" }, - "eventDateId": { + "ticketTypeId": { "type": "string" }, - "startsAt": { + "ticketTypeName": { "type": "string" }, - "past": { - "type": "boolean" - }, - "unitsSold": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "gross": { - "type": "number" - }, - "platformFee": { - "type": "number" - }, - "facial": { - "type": "number" - }, - "paymentFee": { - "type": "number" - }, - "wompiSalesWithoutRate": { + "quantity": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991 }, - "gmf": { - "type": "number" - }, - "net": { - "type": "number" - }, - "currency": { - "type": "string" + "seatLabel": { + "type": [ + "string", + "null" + ] }, - "settlementStatus": { - "anyOf": [ - { - "type": "string", - "enum": [ - "SENT", - "AWAITING_PAYMENT", - "PAID" - ] - }, - { - "type": "null" - } + "checkedInAt": { + "type": [ + "string", + "null" ] }, - "settlementId": { + "refundedAt": { "type": [ "string", "null" ] }, - "settlementAmount": { + "refundAmount": { "type": [ "number", "null" ] + }, + "seatBlocked": { + "type": "boolean" } }, "required": [ - "eventId", - "eventName", - "eventDateId", - "startsAt", - "past", - "unitsSold", - "gross", - "platformFee", - "facial", - "paymentFee", - "wompiSalesWithoutRate", - "gmf", - "net", - "currency", - "settlementStatus", - "settlementId", - "settlementAmount" + "id", + "ticketCode", + "ticketTypeId", + "ticketTypeName", + "quantity", + "seatLabel", + "checkedInAt", + "refundedAt", + "refundAmount", + "seatBlocked" ], "additionalProperties": false }, - "Settlement": { + "PaymentAttempt": { "type": "object", "properties": { "id": { "type": "string" }, - "reference": { - "type": "string" - }, - "label": { + "provider": { "type": "string" }, "status": { "type": "string", - "enum": [ - "SENT", - "AWAITING_PAYMENT", - "PAID" - ] - }, - "amount": { - "type": "number" - }, - "grossAmount": { - "type": [ - "number", - "null" - ] - }, - "unitsSold": { - "anyOf": [ - { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - { - "type": "null" - } - ] - }, - "currency": { - "type": "string" + "description": "Status of the payment event. Usually this is the gateway's RAW status in its own vocabulary (PAID, APPROVED, REJECTED, VOID_APPROVED…). Values prefixed with `FT_` come from FreeTicket, not the gateway: currently `FT_SALE_APPROVED_POST_CONFIRM`, which flags that the gateway re-notified a payment that was already confirmed — this is how Bold reports its refunds, and the sale may remain CONFIRMED while someone verifies the refunded amount." }, - "notes": { + "declineCode": { "type": [ "string", "null" ] }, - "rejectionReason": { + "declineReason": { "type": [ "string", "null" ] }, - "event": { - "anyOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ], - "additionalProperties": false - }, - { - "type": "null" - } - ] - }, - "eventDate": { - "anyOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "startsAt": { - "type": "string" - } - }, - "required": [ - "id", - "startsAt" - ], - "additionalProperties": false - }, - { - "type": "null" - } - ] - }, - "hasDocument": { - "type": "boolean" - }, - "paymentProofs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "fileName": { - "type": "string" - } - }, - "required": [ - "fileName" - ], - "additionalProperties": false - } - }, - "allocations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bankAccountId": { - "type": "string" - }, - "percentage": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "amount": { - "type": "number" - }, - "mode": { - "type": "string", - "enum": [ - "PERCENT", - "AMOUNT" - ] - } - }, - "required": [ - "bankAccountId", - "percentage" - ], - "additionalProperties": false - } - }, - "requestedAt": { + "amount": { "type": [ - "string", + "number", "null" ] }, - "paidAt": { + "externalRef": { "type": [ "string", "null" @@ -29269,197 +31735,223 @@ }, "required": [ "id", - "reference", - "label", + "provider", "status", + "declineCode", + "declineReason", "amount", - "grossAmount", - "unitsSold", - "currency", - "notes", - "rejectionReason", - "event", - "eventDate", - "hasDocument", - "paymentProofs", - "allocations", - "requestedAt", - "paidAt", + "externalRef", "createdAt" ], "additionalProperties": false }, - "DiscountType": { - "type": "string", - "enum": [ - "PERCENT", - "FIXED" - ] + "TicketReassign": { + "type": "object", + "properties": { + "eventDateId": { + "type": "string", + "minLength": 1 + }, + "ticketTypeId": { + "type": "string", + "minLength": 1 + }, + "seatLabel": { + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false }, - "Discount": { + "ResendTicket": { "type": "object", "properties": { - "id": { + "ticketCode": { "type": "string" }, - "code": { + "sentTo": { "type": "string" }, - "type": { - "$ref": "#/components/schemas/DiscountType" + "sentAt": { + "type": "string" + } + }, + "required": [ + "ticketCode", + "sentTo", + "sentAt" + ], + "additionalProperties": false + }, + "CheckinResult": { + "type": "object", + "properties": { + "ticketCode": { + "type": "string" }, - "value": { - "type": "number" + "checkedInAt": { + "type": [ + "string", + "null" + ] }, - "eventId": { + "checkedInBy": { "type": [ "string", "null" ] }, - "active": { + "alreadyCheckedIn": { "type": "boolean" - }, - "maxUses": { + } + }, + "required": [ + "ticketCode", + "checkedInAt", + "checkedInBy", + "alreadyCheckedIn" + ], + "additionalProperties": false + }, + "CheckinRequest": { + "type": "object", + "properties": { + "source": { "anyOf": [ { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "type": "string", + "enum": [ + "pdf", + "web", + "apple", + "google" + ] }, { "type": "null" } ] + } + }, + "additionalProperties": false + }, + "CheckinUndoResult": { + "type": "object", + "properties": { + "ticketCode": { + "type": "string" }, - "uses": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "undone": { + "type": "boolean", + "description": "true when this call reverted the check-in; false when the ticket was not checked in (idempotent no-op)." }, - "startsAt": { + "previousCheckedInAt": { "type": [ "string", "null" ] }, - "endsAt": { + "previousCheckedInBy": { "type": [ "string", "null" ] - }, - "createdAt": { - "type": "string" } }, "required": [ - "id", - "code", - "type", - "value", - "eventId", - "active", - "maxUses", - "uses", - "startsAt", - "endsAt", - "createdAt" + "ticketCode", + "undone", + "previousCheckedInAt", + "previousCheckedInBy" ], "additionalProperties": false }, - "DiscountCreate": { + "TicketAccess": { "type": "object", "properties": { - "code": { - "type": "string", - "minLength": 1 - }, - "type": { - "$ref": "#/components/schemas/DiscountType" + "ticketCode": { + "type": "string" }, - "value": { - "type": "number", - "exclusiveMinimum": 0 + "valid": { + "type": "boolean" }, - "eventId": { - "anyOf": [ - { - "type": "string", - "minLength": 1 - }, - { - "type": "null" - } + "status": { + "type": "string", + "enum": [ + "VALID", + "USED", + "INVALID" ] }, - "maxUses": { - "anyOf": [ - { - "type": "integer", - "exclusiveMinimum": 0, - "maximum": 9007199254740991 - }, - { - "type": "null" - } + "saleStatus": { + "type": "string", + "enum": [ + "PENDING", + "CONFIRMED", + "ABANDONED", + "CANCELLED", + "REFUNDED" ] }, + "eventId": { + "type": "string" + }, + "eventName": { + "type": "string" + }, + "eventDateId": { + "type": "string" + }, "startsAt": { - "anyOf": [ - { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" - }, - { - "type": "null" - } - ] + "type": "string" }, - "endsAt": { - "anyOf": [ - { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" - }, - { - "type": "null" - } + "ticketTypeName": { + "type": "string" + }, + "checkedInAt": { + "type": [ + "string", + "null" ] } }, "required": [ - "code", - "type", - "value" + "ticketCode", + "valid", + "status", + "saleStatus", + "eventId", + "eventName", + "eventDateId", + "startsAt", + "ticketTypeName", + "checkedInAt" ], "additionalProperties": false }, - "DiscountUpdate": { + "ApiKeyScope": { + "type": "string", + "enum": [ + "read", + "write" + ] + }, + "ApiKey": { "type": "object", "properties": { - "active": { - "type": "boolean" + "id": { + "type": "string" }, - "value": { - "type": "number", - "exclusiveMinimum": 0 + "name": { + "type": "string" }, - "maxUses": { - "anyOf": [ - { - "type": "integer", - "exclusiveMinimum": 0, - "maximum": 9007199254740991 - }, - { - "type": "null" - } - ] + "scope": { + "$ref": "#/components/schemas/ApiKeyScope" }, - "startsAt": { + "keyPrefix": { + "type": "string" + }, + "lastUsedAt": { "anyOf": [ { "type": "string", @@ -29471,7 +31963,7 @@ } ] }, - "endsAt": { + "expiresAt": { "anyOf": [ { "type": "string", @@ -29482,280 +31974,245 @@ "type": "null" } ] - } - }, - "additionalProperties": false - }, - "Webhook": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "url": { - "type": "string" - }, - "events": { - "type": "array", - "items": { - "type": "string" - } - }, - "active": { - "type": "boolean" - }, - "lastDeliveryAt": { - "type": [ - "string", - "null" - ] }, - "lastDeliveryStatus": { + "revokedAt": { "anyOf": [ { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" }, { "type": "null" } ] }, - "failureCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" } }, "required": [ "id", - "url", - "events", - "active", - "lastDeliveryAt", - "lastDeliveryStatus", - "failureCount", - "createdAt", - "updatedAt" - ], - "additionalProperties": false - }, - "WebhookUpdate": { - "type": "object", - "properties": { - "url": { - "type": "string", - "format": "uri" - }, - "events": { - "minItems": 1, - "type": "array", - "items": { - "type": "string", - "enum": [ - "sale.confirmed", - "sale.refunded" - ] - } - }, - "active": { - "type": "boolean" - } - }, + "name", + "scope", + "keyPrefix", + "lastUsedAt", + "expiresAt", + "revokedAt", + "createdAt" + ], "additionalProperties": false }, - "WebhookCreated": { + "ApiKeyCreated": { "type": "object", "properties": { "id": { "type": "string" }, - "url": { + "name": { "type": "string" }, - "events": { - "type": "array", - "items": { - "type": "string" - } + "scope": { + "$ref": "#/components/schemas/ApiKeyScope" }, - "active": { - "type": "boolean" + "keyPrefix": { + "type": "string" }, - "lastDeliveryAt": { - "type": [ - "string", - "null" + "lastUsedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + }, + { + "type": "null" + } ] }, - "lastDeliveryStatus": { + "expiresAt": { "anyOf": [ { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" }, { "type": "null" } ] }, - "failureCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "revokedAt": { + "anyOf": [ + { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + }, + { + "type": "null" + } + ] }, "createdAt": { - "type": "string" - }, - "updatedAt": { - "type": "string" + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" }, - "signingSecret": { + "key": { "type": "string" } }, "required": [ "id", - "url", - "events", - "active", - "lastDeliveryAt", - "lastDeliveryStatus", - "failureCount", + "name", + "scope", + "keyPrefix", + "lastUsedAt", + "expiresAt", + "revokedAt", "createdAt", - "updatedAt", - "signingSecret" + "key" ], "additionalProperties": false }, - "WebhookCreate": { + "ApiKeyCreate": { "type": "object", "properties": { - "url": { + "name": { "type": "string", - "format": "uri" + "minLength": 1, + "maxLength": 120 }, - "events": { - "minItems": 1, - "type": "array", - "items": { - "type": "string", - "enum": [ - "sale.confirmed", - "sale.refunded" - ] - }, - "description": "Subset of: sale.confirmed, sale.refunded" + "scope": { + "default": "read", + "$ref": "#/components/schemas/ApiKeyScope" }, - "secret": { + "expiresAt": { "type": "string", - "minLength": 1 + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" } }, "required": [ - "url", - "events" + "name", + "scope" ], "additionalProperties": false }, - "Subscriber": { + "CustomerAuthRequest": { + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + }, + "required": [ + "email" + ], + "additionalProperties": false + }, + "CustomerAuthRequestResult": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "customerName": { - "type": [ - "string", - "null" - ] - }, - "customerEmail": { - "type": "string" - }, "status": { "type": "string", - "enum": [ - "PENDING", - "ACTIVE", - "EXPIRED", - "CANCELLED", - "PAUSED" - ] + "const": "sent" }, - "startedAt": { - "type": [ - "string", - "null" - ] + "sent_to": { + "type": "string", + "description": "Masked email (`c***@mail.com`). Never the full address." }, - "currentPeriodEnd": { - "type": [ - "string", - "null" - ] + "expires_in": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Code lifetime, in seconds." } }, "required": [ - "id", - "customerName", - "customerEmail", "status", - "startedAt", - "currentPeriodEnd" + "sent_to", + "expires_in" ], "additionalProperties": false }, - "SubscriptionCancelResult": { + "CustomerAuthVerify": { "type": "object", "properties": { - "id": { - "type": "string" + "email": { + "type": "string", + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" }, - "status": { + "code": { "type": "string", - "enum": [ - "PENDING", - "ACTIVE", - "EXPIRED", - "CANCELLED", - "PAUSED" - ] + "minLength": 6, + "maxLength": 6 + } + }, + "required": [ + "email", + "code" + ], + "additionalProperties": false + }, + "CustomerAuthVerifyResult": { + "type": "object", + "properties": { + "session_token": { + "type": "string", + "description": "Usable as-is as the `X-Customer-Session` header on /api/v1/customer/*." }, - "cancelledAt": { - "type": [ - "string", - "null" - ] + "expires_in": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Session lifetime, in seconds." } }, "required": [ - "id", - "status", - "cancelledAt" + "session_token", + "expires_in" ], "additionalProperties": false }, - "SaleTicket": { + "CustomerMe": { "type": "object", "properties": { "id": { "type": "string" }, - "ticketCode": { + "email": { "type": "string" }, - "ticketTypeId": { + "name": { "type": "string" }, + "emailVerified": { + "type": "boolean" + }, + "expiresAt": { + "type": "string", + "description": "Buyer session expiry (ISO 8601)." + } + }, + "required": [ + "id", + "email", + "name", + "emailVerified", + "expiresAt" + ], + "additionalProperties": false + }, + "CustomerTicketItem": { + "type": "object", + "properties": { "ticketTypeName": { "type": "string" }, @@ -29764,162 +32221,253 @@ "minimum": -9007199254740991, "maximum": 9007199254740991 }, - "seatLabel": { - "type": [ - "string", - "null" - ] - }, - "checkedInAt": { + "ticketCode": { + "description": "Opaque ticket code. The QR code must encode the validator URL (`https://admin.appfreeticket.com/dashboard/tickets/validar?code=`). null while the QR gate is closed: it is only delivered for a CONFIRMED purchase whose event starts in 72 hours or less (or already started), the same rule as the buyer portal. Before that, show a countdown to `eventDate.startsAt` minus 72 h and fetch again.", "type": [ "string", "null" ] }, - "refundedAt": { + "seatLabel": { + "description": "Exact seat for seated events (seats.io), or null.", "type": [ "string", "null" ] - }, - "refundAmount": { - "type": [ - "number", - "null" - ] - }, - "seatBlocked": { - "type": "boolean" } }, "required": [ - "id", - "ticketCode", - "ticketTypeId", "ticketTypeName", "quantity", - "seatLabel", - "checkedInAt", - "refundedAt", - "refundAmount", - "seatBlocked" + "ticketCode", + "seatLabel" ], "additionalProperties": false }, - "PaymentAttempt": { + "CustomerSale": { "type": "object", "properties": { "id": { "type": "string" }, - "provider": { + "reference": { "type": "string" }, "status": { - "type": "string", - "description": "Status of the payment event. Usually this is the gateway's RAW status in its own vocabulary (PAID, APPROVED, REJECTED, VOID_APPROVED…). Values prefixed with `FT_` come from FreeTicket, not the gateway: currently `FT_SALE_APPROVED_POST_CONFIRM`, which flags that the gateway re-notified a payment that was already confirmed — this is how Bold reports its refunds, and the sale may remain CONFIRMED while someone verifies the refunded amount." + "type": "string" }, - "declineCode": { - "type": [ - "string", - "null" - ] + "event": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "slug": { + "type": "string" + } + }, + "required": [ + "name", + "slug" + ], + "additionalProperties": false }, - "declineReason": { - "type": [ - "string", - "null" - ] + "eventDate": { + "type": "object", + "properties": { + "startsAt": { + "type": "string", + "description": "Event start instant in ISO 8601 UTC." + }, + "timezone": { + "type": "string", + "description": "IANA time zone of the event." + } + }, + "required": [ + "startsAt", + "timezone" + ], + "additionalProperties": false }, - "amount": { - "type": [ - "number", - "null" - ] + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerTicketItem" + } }, - "externalRef": { - "type": [ - "string", - "null" - ] + "total": { + "type": "number" }, - "createdAt": { + "currency": { "type": "string" } }, "required": [ "id", - "provider", + "reference", "status", - "declineCode", - "declineReason", - "amount", - "externalRef", - "createdAt" + "event", + "eventDate", + "items", + "total", + "currency" ], "additionalProperties": false }, - "TicketReassign": { + "CustomerTicketCancelResult": { "type": "object", "properties": { - "eventDateId": { - "type": "string", - "minLength": 1 + "id": { + "type": "string" }, - "ticketTypeId": { - "type": "string", - "minLength": 1 + "reference": { + "type": "string" }, - "seatLabel": { + "status": { + "type": "string" + } + }, + "required": [ + "id", + "reference", + "status" + ], + "additionalProperties": false + }, + "CustomerLogout": { + "type": "object", + "properties": { + "revoked": { + "type": "boolean", + "description": "true if the session existed and was deleted; false if the token was no longer valid (it ends up closed either way)." + } + }, + "required": [ + "revoked" + ], + "additionalProperties": false + }, + "EnterpriseExchangeRequest": { + "type": "object", + "properties": { + "token": { "type": "string", - "minLength": 1 + "minLength": 1, + "maxLength": 256, + "description": "One-time token received on the landing page callback (format `{slug}.{token}`, forwarded as is)." } }, + "required": [ + "token" + ], "additionalProperties": false }, - "CheckinResult": { + "EnterpriseExchangeResponse": { "type": "object", "properties": { - "ticketCode": { - "type": "string" - }, - "checkedInAt": { - "type": [ - "string", - "null" - ] + "session_token": { + "type": "string", + "description": "Buyer session token dedicated to this API key's workspace (not the buyer's portal session). Send it as the `X-Customer-Session` header on /api/v1/customer/*, always together with this same API key: with another workspace's key, or without a key, it is an invalid session." }, - "checkedInBy": { - "type": [ - "string", - "null" - ] + "expires_at": { + "type": "string", + "description": "Session expiry (ISO 8601). Fixed 7 days from the exchange; it does not slide. When it expires, restart the login flow." }, - "alreadyCheckedIn": { - "type": "boolean" + "customer": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email_verified": { + "type": "boolean" + } + }, + "required": [ + "id", + "email", + "name", + "email_verified" + ], + "additionalProperties": false } }, "required": [ - "ticketCode", - "checkedInAt", - "checkedInBy", - "alreadyCheckedIn" + "session_token", + "expires_at", + "customer" ], "additionalProperties": false }, - "CheckinRequest": { + "CustomerMembershipState": { "type": "object", "properties": { - "source": { + "active": { + "type": "boolean", + "description": "true only with an ACTIVE, unexpired membership in this workspace." + }, + "membership": { "anyOf": [ { - "type": "string", - "enum": [ - "pdf", - "web", - "apple", - "google" - ] + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "PENDING", + "ACTIVE", + "EXPIRED", + "CANCELLED", + "PAUSED" + ] + }, + "plan": { + "$ref": "#/components/schemas/MembershipPlan" + }, + "startedAt": { + "type": [ + "string", + "null" + ] + }, + "expiresAt": { + "description": "null = LIFETIME or a membership with no expiry.", + "type": [ + "string", + "null" + ] + }, + "autoRenew": { + "type": "boolean" + }, + "cancelledAt": { + "description": "When the membership was cancelled. Set with `status` ACTIVE = the buyer cancelled and keeps access until `expiresAt` (no more charges); null = not cancelled.", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "status", + "plan", + "startedAt", + "expiresAt", + "autoRenew", + "cancelledAt" + ], + "additionalProperties": false }, { "type": "null" @@ -29927,82 +32475,60 @@ ] } }, + "required": [ + "active", + "membership" + ], "additionalProperties": false }, - "CheckinUndoResult": { + "CustomerSubscribeRequest": { "type": "object", "properties": { - "ticketCode": { - "type": "string" - }, - "undone": { - "type": "boolean", - "description": "true when this call reverted the check-in; false when the ticket was not checked in (idempotent no-op)." - }, - "previousCheckedInAt": { - "type": [ - "string", - "null" - ] + "planId": { + "type": "string", + "minLength": 1, + "description": "Id of an active MembershipPlan in the key's workspace." + } + }, + "required": [ + "planId" + ], + "additionalProperties": false + }, + "CustomerSubscribeResult": { + "type": "object", + "properties": { + "checkoutUrl": { + "type": "string", + "description": "Membership checkout URL on the canonical host. The landing page must redirect the buyer there." }, - "previousCheckedInBy": { - "type": [ - "string", - "null" - ] + "planId": { + "type": "string" } }, "required": [ - "ticketCode", - "undone", - "previousCheckedInAt", - "previousCheckedInBy" + "checkoutUrl", + "planId" ], "additionalProperties": false }, - "TicketAccess": { + "CustomerSubscriptionCancelResult": { "type": "object", "properties": { - "ticketCode": { + "id": { "type": "string" }, - "valid": { - "type": "boolean" - }, "status": { - "type": "string", - "enum": [ - "VALID", - "USED", - "INVALID" - ] - }, - "saleStatus": { "type": "string", "enum": [ "PENDING", - "CONFIRMED", - "ABANDONED", + "ACTIVE", + "EXPIRED", "CANCELLED", - "REFUNDED" + "PAUSED" ] }, - "eventId": { - "type": "string" - }, - "eventName": { - "type": "string" - }, - "eventDateId": { - "type": "string" - }, - "startsAt": { - "type": "string" - }, - "ticketTypeName": { - "type": "string" - }, - "checkedInAt": { + "cancelledAt": { "type": [ "string", "null" @@ -30010,682 +32536,1128 @@ } }, "required": [ - "ticketCode", - "valid", + "id", "status", - "saleStatus", - "eventId", - "eventName", - "eventDateId", - "startsAt", - "ticketTypeName", - "checkedInAt" + "cancelledAt" ], "additionalProperties": false }, - "ApiKeyScope": { - "type": "string", - "enum": [ - "read", - "write" - ] + "CustomerSubscriptionCancelRequest": { + "type": "object", + "properties": { + "workspaceId": { + "description": "Required only without an enterprise service API key: which membership (by workspace) to cancel. Ignored with a key — the workspace is the one pinned to it.", + "type": "string", + "minLength": 1 + } + }, + "additionalProperties": false }, - "ApiKey": { + "CustomerProfile": { "type": "object", "properties": { "id": { "type": "string" }, - "name": { + "email": { "type": "string" }, - "scope": { - "$ref": "#/components/schemas/ApiKeyScope" - }, - "keyPrefix": { + "name": { "type": "string" }, - "lastUsedAt": { - "anyOf": [ - { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" - }, - { - "type": "null" - } - ] - }, - "expiresAt": { - "anyOf": [ - { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" - }, - { - "type": "null" - } - ] - }, - "revokedAt": { - "anyOf": [ - { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" - }, - { - "type": "null" - } + "phone": { + "type": [ + "string", + "null" ] - }, - "createdAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" } }, "required": [ "id", + "email", "name", - "scope", - "keyPrefix", - "lastUsedAt", - "expiresAt", - "revokedAt", - "createdAt" + "phone" ], "additionalProperties": false }, - "ApiKeyCreated": { + "CustomerProfileUpdate": { "type": "object", "properties": { - "id": { - "type": "string" - }, "name": { - "type": "string" - }, - "scope": { - "$ref": "#/components/schemas/ApiKeyScope" - }, - "keyPrefix": { - "type": "string" + "type": "string", + "minLength": 1, + "maxLength": 120 }, - "lastUsedAt": { + "phone": { + "description": "null or an empty string clears the phone.", "anyOf": [ { "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + "maxLength": 30 }, { "type": "null" } ] + } + }, + "additionalProperties": false + }, + "MerchOrderCreate": { + "type": "object", + "properties": { + "buyer": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 2, + "maxLength": 120 + }, + "phone": { + "type": "string", + "pattern": "^\\+?[0-9 -]{7,20}$" + }, + "documentType": { + "type": "string", + "enum": [ + "CC", + "CE", + "PP", + "NIT", + "TI", + "PEP" + ] + }, + "document": { + "type": "string", + "minLength": 3, + "maxLength": 20 + } + }, + "required": [ + "name", + "phone", + "documentType", + "document" + ], + "additionalProperties": false }, - "expiresAt": { - "anyOf": [ + "delivery": { + "oneOf": [ { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "SHIPPING" + }, + "departmentCode": { + "type": "string", + "pattern": "^\\d{2}$" + }, + "department": { + "type": "string", + "minLength": 1, + "maxLength": 80 + }, + "cityCode": { + "type": "string", + "pattern": "^\\d{5}$" + }, + "city": { + "type": "string", + "minLength": 1, + "maxLength": 80 + }, + "address": { + "type": "string", + "minLength": 5, + "maxLength": 200 + }, + "addressExtra": { + "anyOf": [ + { + "type": "string", + "maxLength": 200 + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "kind", + "departmentCode", + "department", + "cityCode", + "city", + "address" + ], + "additionalProperties": false }, { - "type": "null" + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "PICKUP" + }, + "pickupPointId": { + "type": "string", + "minLength": 1, + "maxLength": 64 + } + }, + "required": [ + "kind", + "pickupPointId" + ], + "additionalProperties": false } ] }, - "revokedAt": { + "items": { + "minItems": 1, + "maxItems": 20, + "type": "array", + "items": { + "type": "object", + "properties": { + "variantId": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "quantity": { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + }, + "required": [ + "variantId", + "quantity" + ], + "additionalProperties": false + } + }, + "discountCode": { + "description": "Optional discount code of this store (case-insensitive). It applies to products only, never to shipping.", "anyOf": [ { "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + "minLength": 1, + "maxLength": 40 }, { "type": "null" } ] - }, - "createdAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" - }, - "key": { - "type": "string" } }, "required": [ - "id", - "name", - "scope", - "keyPrefix", - "lastUsedAt", - "expiresAt", - "revokedAt", - "createdAt", - "key" + "buyer", + "delivery", + "items" ], "additionalProperties": false }, - "ApiKeyCreate": { + "MerchDiscountPreview": { "type": "object", "properties": { - "name": { + "discountCode": { "type": "string", "minLength": 1, - "maxLength": 120 + "maxLength": 40 }, - "scope": { - "default": "read", - "$ref": "#/components/schemas/ApiKeyScope" + "items": { + "minItems": 1, + "maxItems": 20, + "type": "array", + "items": { + "type": "object", + "properties": { + "variantId": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "quantity": { + "type": "integer", + "minimum": 1, + "maximum": 50 + } + }, + "required": [ + "variantId", + "quantity" + ], + "additionalProperties": false + } }, - "expiresAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" - } - }, - "required": [ - "name", - "scope" - ], - "additionalProperties": false - }, - "CustomerAuthRequest": { - "type": "object", - "properties": { - "email": { - "type": "string", - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + "delivery": { + "oneOf": [ + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "SHIPPING" + }, + "cityCode": { + "type": "string", + "pattern": "^\\d{5}$" + } + }, + "required": [ + "kind", + "cityCode" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "kind": { + "type": "string", + "const": "PICKUP" + } + }, + "required": [ + "kind" + ], + "additionalProperties": false + } + ] } }, "required": [ - "email" + "discountCode", + "items", + "delivery" ], "additionalProperties": false }, - "CustomerAuthRequestResult": { + "MerchDiscountPreviewResult": { "type": "object", "properties": { - "status": { + "discountCode": { "type": "string", - "const": "sent" + "description": "The code as the store saved it." }, - "sent_to": { - "type": "string", - "description": "Masked email (`c***@mail.com`). Never the full address." + "subtotal": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Products before the discount." }, - "expires_in": { + "discountAmount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "shippingFee": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "total": { "type": "integer", "minimum": -9007199254740991, "maximum": 9007199254740991, - "description": "Code lifetime, in seconds." + "description": "`total = subtotal - discountAmount + shippingFee`." } }, "required": [ - "status", - "sent_to", - "expires_in" + "discountCode", + "subtotal", + "discountAmount", + "shippingFee", + "total" ], "additionalProperties": false }, - "CustomerAuthVerify": { + "MerchOrderLookup": { "type": "object", "properties": { - "email": { - "type": "string", - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" - }, "code": { "type": "string", - "minLength": 6, - "maxLength": 6 + "minLength": 3, + "maxLength": 20 } }, "required": [ - "email", "code" ], "additionalProperties": false }, - "CustomerAuthVerifyResult": { + "MerchCardPayment": { "type": "object", "properties": { - "session_token": { + "token": { + "type": "string", + "minLength": 1, + "description": "Card token returned by the Payment Brick when tokenizing." + }, + "paymentMethodId": { "type": "string", - "description": "Usable as-is as the `X-Customer-Session` header on /api/v1/customer/*." + "minLength": 1, + "description": "`payment_method_id` returned by the Brick (e.g. `visa`, `debmaster`)." }, - "expires_in": { + "installments": { + "default": 1, "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "Session lifetime, in seconds." + "minimum": 1, + "maximum": 36 + }, + "issuerId": { + "description": "`issuer_id` returned by the Brick (card issuer). Optional: forwarded to MercadoPago as is when present.", + "type": "string", + "pattern": "^\\d{1,12}$" + }, + "payer": { + "type": "object", + "properties": { + "identification": { + "type": "object", + "properties": { + "type": { + "type": "string", + "minLength": 1 + }, + "number": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "type", + "number" + ], + "additionalProperties": false + } + }, + "additionalProperties": false } }, "required": [ - "session_token", - "expires_in" + "token", + "paymentMethodId", + "installments" ], "additionalProperties": false }, - "CustomerMe": { + "MerchCardPaymentResult": { "type": "object", "properties": { - "id": { - "type": "string" + "status": { + "type": "string", + "enum": [ + "approved", + "pending", + "rejected" + ], + "description": "`pending` is normal (bank authentication): the order is confirmed by webhook, poll the lookup. `rejected` is a business decline: the order stays pending until its reservation expires and the buyer can retry with another card." }, - "email": { + "code": { "type": "string" }, - "name": { + "message": { + "description": "Human-readable message. Only present with `rejected`.", "type": "string" - }, - "emailVerified": { - "type": "boolean" - }, - "expiresAt": { - "type": "string", - "description": "Buyer session expiry (ISO 8601)." } }, "required": [ - "id", - "email", - "name", - "emailVerified", - "expiresAt" + "status", + "code" ], "additionalProperties": false }, - "CustomerTicketItem": { + "MerchOrder": { "type": "object", "properties": { - "ticketTypeName": { + "code": { "type": "string" }, - "quantity": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "status": { + "type": "string", + "enum": [ + "PENDING", + "PAID", + "PREPARING", + "SHIPPED", + "DELIVERED", + "READY_FOR_PICKUP", + "PICKED_UP", + "CANCELLED", + "REFUNDED" + ] }, - "ticketCode": { + "currency": { "type": "string", - "description": "Opaque ticket code. The QR code must encode the validator URL (`https://admin.appfreeticket.com/dashboard/tickets/validar?code=`)." + "const": "COP" }, - "seatLabel": { - "description": "Exact seat for seated events (seats.io), or null.", + "reservedUntil": { "type": [ "string", "null" ] - } - }, - "required": [ - "ticketTypeName", - "quantity", - "ticketCode", - "seatLabel" - ], - "additionalProperties": false - }, - "CustomerSale": { - "type": "object", - "properties": { - "id": { - "type": "string" }, - "reference": { + "createdAt": { "type": "string" }, - "status": { - "type": "string" + "paidAt": { + "type": [ + "string", + "null" + ] }, - "event": { + "buyer": { "type": "object", "properties": { + "email": { + "type": "string" + }, "name": { "type": "string" }, - "slug": { + "phone": { "type": "string" } }, "required": [ + "email", "name", - "slug" + "phone" ], "additionalProperties": false }, - "eventDate": { - "type": "object", - "properties": { - "startsAt": { - "type": "string", - "description": "Event start instant in ISO 8601 UTC." + "fulfillment": { + "type": "string", + "enum": [ + "SHIPPING", + "PICKUP" + ] + }, + "shipping": { + "anyOf": [ + { + "type": "object", + "properties": { + "departmentCode": { + "type": [ + "string", + "null" + ] + }, + "department": { + "type": [ + "string", + "null" + ] + }, + "cityCode": { + "type": [ + "string", + "null" + ] + }, + "city": { + "type": [ + "string", + "null" + ] + }, + "address": { + "type": [ + "string", + "null" + ] + }, + "addressExtra": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "departmentCode", + "department", + "cityCode", + "city", + "address", + "addressExtra" + ], + "additionalProperties": false }, - "timezone": { - "type": "string", - "description": "IANA time zone of the event." + { + "type": "null" } - }, - "required": [ - "startsAt", - "timezone" - ], - "additionalProperties": false + ] + }, + "pickupPoint": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "address": { + "type": "string" + }, + "city": { + "type": [ + "string", + "null" + ] + }, + "schedule": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "address", + "city", + "schedule" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] }, "items": { "type": "array", "items": { - "$ref": "#/components/schemas/CustomerTicketItem" + "type": "object", + "properties": { + "variantId": { + "type": "string" + }, + "productName": { + "type": "string" + }, + "variantLabel": { + "type": "string" + }, + "sku": { + "type": "string" + }, + "quantity": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "unitPrice": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "imageUrl": { + "description": "First image of the variant's product at read time; null if the product has no image or was deleted.", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "variantId", + "productName", + "variantLabel", + "sku", + "quantity", + "unitPrice", + "imageUrl" + ], + "additionalProperties": false } }, - "total": { - "type": "number" + "subtotal": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Products before the discount, in COP." }, - "currency": { - "type": "string" - } - }, - "required": [ - "id", - "reference", - "status", - "event", - "eventDate", - "items", - "total", - "currency" - ], - "additionalProperties": false - }, - "CustomerTicketCancelResult": { - "type": "object", - "properties": { - "id": { - "type": "string" + "discountCode": { + "description": "Discount code frozen on the order; null if none was used.", + "type": [ + "string", + "null" + ] }, - "reference": { - "type": "string" + "discountAmount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "COP taken off the products: `total = subtotal - discountAmount + shippingFee`." }, - "status": { - "type": "string" - } - }, - "required": [ - "id", - "reference", - "status" - ], - "additionalProperties": false - }, - "CustomerLogout": { - "type": "object", - "properties": { - "revoked": { - "type": "boolean", - "description": "true if the session existed and was deleted; false if the token was no longer valid (it ends up closed either way)." - } - }, - "required": [ - "revoked" - ], - "additionalProperties": false - }, - "EnterpriseExchangeRequest": { - "type": "object", - "properties": { - "token": { - "type": "string", - "minLength": 1, - "maxLength": 256, - "description": "One-time token received on the landing page callback (format `{slug}.{token}`, forwarded as is)." - } - }, - "required": [ - "token" - ], - "additionalProperties": false - }, - "EnterpriseExchangeResponse": { - "type": "object", - "properties": { - "session_token": { - "type": "string", - "description": "Buyer session token. Send it as the `X-Customer-Session` header on /api/v1/customer/*." + "shippingFee": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "expires_at": { - "type": "string", - "description": "Session expiry (ISO 8601, 7-day sliding window)." + "total": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 }, - "customer": { + "tracking": { + "anyOf": [ + { + "type": "object", + "properties": { + "carrier": { + "type": [ + "string", + "null" + ] + }, + "carrierName": { + "type": [ + "string", + "null" + ] + }, + "carrierLabel": { + "type": [ + "string", + "null" + ] + }, + "trackingNumber": { + "type": [ + "string", + "null" + ] + }, + "trackingUrl": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "carrier", + "carrierName", + "carrierLabel", + "trackingNumber", + "trackingUrl" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "statusDates": { "type": "object", "properties": { - "id": { - "type": "string" + "paidAt": { + "type": [ + "string", + "null" + ] }, - "email": { - "type": "string" + "preparingAt": { + "type": [ + "string", + "null" + ] }, - "name": { - "type": "string" + "shippedAt": { + "type": [ + "string", + "null" + ] }, - "email_verified": { - "type": "boolean" + "deliveredAt": { + "type": [ + "string", + "null" + ] + }, + "readyForPickupAt": { + "type": [ + "string", + "null" + ] + }, + "pickedUpAt": { + "type": [ + "string", + "null" + ] + }, + "cancelledAt": { + "type": [ + "string", + "null" + ] + }, + "refundedAt": { + "type": [ + "string", + "null" + ] } }, "required": [ - "id", - "email", - "name", - "email_verified" + "paidAt", + "preparingAt", + "shippedAt", + "deliveredAt", + "readyForPickupAt", + "pickedUpAt", + "cancelledAt", + "refundedAt" ], "additionalProperties": false + }, + "mpPublicKey": { + "description": "Public key of the brand's own MercadoPago account, for the Payment Brick. null when the store has no connected account.", + "type": [ + "string", + "null" + ] } }, "required": [ - "session_token", - "expires_at", - "customer" + "code", + "status", + "currency", + "reservedUntil", + "createdAt", + "paidAt", + "buyer", + "fulfillment", + "shipping", + "pickupPoint", + "items", + "subtotal", + "discountCode", + "discountAmount", + "shippingFee", + "total", + "tracking", + "statusDates", + "mpPublicKey" ], "additionalProperties": false }, - "CustomerMembershipState": { + "MerchCatalog": { "type": "object", "properties": { - "active": { - "type": "boolean", - "description": "true only with an ACTIVE, unexpired membership in this workspace." - }, - "membership": { - "anyOf": [ - { + "store": { + "type": "object", + "properties": { + "brandName": { + "type": "string" + }, + "brandLogoUrl": { + "type": [ + "string", + "null" + ] + }, + "landingUrl": { + "type": [ + "string", + "null" + ] + }, + "support": { "type": "object", "properties": { - "id": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "PENDING", - "ACTIVE", - "EXPIRED", - "CANCELLED", - "PAUSED" - ] - }, - "plan": { - "$ref": "#/components/schemas/MembershipPlan" - }, - "startedAt": { + "phone": { "type": [ "string", "null" ] }, - "expiresAt": { - "description": "null = LIFETIME or a membership with no expiry.", + "isWhatsapp": { + "type": "boolean" + }, + "email": { "type": [ "string", "null" ] - }, - "autoRenew": { + } + }, + "required": [ + "phone", + "isWhatsapp", + "email" + ], + "additionalProperties": false + }, + "shipping": { + "type": "object", + "properties": { + "enabled": { "type": "boolean" + }, + "feeBogota": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "feeNational": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "freeShippingThreshold": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] } }, "required": [ - "id", - "status", - "plan", - "startedAt", - "expiresAt", - "autoRenew" + "enabled", + "feeBogota", + "feeNational", + "freeShippingThreshold" ], "additionalProperties": false }, - { - "type": "null" + "pickupEnabled": { + "type": "boolean" } - ] - } - }, - "required": [ - "active", - "membership" - ], - "additionalProperties": false - }, - "CustomerSubscribeRequest": { - "type": "object", - "properties": { - "planId": { - "type": "string", - "minLength": 1, - "description": "Id of an active MembershipPlan in the key's workspace." - } - }, - "required": [ - "planId" - ], - "additionalProperties": false - }, - "CustomerSubscribeResult": { - "type": "object", - "properties": { - "checkoutUrl": { - "type": "string", - "description": "Membership checkout URL on the canonical host. The landing page must redirect the buyer there." + }, + "required": [ + "brandName", + "brandLogoUrl", + "landingUrl", + "support", + "shipping", + "pickupEnabled" + ], + "additionalProperties": false }, - "planId": { - "type": "string" - } - }, - "required": [ - "checkoutUrl", - "planId" - ], - "additionalProperties": false - }, - "CustomerSubscriptionCancelResult": { - "type": "object", - "properties": { - "id": { - "type": "string" + "products": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "imageUrls": { + "type": "array", + "items": { + "type": "string" + } + }, + "options": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "values" + ], + "additionalProperties": false + } + }, + "maxPerOrder": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "membersOnly": { + "type": "boolean", + "description": "Only a buyer with an active membership in this organization can order it; anyone else gets 403 `MEMBERS_ONLY`. Show a lock." + }, + "status": { + "type": "string", + "enum": [ + "PUBLISHED", + "DRAFT" + ], + "description": "`DRAFT` only appears in preview responses (valid `X-Merch-Preview`). Drafts cannot be ordered." + }, + "variants": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "sku": { + "type": "string" + }, + "label": { + "type": "string" + }, + "attributes": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": {} + }, + "price": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "compareAtPrice": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "stock": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + } + }, + "required": [ + "id", + "sku", + "label", + "attributes", + "price", + "compareAtPrice", + "stock" + ], + "additionalProperties": false + } + } + }, + "required": [ + "id", + "slug", + "name", + "description", + "imageUrls", + "options", + "maxPerOrder", + "membersOnly", + "status", + "variants" + ], + "additionalProperties": false + } }, - "status": { - "type": "string", - "enum": [ - "PENDING", - "ACTIVE", - "EXPIRED", - "CANCELLED", - "PAUSED" - ] + "pickupPoints": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "address": { + "type": "string" + }, + "city": { + "type": [ + "string", + "null" + ] + }, + "schedule": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "name", + "address", + "city", + "schedule" + ], + "additionalProperties": false + } }, - "cancelledAt": { - "type": [ - "string", - "null" - ] - } - }, - "required": [ - "id", - "status", - "cancelledAt" - ], - "additionalProperties": false - }, - "CustomerSubscriptionCancelRequest": { - "type": "object", - "properties": { - "workspaceId": { - "description": "Required only without an enterprise service API key: which membership (by workspace) to cancel. Ignored with a key — the workspace is the one pinned to it.", + "currency": { "type": "string", - "minLength": 1 - } - }, - "additionalProperties": false - }, - "CustomerProfile": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" + "const": "COP" }, - "phone": { + "mpPublicKey": { + "description": "Public key of the brand's own MercadoPago account, for the Payment Brick. null in a preview when the store has no connected account yet.", "type": [ "string", "null" ] + }, + "preview": { + "type": "boolean", + "description": "`true` when the response honored a valid `X-Merch-Preview` token: it includes DRAFT products and the landing must not allow checkout." } }, "required": [ - "id", - "email", - "name", - "phone" + "store", + "products", + "pickupPoints", + "currency", + "mpPublicKey", + "preview" ], "additionalProperties": false }, - "CustomerProfileUpdate": { - "type": "object", - "properties": { - "name": { - "type": "string", - "minLength": 1, - "maxLength": 120 - }, - "phone": { - "description": "null or an empty string clears the phone.", - "anyOf": [ - { - "type": "string", - "maxLength": 30 - }, - { - "type": "null" - } - ] - } - }, - "additionalProperties": false - }, "CustomerAddress": { "type": "object", "properties": { @@ -30803,80 +33775,128 @@ ] }, "isDefault": { - "description": "Make it the default address (clears the previous default). The first address is always the default.", + "description": "Make it the default address (clears the previous default). The first address is always the default.", + "type": "boolean" + } + }, + "required": [ + "recipientName", + "departmentCode", + "cityCode", + "address" + ], + "additionalProperties": false + }, + "CustomerAddressUpdate": { + "type": "object", + "properties": { + "label": { + "description": "null or an empty string clears it.", + "anyOf": [ + { + "type": "string", + "maxLength": 60 + }, + { + "type": "null" + } + ] + }, + "recipientName": { + "type": "string", + "minLength": 2, + "maxLength": 120 + }, + "phone": { + "description": "null or an empty string clears it.", + "anyOf": [ + { + "type": "string", + "pattern": "^\\+?[0-9 -]{7,20}$" + }, + { + "type": "null" + } + ] + }, + "departmentCode": { + "type": "string", + "pattern": "^\\d{2}$" + }, + "cityCode": { + "type": "string", + "pattern": "^\\d{5}$" + }, + "address": { + "type": "string", + "minLength": 5, + "maxLength": 200 + }, + "addressExtra": { + "description": "null or an empty string clears it.", + "anyOf": [ + { + "type": "string", + "maxLength": 200 + }, + { + "type": "null" + } + ] + }, + "isDefault": { + "description": "`true` makes it the default (clears the previous one). `false` on the default address moves the default to the most recent other address; if it is the only one, it stays the default.", "type": "boolean" } }, - "required": [ - "recipientName", - "departmentCode", - "cityCode", - "address" - ], "additionalProperties": false }, - "CustomerAddressUpdate": { + "CustomerNewsletterState": { "type": "object", "properties": { - "label": { - "description": "null or an empty string clears it.", - "anyOf": [ - { - "type": "string", - "maxLength": 60 - }, - { - "type": "null" - } - ] - }, - "recipientName": { - "type": "string", - "minLength": 2, - "maxLength": 120 + "subscribed": { + "type": "boolean", + "description": "true while the buyer is subscribed to this workspace." }, - "phone": { - "description": "null or an empty string clears it.", - "anyOf": [ - { - "type": "string", - "pattern": "^\\+?[0-9 -]{7,20}$" - }, - { - "type": "null" - } + "subscribedAt": { + "description": "When the buyer last gave consent (the latest subscription or re-subscription); null when not subscribed.", + "type": [ + "string", + "null" ] + } + }, + "required": [ + "subscribed", + "subscribedAt" + ], + "additionalProperties": false + }, + "CustomerNewsletterSubscribe": { + "type": "object", + "properties": { + "consent": { + "type": "boolean", + "const": true, + "description": "Explicit consent to receive the newsletter. Must be `true`; the landing page sends it only after the buyer accepts the consent text." }, - "departmentCode": { - "type": "string", - "pattern": "^\\d{2}$" - }, - "cityCode": { + "consentTextVersion": { "type": "string", - "pattern": "^\\d{5}$" + "minLength": 1, + "maxLength": 40, + "description": "Version of the consent text the buyer accepted (e.g. `2026-11-v1`). Stored with each subscription or re-subscription." }, - "address": { + "source": { + "description": "Free-form origin of the sign-up (e.g. `footer`). Stored only on the first subscription.", "type": "string", - "minLength": 5, - "maxLength": 200 - }, - "addressExtra": { - "description": "null or an empty string clears it.", - "anyOf": [ - { - "type": "string", - "maxLength": 200 - }, - { - "type": "null" - } - ] - }, - "isDefault": { - "description": "`true` makes it the default (clears the previous one). `false` on the default address moves the default to the most recent other address; if it is the only one, it stays the default.", - "type": "boolean" + "minLength": 1, + "maxLength": 40 } }, + "required": [ + "consent", + "consentTextVersion" + ], "additionalProperties": false }, "PurchaseSessionCreateRequest": { @@ -31381,7 +34401,7 @@ "type": "null" } ], - "description": "Tickets with their `ticketCode`. ONLY present when `status` is `approved`; null in any other case. A code handed out before the payment settles would be a valid ticket with no money behind it." + "description": "Tickets. ONLY present when `status` is `approved`; null in any other case (a code handed out before the payment settles would be a valid ticket with no money behind it). Even when approved, each `ticketCode` follows the QR gate described on `CustomerTicketItem`." } }, "required": [ @@ -31394,6 +34414,194 @@ ], "additionalProperties": false }, + "CustomerOrderItem": { + "type": "object", + "properties": { + "ticketTypeId": { + "type": "string", + "minLength": 1 + }, + "quantity": { + "type": "integer", + "minimum": 1, + "maximum": 30 + }, + "seats": { + "description": "seats.io labels. Only for seated events.", + "maxItems": 30, + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 120 + } + } + }, + "required": [ + "ticketTypeId", + "quantity" + ], + "additionalProperties": false + }, + "CustomerOrderCreateRequest": { + "type": "object", + "properties": { + "eventDateId": { + "type": "string", + "minLength": 1 + }, + "items": { + "minItems": 1, + "maxItems": 1, + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerOrderItem" + } + }, + "holdToken": { + "description": "Hold token of the seats.io map session. Required if seats are sent.", + "type": "string", + "maxLength": 120 + }, + "discountCode": { + "type": "string", + "maxLength": 40 + }, + "buyer": { + "type": "object", + "properties": { + "name": { + "type": "string", + "minLength": 2, + "maxLength": 120 + }, + "phone": { + "type": "string", + "maxLength": 40 + }, + "idType": { + "type": "string", + "enum": [ + "CC", + "CE", + "NIT", + "PP", + "TI", + "PEP" + ] + }, + "idNumber": { + "type": "string", + "minLength": 5, + "maxLength": 20 + }, + "nitDigit": { + "description": "Check digit. Required if idType is NIT.", + "type": "string", + "maxLength": 1 + } + }, + "required": [ + "name", + "phone", + "idType", + "idNumber" + ], + "additionalProperties": false + }, + "returnUrl": { + "type": "string", + "maxLength": 2048, + "description": "Absolute URL of the landing page the buyer returns to. Validated against the enterprise domain allowlist and the workspace that owns the event; if it fails validation it is ignored and the purchase proceeds as usual." + } + }, + "required": [ + "eventDateId", + "items", + "buyer", + "returnUrl" + ], + "additionalProperties": false + }, + "ContentVideo": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "durationSeconds": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "posterUrl": { + "type": [ + "string", + "null" + ] + }, + "series": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + } + }, + "required": [ + "id", + "title" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "memberOnly": { + "type": "boolean", + "description": "true = only current members of the organization can play it." + }, + "publishedAt": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "title", + "description", + "durationSeconds", + "posterUrl", + "series", + "memberOnly", + "publishedAt" + ], + "additionalProperties": false + }, "ContentPostUpdate": { "type": "object", "properties": { @@ -32534,336 +35742,858 @@ "pendingCount", "endsAt", "publishedAt", - "cancelledAt", - "local", - "attendees", - "requests" + "cancelledAt", + "local", + "attendees", + "requests" + ], + "additionalProperties": false + }, + "CommunityMeetupRsvpReview": { + "type": "object", + "properties": { + "decision": { + "type": "string", + "enum": [ + "APPROVE", + "REJECT" + ] + } + }, + "required": [ + "decision" + ], + "additionalProperties": false + }, + "CommunityMeetupRsvpReviewed": { + "type": "object", + "properties": { + "rsvpId": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "GOING", + "DECLINED" + ] + } + }, + "required": [ + "rsvpId", + "status" + ], + "additionalProperties": false + }, + "CommunityMeetupAttendance": { + "type": "object", + "properties": { + "rsvpId": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "attended": { + "type": "boolean" + } + }, + "required": [ + "rsvpId", + "attended" + ], + "additionalProperties": false + }, + "CommunityMeetupAttendanceResult": { + "type": "object", + "properties": { + "rsvpId": { + "type": "string" + }, + "attended": { + "type": "boolean" + }, + "changed": { + "type": "boolean", + "description": "false = already in that state, or the RSVP is not GOING / the meetup is cancelled." + } + }, + "required": [ + "rsvpId", + "attended", + "changed" + ], + "additionalProperties": false + }, + "ContentPost": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "TEXT", + "IMAGE", + "VIDEO", + "ARTICLE" + ] + }, + "content": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "description": "ARTICLE post: also serves as the article's cover image.", + "type": [ + "string", + "null" + ] + }, + "videoId": { + "description": "VIDEO post: id of the ContentVideo, to cross-reference with `GET /content/videos`.", + "type": [ + "string", + "null" + ] + }, + "eventId": { + "type": [ + "string", + "null" + ] + }, + "locked": { + "type": "boolean", + "description": "true = post restricted to current members; its content arrives redacted." + }, + "title": { + "description": "ARTICLE posts only; null for every other type.", + "type": [ + "string", + "null" + ] + }, + "subtitle": { + "description": "ARTICLE posts only.", + "type": [ + "string", + "null" + ] + }, + "slug": { + "description": "ARTICLE posts only. Permalink at /comunidades/articulos/{slug}, unique per organization.", + "type": [ + "string", + "null" + ] + }, + "body": { + "description": "ARTICLE posts only. Body in Markdown.", + "type": [ + "string", + "null" + ] + }, + "readingMinutes": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ], + "description": "ARTICLE posts only. Not redacted when `locked`: it does not leak content, only its length." + }, + "link": { + "anyOf": [ + { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "domain": { + "type": "string" + } + }, + "required": [ + "url", + "title", + "description", + "imageUrl", + "domain" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ], + "description": "Open Graph snapshot of the first link in the text. Always null for ARTICLE posts." + }, + "commentsCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Visible comments: excludes deleted ones and those hidden by moderation (and replies to a hidden comment). 0 if the post arrives redacted." + }, + "publishedAt": { + "type": "string" + } + }, + "required": [ + "id", + "type", + "content", + "imageUrl", + "videoId", + "eventId", + "locked", + "title", + "subtitle", + "slug", + "body", + "readingMinutes", + "link", + "commentsCount", + "publishedAt" + ], + "additionalProperties": false + }, + "ContentPostCreate": { + "type": "object", + "properties": { + "type": { + "default": "TEXT", + "type": "string", + "enum": [ + "TEXT", + "IMAGE", + "ARTICLE" + ] + }, + "content": { + "type": "string", + "maxLength": 5000 + }, + "imageUrl": { + "anyOf": [ + { + "type": "string", + "maxLength": 2048, + "format": "uri" + }, + { + "type": "null" + } + ] + }, + "title": { + "description": "Required when type=ARTICLE.", + "type": "string", + "minLength": 1, + "maxLength": 140 + }, + "subtitle": { + "anyOf": [ + { + "type": "string", + "maxLength": 280 + }, + { + "type": "null" + } + ] + }, + "slug": { + "description": "Manual; if omitted it is derived from the title.", + "anyOf": [ + { + "type": "string", + "maxLength": 200 + }, + { + "type": "null" + } + ] + }, + "body": { + "description": "Markdown. Required when type=ARTICLE.", + "type": "string", + "minLength": 1, + "maxLength": 100000 + }, + "locked": { + "default": false, + "description": "true = restricted to current members.", + "type": "boolean" + }, + "eventId": { + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } + ] + }, + "publishedAt": { + "type": "string", + "format": "date-time", + "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" + } + }, + "required": [ + "type", + "locked" + ], + "additionalProperties": false + }, + "ContentMediaDeleted": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "deleted": { + "type": "boolean", + "const": true + } + }, + "required": [ + "id", + "deleted" + ], + "additionalProperties": false + }, + "ContentVideoUpdate": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "description": { + "description": "`null` or empty clears the description.", + "type": [ + "string", + "null" + ] + }, + "memberOnly": { + "description": "true = only current members can play it.", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "ContentVideoSummary": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "memberOnly": { + "type": "boolean" + } + }, + "required": [ + "id", + "title", + "description", + "memberOnly" + ], + "additionalProperties": false + }, + "ContentVideoPublish": { + "type": "object", + "properties": { + "published": { + "type": "boolean" + } + }, + "required": [ + "published" + ], + "additionalProperties": false + }, + "ContentVideoPublished": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "published": { + "type": "boolean" + } + }, + "required": [ + "id", + "published" + ], + "additionalProperties": false + }, + "ContentVideoSeriesAssign": { + "type": "object", + "properties": { + "seriesId": { + "anyOf": [ + { + "type": "string", + "minLength": 1 + }, + { + "type": "null" + } + ], + "description": "Series to put the video in; `null` removes it from its series." + } + }, + "required": [ + "seriesId" + ], + "additionalProperties": false + }, + "ContentVideoSeriesResult": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "seriesId": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "seriesId" + ], + "additionalProperties": false + }, + "ContentSeries": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "coverImageUrl": { + "type": [ + "string", + "null" + ] + }, + "memberOnly": { + "type": "boolean" + }, + "published": { + "type": "boolean" + }, + "publishedAt": { + "type": [ + "string", + "null" + ] + }, + "videoCount": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Videos in the series (published or not, course videos excluded)." + }, + "createdAt": { + "type": "string" + } + }, + "required": [ + "id", + "title", + "description", + "coverImageUrl", + "memberOnly", + "published", + "publishedAt", + "videoCount", + "createdAt" ], "additionalProperties": false }, - "CommunityMeetupRsvpReview": { + "ContentSeriesCreate": { "type": "object", "properties": { - "decision": { + "title": { "type": "string", - "enum": [ - "APPROVE", - "REJECT" + "description": "1–120 characters." + }, + "description": { + "description": "Up to 2000 characters.", + "type": [ + "string", + "null" ] + }, + "coverImageUrl": { + "description": "Absolute URL of the cover.", + "type": [ + "string", + "null" + ] + }, + "memberOnly": { + "description": "Default true.", + "type": "boolean" } }, "required": [ - "decision" + "title" ], "additionalProperties": false }, - "CommunityMeetupRsvpReviewed": { + "ContentSeriesUpdate": { "type": "object", "properties": { - "rsvpId": { + "title": { "type": "string" }, - "status": { - "type": "string", - "enum": [ - "GOING", - "DECLINED" + "description": { + "description": "`null` clears it.", + "type": [ + "string", + "null" + ] + }, + "coverImageUrl": { + "description": "`null` clears it.", + "type": [ + "string", + "null" ] + }, + "memberOnly": { + "type": "boolean" } }, - "required": [ - "rsvpId", - "status" - ], "additionalProperties": false }, - "CommunityMeetupAttendance": { + "ContentSeriesPublish": { "type": "object", "properties": { - "rsvpId": { - "type": "string", - "minLength": 1, - "maxLength": 64 - }, - "attended": { + "published": { "type": "boolean" } }, "required": [ - "rsvpId", - "attended" + "published" ], "additionalProperties": false }, - "CommunityMeetupAttendanceResult": { + "ContentLiveCreate": { "type": "object", "properties": { - "rsvpId": { - "type": "string" + "title": { + "type": "string", + "description": "1–120 characters." }, - "attended": { + "eventDateId": { + "description": "Show date to tie the stream to (owned by the workspace or with the workspace as a linked artist). One stream per date.", + "type": [ + "string", + "null" + ] + }, + "memberOnly": { + "description": "Default true. Ignored (stream is public) when the workspace has no active membership plan.", "type": "boolean" }, - "changed": { - "type": "boolean", - "description": "false = already in that state, or the RSVP is not GOING / the meetup is cancelled." + "replayEnabled": { + "description": "Default false. Keeps the recording available for 24 hours after the stream ends, to the same audience as the live (members, ticket holders, or everyone if public). Same as the dashboard's \"Guardar repetición\" option.", + "type": "boolean" + }, + "scheduledAt": { + "description": "Wall-clock time \"YYYY-MM-DDTHH:mm\" in the WORKSPACE time zone (not UTC, no offset). Must be in the future and at most 2 years ahead. Absent: inherits the show date's start time when `eventDateId` is set.", + "type": [ + "string", + "null" + ] } }, "required": [ - "rsvpId", - "attended", - "changed" + "title" ], "additionalProperties": false }, - "ContentPost": { + "ContentLiveCreated": { "type": "object", "properties": { "id": { "type": "string" }, - "type": { - "type": "string", - "enum": [ - "TEXT", - "IMAGE", - "VIDEO", - "ARTICLE" - ] + "title": { + "type": "string" }, - "content": { - "type": [ - "string", - "null" - ] + "memberOnly": { + "type": "boolean" }, - "imageUrl": { - "description": "ARTICLE post: also serves as the article's cover image.", - "type": [ - "string", - "null" - ] + "replayEnabled": { + "type": "boolean" }, - "videoId": { - "description": "VIDEO post: id of the ContentVideo, to cross-reference with `GET /content/videos`.", + "scheduledAt": { + "description": "UTC ISO 8601.", "type": [ "string", "null" ] }, - "eventId": { + "eventDateId": { "type": [ "string", "null" ] }, - "locked": { - "type": "boolean", - "description": "true = post restricted to current members; its content arrives redacted." + "rtmpUrl": { + "type": "string", + "description": "RTMPS ingest server for OBS / the encoder." }, - "title": { - "description": "ARTICLE posts only; null for every other type.", - "type": [ - "string", - "null" - ] + "streamKey": { + "type": "string", + "description": "SECRET. RTMP stream key: whoever has it can broadcast on this stream in the organization's name. Store it like a password; it is never returned by any read endpoint. Rotate it with `POST /content/lives/{id}/reset-key`." + } + }, + "required": [ + "id", + "title", + "memberOnly", + "replayEnabled", + "scheduledAt", + "eventDateId", + "rtmpUrl", + "streamKey" + ], + "additionalProperties": false + }, + "ContentLiveStreamKey": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "subtitle": { - "description": "ARTICLE posts only.", - "type": [ - "string", - "null" - ] + "rtmpUrl": { + "type": "string" }, - "slug": { - "description": "ARTICLE posts only. Permalink at /comunidades/articulos/{slug}, unique per organization.", + "streamKey": { + "type": "string", + "description": "SECRET. RTMP stream key: whoever has it can broadcast on this stream in the organization's name. Store it like a password; it is never returned by any read endpoint. Rotate it with `POST /content/lives/{id}/reset-key`." + } + }, + "required": [ + "id", + "rtmpUrl", + "streamKey" + ], + "additionalProperties": false + }, + "ContentLiveUpdate": { + "type": "object", + "properties": { + "scheduledAt": { + "description": "Wall-clock time \"YYYY-MM-DDTHH:mm\" in the WORKSPACE time zone (not UTC, no offset). Must be in the future and at most 2 years ahead. `null` removes the scheduled time. Only while the stream is IDLE.", "type": [ "string", "null" ] }, - "body": { - "description": "ARTICLE posts only. Body in Markdown.", + "memberOnly": { + "type": "boolean" + }, + "replayEnabled": { + "description": "Keeps the recording available for 24 hours after the stream ends, to the same audience as the live (members, ticket holders, or everyone if public). Same as the dashboard's \"Guardar repetición\" option. Can be changed anytime; the 24 hours always count from the end of the stream.", + "type": "boolean" + } + }, + "additionalProperties": false + }, + "ContentLiveSettings": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "memberOnly": { + "type": "boolean" + }, + "replayEnabled": { + "type": "boolean" + }, + "scheduledAt": { + "description": "UTC ISO 8601.", "type": [ "string", "null" ] - }, - "readingMinutes": { - "anyOf": [ - { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - { - "type": "null" - } - ], - "description": "ARTICLE posts only. Not redacted when `locked`: it does not leak content, only its length." - }, - "link": { - "anyOf": [ - { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "title": { - "type": [ - "string", - "null" - ] - }, - "description": { - "type": [ - "string", - "null" - ] - }, - "imageUrl": { - "type": [ - "string", - "null" - ] - }, - "domain": { - "type": "string" - } + } + }, + "required": [ + "id", + "memberOnly", + "replayEnabled", + "scheduledAt" + ], + "additionalProperties": false + }, + "ContentLiveChat": { + "type": "object", + "properties": { + "messages": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "required": [ - "url", - "title", - "description", - "imageUrl", - "domain" - ], - "additionalProperties": false + "authorId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "text": { + "type": "string" + }, + "sentAt": { + "type": "string" + }, + "host": { + "description": "Present (true) on messages sent by the organization.", + "type": "boolean" + } }, - { - "type": "null" - } - ], - "description": "Open Graph snapshot of the first link in the text. Always null for ARTICLE posts." - }, - "commentsCount": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "Visible comments: excludes deleted ones and those hidden by moderation (and replies to a hidden comment). 0 if the post arrives redacted." + "required": [ + "id", + "authorId", + "name", + "text", + "sentAt" + ], + "additionalProperties": false + } }, - "publishedAt": { - "type": "string" + "truncated": { + "type": "boolean", + "description": "true if the history cap was reached and the oldest messages are missing." } }, "required": [ - "id", - "type", - "content", - "imageUrl", - "videoId", - "eventId", - "locked", - "title", - "subtitle", - "slug", - "body", - "readingMinutes", - "link", - "commentsCount", - "publishedAt" + "messages", + "truncated" ], "additionalProperties": false }, - "ContentPostCreate": { + "ContentLive": { "type": "object", "properties": { - "type": { - "default": "TEXT", - "type": "string", - "enum": [ - "TEXT", - "IMAGE", - "ARTICLE" - ] - }, - "content": { - "type": "string", - "maxLength": 5000 - }, - "imageUrl": { - "anyOf": [ - { - "type": "string", - "maxLength": 2048, - "format": "uri" - }, - { - "type": "null" - } - ] + "id": { + "type": "string" }, "title": { - "description": "Required when type=ARTICLE.", + "type": "string" + }, + "status": { "type": "string", - "minLength": 1, - "maxLength": 140 + "enum": [ + "IDLE", + "ACTIVE", + "COMPLETED", + "DISABLED" + ], + "description": "ACTIVE = streaming right now (live banner)." }, - "subtitle": { - "anyOf": [ - { - "type": "string", - "maxLength": 280 - }, - { - "type": "null" - } + "memberOnly": { + "type": "boolean" + }, + "startedAt": { + "type": [ + "string", + "null" ] }, - "slug": { - "description": "Manual; if omitted it is derived from the title.", - "anyOf": [ - { - "type": "string", - "maxLength": 200 - }, - { - "type": "null" - } + "endedAt": { + "type": [ + "string", + "null" ] }, - "body": { - "description": "Markdown. Required when type=ARTICLE.", - "type": "string", - "minLength": 1, - "maxLength": 100000 + "hasRecording": { + "type": "boolean", + "description": "true if the recording is playable by the audience right now (replay enabled and within 24 hours of the end)." }, - "locked": { - "default": false, - "description": "true = restricted to current members.", - "type": "boolean" + "replayEnabled": { + "type": "boolean", + "description": "Keep the recording 24 hours after the end for the live's audience." }, - "eventId": { - "anyOf": [ - { - "type": "string", - "minLength": 1 - }, - { - "type": "null" - } + "replayUntil": { + "description": "UTC ISO 8601 end of the replay window (may be in the past). null while there is no replay: disabled, on air, not ended or recording not ready yet.", + "type": [ + "string", + "null" ] - }, - "publishedAt": { - "type": "string", - "format": "date-time", - "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$" } }, "required": [ - "type", - "locked" + "id", + "title", + "status", + "memberOnly", + "startedAt", + "endedAt", + "hasRecording", + "replayEnabled", + "replayUntil" ], "additionalProperties": false }, @@ -33015,6 +36745,57 @@ ], "additionalProperties": false }, + "CourtesyRequestCreate": { + "type": "object", + "properties": { + "fullName": { + "type": "string", + "minLength": 2, + "maxLength": 120 + }, + "email": { + "type": "string", + "maxLength": 254, + "format": "email", + "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "companion": { + "type": "object", + "properties": { + "fullName": { + "type": "string", + "minLength": 2, + "maxLength": 120 + } + }, + "required": [ + "fullName" + ], + "additionalProperties": false + } + }, + "required": [ + "fullName", + "email" + ], + "additionalProperties": false + }, + "CourtesyRequestResult": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "createdAt": { + "type": "string" + } + }, + "required": [ + "id", + "createdAt" + ], + "additionalProperties": false + }, "LiveAttendance": { "type": "object", "properties": { @@ -35986,202 +39767,663 @@ "propertyNames": { "type": "string" }, - "additionalProperties": { - "type": "string" + "additionalProperties": { + "type": "string" + } + }, + "sku": { + "type": "string", + "minLength": 1, + "maxLength": 64, + "description": "Unique in the whole store (case-insensitive). Letters, digits, `.`, `-`, `_`." + }, + "price": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "COP, integer, VAT included." + }, + "compareAtPrice": { + "description": "Strikethrough price; must be greater than `price`.", + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "stock": { + "type": "integer", + "minimum": 0, + "maximum": 9007199254740991 + }, + "isActive": { + "type": "boolean" + } + }, + "required": [ + "sku", + "price", + "stock" + ], + "additionalProperties": false + } + }, + "imageUrls": { + "description": "Ordered photos (the first is the cover). Each must be a `publicUrl` returned by `POST /merch/products/images/upload-url` for this organization. External URLs are rejected (they are never fetched).", + "maxItems": 10, + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "maxPerOrder", + "variants" + ], + "additionalProperties": false + }, + "MerchProductStatusUpdate": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "DRAFT", + "PUBLISHED" + ] + } + }, + "required": [ + "status" + ], + "additionalProperties": false + }, + "MerchProductImagesUpdate": { + "type": "object", + "properties": { + "imageUrls": { + "maxItems": 10, + "type": "array", + "items": { + "type": "string" + }, + "description": "Full ordered list (replaces the current one; the first is the cover). Each URL must be a `publicUrl` from `POST /merch/products/images/upload-url` for this organization, or one the product already has. Photos that leave the list are deleted from storage." + } + }, + "required": [ + "imageUrls" + ], + "additionalProperties": false + }, + "MerchImageUploadRequest": { + "type": "object", + "properties": { + "mimeType": { + "type": "string", + "enum": [ + "image/jpeg", + "image/png", + "image/webp" + ] + }, + "sizeBytes": { + "type": "integer", + "exclusiveMinimum": 0, + "maximum": 6291456, + "description": "File size in bytes (max 6 MB)." + } + }, + "required": [ + "mimeType", + "sizeBytes" + ], + "additionalProperties": false + }, + "MerchImageUpload": { + "type": "object", + "properties": { + "uploadUrl": { + "type": "string", + "description": "Signed storage URL. `PUT` the raw file bytes to it with the same `Content-Type` as `mimeType`, no auth header. Single use." + }, + "publicUrl": { + "type": "string", + "description": "Final public URL of the photo once uploaded. Pass it in `imageUrls`." + } + }, + "required": [ + "uploadUrl", + "publicUrl" + ], + "additionalProperties": false + }, + "MerchAdminProduct": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "status": { + "type": "string", + "enum": [ + "DRAFT", + "PUBLISHED" + ] + }, + "imageUrls": { + "type": "array", + "items": { + "type": "string" + } + }, + "options": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "values": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "values" + ], + "additionalProperties": false + } + }, + "maxPerOrder": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "maxPerCustomer": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "membersOnly": { + "type": "boolean" + }, + "sortOrder": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "publishedAt": { + "type": [ + "string", + "null" + ] + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "variants": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "sku": { + "type": "string" + }, + "label": { + "type": "string" + }, + "attributes": { + "type": "object", + "propertyNames": { + "type": "string" + }, + "additionalProperties": { + "type": "string" + } + }, + "price": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "compareAtPrice": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "stock": { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + "isActive": { + "type": "boolean" + } + }, + "required": [ + "id", + "sku", + "label", + "attributes", + "price", + "compareAtPrice", + "stock", + "isActive" + ], + "additionalProperties": false + } + } + }, + "required": [ + "id", + "slug", + "name", + "description", + "status", + "imageUrls", + "options", + "maxPerOrder", + "maxPerCustomer", + "membersOnly", + "sortOrder", + "publishedAt", + "createdAt", + "updatedAt", + "variants" + ], + "additionalProperties": false + }, + "CustomerCommunityPost": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "TEXT", + "IMAGE", + "VIDEO", + "ARTICLE" + ] + }, + "publishedAt": { + "type": "string" + }, + "pinned": { + "type": "boolean", + "description": "The post is pinned. Same meaning in the feed and in the permalink." + }, + "membersOnly": { + "type": "boolean", + "description": "The organization marked this post as members-only content." + }, + "locked": { + "type": "boolean", + "description": "Redacted for THIS reader: members-only and the reader has no current membership. `content`, `video`, `link`, `linkedEvent`, `author` and `body` are null, `commentsCount` is 0; an ARTICLE keeps its cover, title and hand-written subtitle as the teaser." + }, + "content": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "title": { + "description": "ARTICLE only.", + "type": [ + "string", + "null" + ] + }, + "subtitle": { + "description": "ARTICLE only: subtitle, or an excerpt when not locked.", + "type": [ + "string", + "null" + ] + }, + "slug": { + "description": "ARTICLE only: permalink slug, accepted by `GET /customer/community/posts/{id}`.", + "type": [ + "string", + "null" + ] + }, + "readingMinutes": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ] + }, + "video": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Pass to `POST /content/playback-token` as kind `video`." + }, + "title": { + "type": "string" + }, + "thumbnailUrl": { + "description": "Signed URL, valid for 24 hours.", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "title", + "thumbnailUrl" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "link": { + "anyOf": [ + { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "domain": { + "type": "string" + } + }, + "required": [ + "url", + "title", + "description", + "imageUrl", + "domain" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ], + "description": "Open Graph snapshot of the first link in the text." + }, + "linkedEvent": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "venueName": { + "type": [ + "string", + "null" + ] + }, + "venueAddress": { + "type": [ + "string", + "null" + ] + }, + "startsAt": { + "type": [ + "string", + "null" + ] + }, + "timezone": { + "type": "string" + } + }, + "required": [ + "name", + "slug", + "imageUrl", + "venueName", + "venueAddress", + "startsAt", + "timezone" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "author": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Public display name (member alias or first name only)." + }, + "handle": { + "description": "Member `@alias`, without the `@`.", + "type": [ + "string", + "null" + ] + }, + "avatarUrl": { + "type": [ + "string", + "null" + ] } }, - "sku": { - "type": "string", - "minLength": 1, - "maxLength": 64, - "description": "Unique in the whole store (case-insensitive). Letters, digits, `.`, `-`, `_`." - }, - "price": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991, - "description": "COP, integer, VAT included." - }, - "compareAtPrice": { - "description": "Strikethrough price; must be greater than `price`.", - "anyOf": [ - { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - { - "type": "null" - } - ] - }, - "stock": { - "type": "integer", - "minimum": 0, - "maximum": 9007199254740991 - }, - "isActive": { - "type": "boolean" - } + "required": [ + "name", + "handle", + "avatarUrl" + ], + "additionalProperties": false }, - "required": [ - "sku", - "price", - "stock" - ], - "additionalProperties": false - } + { + "type": "null" + } + ], + "description": "Set on a member's post; null when the organization published it." }, - "imageUrls": { - "description": "Ordered photos (the first is the cover). Each must be a `publicUrl` returned by `POST /merch/products/images/upload-url` for this organization. External URLs are rejected (they are never fetched).", - "maxItems": 10, - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "name", - "maxPerOrder", - "variants" - ], - "additionalProperties": false - }, - "MerchProductStatusUpdate": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "DRAFT", - "PUBLISHED" - ] - } - }, - "required": [ - "status" - ], - "additionalProperties": false - }, - "MerchProductImagesUpdate": { - "type": "object", - "properties": { - "imageUrls": { - "maxItems": 10, - "type": "array", - "items": { - "type": "string" - }, - "description": "Full ordered list (replaces the current one; the first is the cover). Each URL must be a `publicUrl` from `POST /merch/products/images/upload-url` for this organization, or one the product already has. Photos that leave the list are deleted from storage." - } - }, - "required": [ - "imageUrls" - ], - "additionalProperties": false - }, - "MerchImageUploadRequest": { - "type": "object", - "properties": { - "mimeType": { - "type": "string", - "enum": [ - "image/jpeg", - "image/png", - "image/webp" - ] + "isMine": { + "type": "boolean", + "description": "The session buyer wrote this post." }, - "sizeBytes": { + "commentsCount": { "type": "integer", - "exclusiveMinimum": 0, - "maximum": 6291456, - "description": "File size in bytes (max 6 MB)." - } - }, - "required": [ - "mimeType", - "sizeBytes" - ], - "additionalProperties": false - }, - "MerchImageUpload": { - "type": "object", - "properties": { - "uploadUrl": { - "type": "string", - "description": "Signed storage URL. `PUT` the raw file bytes to it with the same `Content-Type` as `mimeType`, no auth header. Single use." + "minimum": -9007199254740991, + "maximum": 9007199254740991, + "description": "Visible comments." }, - "publicUrl": { - "type": "string", - "description": "Final public URL of the photo once uploaded. Pass it in `imageUrls`." + "myReaction": { + "description": "null without a buyer session; otherwise whether the buyer reacted.", + "type": [ + "boolean", + "null" + ] } }, "required": [ - "uploadUrl", - "publicUrl" + "id", + "type", + "publishedAt", + "pinned", + "membersOnly", + "locked", + "content", + "imageUrl", + "title", + "subtitle", + "slug", + "readingMinutes", + "video", + "link", + "linkedEvent", + "author", + "isMine", + "commentsCount", + "myReaction" ], "additionalProperties": false }, - "MerchAdminProduct": { + "CustomerCommunityPostDetail": { "type": "object", "properties": { "id": { "type": "string" }, - "slug": { - "type": "string" + "type": { + "type": "string", + "enum": [ + "TEXT", + "IMAGE", + "VIDEO", + "ARTICLE" + ] }, - "name": { + "publishedAt": { "type": "string" }, - "description": { + "pinned": { + "type": "boolean", + "description": "The post is pinned. Same meaning in the feed and in the permalink." + }, + "membersOnly": { + "type": "boolean", + "description": "The organization marked this post as members-only content." + }, + "locked": { + "type": "boolean", + "description": "Redacted for THIS reader: members-only and the reader has no current membership. `content`, `video`, `link`, `linkedEvent`, `author` and `body` are null, `commentsCount` is 0; an ARTICLE keeps its cover, title and hand-written subtitle as the teaser." + }, + "content": { "type": [ "string", "null" ] }, - "status": { - "type": "string", - "enum": [ - "DRAFT", - "PUBLISHED" + "imageUrl": { + "type": [ + "string", + "null" ] }, - "imageUrls": { - "type": "array", - "items": { - "type": "string" - } + "title": { + "description": "ARTICLE only.", + "type": [ + "string", + "null" + ] }, - "options": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "values": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "name", - "values" - ], - "additionalProperties": false - } + "subtitle": { + "description": "ARTICLE only: subtitle, or an excerpt when not locked.", + "type": [ + "string", + "null" + ] }, - "maxPerOrder": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 + "slug": { + "description": "ARTICLE only: permalink slug, accepted by `GET /customer/community/posts/{id}`.", + "type": [ + "string", + "null" + ] }, - "maxPerCustomer": { + "readingMinutes": { "anyOf": [ { "type": "integer", @@ -36193,533 +40435,728 @@ } ] }, - "membersOnly": { - "type": "boolean" + "video": { + "anyOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Pass to `POST /content/playback-token` as kind `video`." + }, + "title": { + "type": "string" + }, + "thumbnailUrl": { + "description": "Signed URL, valid for 24 hours.", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "title", + "thumbnailUrl" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] }, - "sortOrder": { + "link": { + "anyOf": [ + { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "title": { + "type": [ + "string", + "null" + ] + }, + "description": { + "type": [ + "string", + "null" + ] + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "domain": { + "type": "string" + } + }, + "required": [ + "url", + "title", + "description", + "imageUrl", + "domain" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ], + "description": "Open Graph snapshot of the first link in the text." + }, + "linkedEvent": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "imageUrl": { + "type": [ + "string", + "null" + ] + }, + "venueName": { + "type": [ + "string", + "null" + ] + }, + "venueAddress": { + "type": [ + "string", + "null" + ] + }, + "startsAt": { + "type": [ + "string", + "null" + ] + }, + "timezone": { + "type": "string" + } + }, + "required": [ + "name", + "slug", + "imageUrl", + "venueName", + "venueAddress", + "startsAt", + "timezone" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ] + }, + "author": { + "anyOf": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Public display name (member alias or first name only)." + }, + "handle": { + "description": "Member `@alias`, without the `@`.", + "type": [ + "string", + "null" + ] + }, + "avatarUrl": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "name", + "handle", + "avatarUrl" + ], + "additionalProperties": false + }, + { + "type": "null" + } + ], + "description": "Set on a member's post; null when the organization published it." + }, + "isMine": { + "type": "boolean", + "description": "The session buyer wrote this post." + }, + "commentsCount": { "type": "integer", "minimum": -9007199254740991, - "maximum": 9007199254740991 + "maximum": 9007199254740991, + "description": "Visible comments." }, - "publishedAt": { + "myReaction": { + "description": "null without a buyer session; otherwise whether the buyer reacted.", "type": [ - "string", + "boolean", "null" ] }, - "createdAt": { + "body": { + "description": "ARTICLE body in Markdown. null when locked or not an ARTICLE.", + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "id", + "type", + "publishedAt", + "pinned", + "membersOnly", + "locked", + "content", + "imageUrl", + "title", + "subtitle", + "slug", + "readingMinutes", + "video", + "link", + "linkedEvent", + "author", + "isMine", + "commentsCount", + "myReaction", + "body" + ], + "additionalProperties": false + }, + "CustomerCommunityComment": { + "type": "object", + "properties": { + "id": { "type": "string" }, - "updatedAt": { + "body": { "type": "string" }, - "variants": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "sku": { - "type": "string" - }, - "label": { - "type": "string" - }, - "attributes": { - "type": "object", - "propertyNames": { - "type": "string" - }, - "additionalProperties": { - "type": "string" - } - }, - "price": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "compareAtPrice": { - "anyOf": [ - { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - { - "type": "null" - } - ] - }, - "stock": { - "type": "integer", - "minimum": -9007199254740991, - "maximum": 9007199254740991 - }, - "isActive": { - "type": "boolean" - } + "author": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Public display name (member alias or first name only)." }, - "required": [ - "id", - "sku", - "label", - "attributes", - "price", - "compareAtPrice", - "stock", - "isActive" - ], - "additionalProperties": false - } + "handle": { + "description": "Member `@alias`, without the `@`.", + "type": [ + "string", + "null" + ] + }, + "avatarUrl": { + "type": [ + "string", + "null" + ] + } + }, + "required": [ + "name", + "handle", + "avatarUrl" + ], + "additionalProperties": false + }, + "createdAt": { + "type": "string" + }, + "parentId": { + "description": "Reply to another comment (one level of threading).", + "type": [ + "string", + "null" + ] + }, + "isMine": { + "type": "boolean" } }, "required": [ "id", - "slug", - "name", - "description", - "status", - "imageUrls", - "options", - "maxPerOrder", - "maxPerCustomer", - "membersOnly", - "sortOrder", - "publishedAt", + "body", + "author", "createdAt", - "updatedAt", - "variants" + "parentId", + "isMine" ], "additionalProperties": false }, - "SaleRefundRequest": { - "type": "object", - "properties": { - "acknowledge_manual": { - "type": "boolean" - }, - "items": { - "minItems": 1, - "maxItems": 200, - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 64 - } - }, - "block_seats": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - "SaleRefundResult": { + "CustomerCommunityMeetup": { "type": "object", "properties": { "id": { "type": "string" }, - "reference": { + "title": { "type": "string" }, - "status": { + "format": { "type": "string", "enum": [ - "PENDING", - "CONFIRMED", - "ABANDONED", - "CANCELLED", - "REFUNDED" + "IN_PERSON", + "ONLINE" ] }, - "channel": { - "type": "string" - }, - "subtotal": { - "type": "number" - }, - "discountAmount": { - "type": "number" - }, - "serviceFee": { - "type": "number" - }, - "iva": { - "type": "number" - }, - "total": { - "type": "number" - }, - "currency": { - "type": "string" - }, - "buyerName": { - "type": "string" + "status": { + "type": "string", + "enum": [ + "PUBLISHED", + "CANCELLED" + ] }, - "buyerEmail": { + "startsAt": { "type": "string" }, - "buyerPhone": { + "endsAt": { "type": [ "string", "null" ] }, - "buyerDocumentType": { - "type": [ - "string", - "null" - ] + "timeZone": { + "type": "string", + "description": "IANA time zone of the organization." }, - "buyerDocumentNumber": { - "type": [ - "string", - "null" - ] + "isClosed": { + "type": "boolean", + "description": "Already started or cancelled: RSVPs are not accepted." }, - "organizationId": { + "locked": { + "type": "boolean", + "description": "Teaser: the reader has no current membership. Only the fields above are real; every field below comes neutral (null or false)." + }, + "description": { "type": [ "string", "null" ] }, - "paymentProvider": { + "city": { "type": [ "string", "null" ] }, - "paymentRef": { + "locationName": { "type": [ "string", "null" ] }, - "confirmedAt": { - "type": [ - "string", - "null" + "capacity": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } ] }, - "createdAt": { - "type": "string" + "goingCount": { + "anyOf": [ + { + "type": "integer", + "minimum": -9007199254740991, + "maximum": 9007199254740991 + }, + { + "type": "null" + } + ], + "description": "null when `locked`." }, - "failureReason": { - "type": [ - "string", - "null" - ] + "isFull": { + "type": "boolean", + "description": "Always false when `locked`." }, - "paymentStatus": { - "description": "Status of the latest payment event. Usually the payment gateway's RAW status in its own vocabulary. Values prefixed with `FT_` come from FreeTicket, not the gateway: currently `FT_SALE_APPROVED_POST_CONFIRM`, which marks that the gateway re-notified an already-confirmed charge — this is how Bold reports its refunds. A CONFIRMED sale with this status may have money refunded that is not yet recorded.", + "requiresApproval": { + "type": "boolean", + "description": "Always false when `locked`." + }, + "myRsvp": { + "anyOf": [ + { + "type": "string", + "enum": [ + "GOING", + "CANCELLED", + "PENDING", + "DECLINED" + ] + }, + { + "type": "null" + } + ], + "description": "null without a buyer session, without an RSVP or when `locked`." + }, + "locationDetail": { + "description": "Exact address. Only for a current member whose RSVP is GOING.", "type": [ "string", "null" ] }, - "declineCode": { + "onlineUrl": { + "description": "Join link. Only for a current member whose RSVP is GOING.", "type": [ "string", "null" ] - }, - "refund": { - "type": "object", - "properties": { - "amount": { - "type": [ - "number", - "null" - ] - }, - "refundedItemIds": { - "type": "array", - "items": { - "type": "string" - } - }, - "saleRefunded": { - "type": "boolean" - }, - "gatewayRefunded": { - "type": "boolean" - }, - "seats": { - "type": "string", - "enum": [ - "blocked", - "block_failed", - "released", - "release_failed", - "none" - ] - } - }, - "required": [ - "amount", - "refundedItemIds", - "saleRefunded", - "gatewayRefunded", - "seats" - ], - "additionalProperties": false } }, "required": [ "id", - "reference", + "title", + "format", "status", - "channel", - "subtotal", - "discountAmount", - "serviceFee", - "iva", - "total", - "currency", - "buyerName", - "buyerEmail", - "buyerPhone", - "buyerDocumentType", - "buyerDocumentNumber", - "organizationId", - "paymentProvider", - "paymentRef", - "confirmedAt", - "createdAt", - "failureReason", - "paymentStatus", - "declineCode" + "startsAt", + "endsAt", + "timeZone", + "isClosed", + "locked", + "description", + "city", + "locationName", + "capacity", + "goingCount", + "isFull", + "requiresApproval", + "myRsvp", + "locationDetail", + "onlineUrl" ], "additionalProperties": false }, - "SaleItemTransferRequest": { + "CustomerCommunityMe": { "type": "object", "properties": { - "email": { - "type": "string", - "maxLength": 254, - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + "signedIn": { + "type": "boolean", + "description": "A valid `X-Customer-Session` came with the request." + }, + "member": { + "type": "boolean", + "description": "Current membership in the key's organization (or the community's creator)." + }, + "banned": { + "type": "boolean", + "description": "Expelled from this community." + }, + "canInteract": { + "type": "boolean", + "description": "May react and comment on what they can read: signed in and not banned." } }, "required": [ - "email" + "signedIn", + "member", + "banned", + "canInteract" ], "additionalProperties": false }, - "SaleItemTransfer": { + "CustomerCommunityReaction": { "type": "object", "properties": { - "saleId": { - "type": "string" - }, - "itemId": { - "type": "string" - }, - "ticketCode": { - "type": "string", - "description": "New ticket code (the previous QR is void)." - }, - "holderName": { - "type": "string" - }, - "holderEmail": { - "type": "string" - }, - "transferredAt": { - "type": "string" + "reacted": { + "type": "boolean", + "description": "State after the toggle: true = the buyer's reaction is on." } }, "required": [ - "saleId", - "itemId", - "ticketCode", - "holderName", - "holderEmail", - "transferredAt" + "reacted" ], "additionalProperties": false }, - "CourtesyRecipientUpdate": { + "CustomerCommunityCommentCreate": { "type": "object", "properties": { - "name": { + "body": { "type": "string", - "minLength": 2, - "maxLength": 120 + "minLength": 1, + "maxLength": 2000 }, - "email": { + "parentId": { + "description": "Reply to this comment. It must be a visible top-level comment of the same post.", "type": "string", - "maxLength": 254, - "format": "email", - "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + "minLength": 1, + "maxLength": 100, + "pattern": "^[A-Za-z0-9_-]+$" } }, "required": [ - "name", - "email" + "body" ], "additionalProperties": false }, - "CourtesyRecipient": { + "CustomerCommunityCommentDeleted": { "type": "object", "properties": { - "saleId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { + "id": { "type": "string" }, - "resent": { - "type": "boolean" - }, - "ticketCodesRotated": { + "deleted": { "type": "boolean", - "description": "true when the email changed: the previous QR codes are void (transferred tickets keep theirs)." + "const": true + }, + "deletedIds": { + "type": "array", + "items": { + "type": "string" + }, + "description": "The comment plus its live replies (top-level comments)." } }, "required": [ - "saleId", - "name", - "email", - "resent", - "ticketCodesRotated" + "id", + "deleted", + "deletedIds" ], "additionalProperties": false }, - "ResendTicket": { + "CustomerCommunityReportCreate": { "type": "object", "properties": { - "ticketCode": { - "type": "string" - }, - "sentTo": { - "type": "string" + "reason": { + "type": "string", + "enum": [ + "SPAM", + "HARASSMENT", + "HATE", + "SEXUAL", + "OTHER" + ] }, - "sentAt": { - "type": "string" + "detail": { + "type": "string", + "maxLength": 500 } }, "required": [ - "ticketCode", - "sentTo", - "sentAt" + "reason" ], "additionalProperties": false }, - "CustomerOrderItem": { + "CustomerCommunityReport": { "type": "object", "properties": { - "ticketTypeId": { - "type": "string", - "minLength": 1 - }, - "quantity": { - "type": "integer", - "minimum": 1, - "maximum": 30 + "reported": { + "type": "boolean", + "const": true }, - "seats": { - "description": "seats.io labels. Only for seated events.", - "maxItems": 30, - "type": "array", - "items": { - "type": "string", - "minLength": 1, - "maxLength": 120 - } + "duplicate": { + "type": "boolean", + "description": "true when this buyer had already reported it: nothing was counted again." } }, "required": [ - "ticketTypeId", - "quantity" + "reported", + "duplicate" ], "additionalProperties": false }, - "CustomerOrderCreateRequest": { + "CustomerLiveChatToken": { "type": "object", "properties": { - "eventDateId": { + "token": { "type": "string", - "minLength": 1 - }, - "items": { - "minItems": 1, - "maxItems": 1, - "type": "array", - "items": { - "$ref": "#/components/schemas/CustomerOrderItem" - } + "description": "READ-ONLY Supabase Realtime JWT for the private channel `topic`. It carries no chat identity: it cannot write." }, - "holdToken": { - "description": "Hold token of the seats.io map session. Required if seats are sent.", + "topic": { "type": "string", - "maxLength": 120 + "description": "Private Realtime channel: `live:`." }, - "discountCode": { + "expiresAt": { "type": "string", - "maxLength": 40 + "description": "ISO-8601. 30 minutes when access comes from a ticket for the show date, 60 minutes with a membership. Request a new one before it expires." }, - "buyer": { + "realtime": { "type": "object", "properties": { - "name": { + "url": { "type": "string", - "minLength": 2, - "maxLength": 120 + "description": "Supabase project URL for the Realtime client." }, - "phone": { + "apiKey": { "type": "string", - "maxLength": 40 - }, - "idType": { + "description": "Supabase anon (public) key." + } + }, + "required": [ + "url", + "apiKey" + ], + "additionalProperties": false + }, + "canWrite": { + "type": "boolean", + "description": "May post with `POST /customer/lives/{id}/chat/messages` right now." + }, + "writeBlockedReason": { + "anyOf": [ + { "type": "string", "enum": [ - "CC", - "CE", - "NIT", - "PP", - "TI", - "PEP" + "BANNED", + "LIVE_NOT_ACTIVE" ] }, - "idNumber": { - "type": "string", - "minLength": 5, - "maxLength": 20 + { + "type": "null" + } + ], + "description": "Why `canWrite` is false; null when it is true." + }, + "me": { + "anyOf": [ + { + "type": "object", + "properties": { + "authorId": { + "type": "string", + "description": "The buyer's pseudonym in THIS live: equals `authorId` of the buyer's own messages (to mark them). Not a customer id; it changes from one live to another." + }, + "name": { + "type": "string", + "description": "Display name in the chat." + } + }, + "required": [ + "authorId", + "name" + ], + "additionalProperties": false }, - "nitDigit": { - "description": "Check digit. Required if idType is NIT.", - "type": "string", - "maxLength": 1 + { + "type": "null" } - }, - "required": [ - "name", - "phone", - "idType", - "idNumber" ], - "additionalProperties": false + "description": "The buyer's chat identity; null when banned." + } + }, + "required": [ + "token", + "topic", + "expiresAt", + "realtime", + "canWrite", + "writeBlockedReason", + "me" + ], + "additionalProperties": false + }, + "CustomerLiveChatMessage": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "returnUrl": { + "authorId": { "type": "string", - "maxLength": 2048, - "description": "Absolute URL of the landing page the buyer returns to. Validated against the enterprise domain allowlist and the workspace that owns the event; if it fails validation it is ignored and the purchase proceeds as usual." + "description": "Stable pseudonym of the author within THIS live (not a customer id)." + }, + "name": { + "type": "string", + "description": "Public display name." + }, + "text": { + "type": "string", + "description": "Plain text, one line, 1-280 characters." + }, + "sentAt": { + "type": "string", + "description": "ISO-8601, server time." + }, + "host": { + "type": "boolean", + "description": "Written by the organization's staff (\"Organizer\" badge)." } }, "required": [ - "eventDateId", - "items", - "buyer", - "returnUrl" + "id", + "authorId", + "name", + "text", + "sentAt", + "host" + ], + "additionalProperties": false + }, + "CustomerLiveChatBacklog": { + "type": "object", + "properties": { + "items": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CustomerLiveChatMessage" + }, + "description": "Latest messages, oldest first." + } + }, + "required": [ + "items" + ], + "additionalProperties": false + }, + "CustomerLiveChatMessageCreate": { + "type": "object", + "properties": { + "text": { + "type": "string", + "maxLength": 4000, + "description": "Message text. Whitespace is collapsed to one line; 1-280 characters after that (422 `EMPTY` / `TOO_LONG`)." + } + }, + "required": [ + "text" + ], + "additionalProperties": false + }, + "CustomerLiveChatMessageCreated": { + "type": "object", + "properties": { + "message": { + "$ref": "#/components/schemas/CustomerLiveChatMessage" + } + }, + "required": [ + "message" ], "additionalProperties": false } diff --git a/src/commands/admin-crm.test.ts b/src/commands/admin-crm.test.ts index a41aa81..fd2ae05 100644 --- a/src/commands/admin-crm.test.ts +++ b/src/commands/admin-crm.test.ts @@ -17,6 +17,12 @@ const sdk = vi.hoisted(() => ({ postCrmAudiencePreview: vi.fn(), postCrmCampaigns: vi.fn(), postCrmCampaignsIdBatchesNext: vi.fn(), + getCrmSuppressions: vi.fn(), + postCrmSuppressions: vi.fn(), + deleteCrmSuppressions: vi.fn(), + postCrmTestSend: vi.fn(), + getCrmOrganizations: vi.fn(), + postCrmPeopleSearch: vi.fn(), })); vi.mock("../admin-client/sdk.gen", async (importOriginal) => ({ @@ -93,14 +99,20 @@ describe("ft admin crm command tree", () => { "events", "launch", "options", + "organizations", + "people", "preview", "quota", + "suppressions", + "test-send", ]); const sub = (n: string) => crm.commands.find((c) => c.name() === n) as Command; expect(names(sub("campaigns"))).toEqual(["cancel", "get", "list"]); expect(names(sub("batches"))).toEqual(["next", "stop"]); expect(names(sub("events"))).toEqual(["dates", "search"]); + expect(names(sub("suppressions"))).toEqual(["add", "list", "remove"]); + expect(names(sub("people"))).toEqual(["search"]); }); it("puts every write behind --yes", () => { @@ -115,6 +127,8 @@ describe("ft admin crm command tree", () => { ["campaigns", "cancel"], ["batches", "next"], ["batches", "stop"], + ["suppressions", "remove"], + ["test-send"], ]) expect(find(p).options.map((o) => o.long)).toContain("--yes"); for (const p of [["batches", "next"], ["launch"]]) @@ -437,6 +451,118 @@ describe("ft admin crm commands", () => { expect(err).toContain("--ignore-window"); }); + it("suppressions list validates and passes query, scope and limit", async () => { + sdk.getCrmSuppressions.mockResolvedValue(ok([])); + await run( + "suppressions", + "list", + "--query", + "ana@", + "--scope", + "ALL", + "--limit", + "200", + "--json", + ); + expect(sdk.getCrmSuppressions).toHaveBeenCalledWith({ + query: { query: "ana@", scope: "all", limit: 200 }, + }); + }); + + it("suppressions list rejects --limit over 500 before calling", async () => { + await expect(run("suppressions", "list", "--limit", "501")).rejects.toThrow( + "exited", + ); + expect(sdk.getCrmSuppressions).not.toHaveBeenCalled(); + }); + + it("suppressions add posts the trimmed email without asking", async () => { + sdk.postCrmSuppressions.mockResolvedValue( + ok({ emailMasked: "a***@x.co", suppressed: true }), + ); + await run("suppressions", "add", " ana@x.co ", "--json"); + expect(sdk.postCrmSuppressions).toHaveBeenCalledWith({ + body: { email: "ana@x.co" }, + }); + }); + + it("suppressions remove --yes sends confirm: true in the DELETE body", async () => { + sdk.deleteCrmSuppressions.mockResolvedValue( + ok({ emailMasked: "a***@x.co", suppressed: false }), + ); + await run("suppressions", "remove", "ana@x.co", "--yes", "--json"); + expect(sdk.deleteCrmSuppressions).toHaveBeenCalledWith({ + body: { email: "ana@x.co", confirm: true }, + }); + }); + + it("test-send --yes adds confirm: true and --sender wins over --data", async () => { + sdk.postCrmTestSend.mockResolvedValue(ok({ to: "me@freeticket.co" })); + const msg = { + channel: "EMAIL", + sender: { kind: "freeticket" }, + subject: "Hola", + body: "Hi", + }; + await run( + "test-send", + "--data", + JSON.stringify(msg), + "--sender", + "ws_1", + "--yes", + "--json", + ); + expect(sdk.postCrmTestSend).toHaveBeenCalledWith({ + body: { + ...msg, + sender: { kind: "organization", workspaceId: "ws_1" }, + confirm: true, + }, + }); + expect(JSON.parse(stdout)).toEqual({ to: "me@freeticket.co" }); + }); + + it("test-send SEND_FAILED explains nothing reached customers", async () => { + sdk.postCrmTestSend.mockResolvedValue( + apiError(502, { code: "SEND_FAILED", message: "Proveedor rechazó." }), + ); + await expect( + run("test-send", "--data", '{"channel":"EMAIL"}', "--yes"), + ).rejects.toThrow("exited"); + expect(stderr.join("\n")).toContain("nothing went to any customer"); + }); + + it("organizations sends the optional query", async () => { + sdk.getCrmOrganizations.mockResolvedValue(ok([])); + await run("organizations", "teatro", "--json"); + expect(sdk.getCrmOrganizations).toHaveBeenCalledWith({ + query: { query: "teatro" }, + }); + await run("organizations", "--json"); + expect(sdk.getCrmOrganizations).toHaveBeenLastCalledWith({ query: {} }); + }); + + it("people search posts query and the parsed --scope", async () => { + sdk.postCrmPeopleSearch.mockResolvedValue( + ok([{ email: "ana@x.co", name: "A.", phoneMasked: null }]), + ); + await run( + "people", + "search", + "ana", + "--scope", + '{"level":"orgs","workspaceIds":["ws_1"]}', + "--json", + ); + expect(sdk.postCrmPeopleSearch).toHaveBeenCalledWith({ + body: { + query: "ana", + scope: { level: "orgs", workspaceIds: ["ws_1"] }, + }, + }); + }); + it("422 lists details[].path", async () => { sdk.postCrmAudiencePreview.mockResolvedValue( apiError(422, { diff --git a/src/commands/admin-crm.ts b/src/commands/admin-crm.ts index 420886e..925a670 100644 --- a/src/commands/admin-crm.ts +++ b/src/commands/admin-crm.ts @@ -1,24 +1,32 @@ import chalk from "chalk"; import type { Command } from "commander"; import { + deleteCrmSuppressions, getCrmCampaigns, getCrmCampaignsId, getCrmEventDates, getCrmEvents, getCrmOptions, + getCrmOrganizations, getCrmQuota, + getCrmSuppressions, postCrmAudiencePreview, postCrmCampaigns, postCrmCampaignsIdBatchesNext, postCrmCampaignsIdBatchesStop, postCrmCampaignsIdCancel, + postCrmPeopleSearch, + postCrmSuppressions, + postCrmTestSend, } from "../admin-client/sdk.gen"; import type { AdminCrmAudienceFilter, AdminCrmAudiencePreview, AdminCrmCampaignDetail, AdminCrmLaunchInput, + AdminCrmPeopleSearchInput, AdminCrmSender, + AdminCrmTestSendInput, } from "../admin-client/types.gen"; import { configureAdminClient, fail, unwrap } from "../lib/api"; import { confirmOrExit, parseData } from "../lib/input"; @@ -74,6 +82,18 @@ const DATE_COLUMNS = [ "buyers", ]; +const SUPPRESSION_COLUMNS = [ + "emailMasked", + "reason", + "isGlobal", + "workspaceId", + "createdAt", +]; + +const ORGANIZATION_COLUMNS = ["id", "name", "slug"]; + +const PERSON_COLUMNS = ["email", "name", "phoneMasked"]; + type SdkResult = { data?: T; error?: unknown; response: Response }; type CrmError = { @@ -150,6 +170,14 @@ export function crmErrorHint( return "WhatsApp sending is blocked for this template or sender. See `whatsappBlockedReason` in `ft admin crm options`."; case "PAYLOAD_TOO_LARGE": return PAYLOAD_HINT; + case "CONFIRMATION_REQUIRED": + return "The backend wants an explicit confirmation. The CLI sends `confirm: true` after you answer yes or pass --yes; if you built the body by hand, add it."; + case "SEND_FAILED": + return "The provider rejected the test message. Check the template, the sender and your profile's email/phone; nothing went to any customer."; + case "RATE_LIMITED": + return retryAfter !== undefined + ? `Too many requests. Wait ${retryAfter}s and run it again (the CLI never retries a write on its own).` + : "Too many requests. Wait a moment and run it again (the CLI never retries a write on its own)."; case "WHATSAPP_UNAVAILABLE": return "The WhatsApp provider did not answer. Safe to retry by hand in a moment - the CLI never retries a write on its own."; default: @@ -157,11 +185,20 @@ export function crmErrorHint( } } +export type ErrorHint = ( + err: CrmError, + retryAfter: number | undefined, +) => string | null; + /** - * `unwrap` plus the CRM's named errors. Formats the envelope itself because + * `unwrap` plus the named errors of a superadmin surface (CRM by default; + * settlements pass their own `hint`). Formats the envelope itself because * `details` is not always a list here (`{ existingId }` on a duplicate). */ -function crmUnwrap(res: SdkResult): T { +export function crmUnwrap( + res: SdkResult, + hint: ErrorHint = crmErrorHint, +): T { if (res.data !== undefined) return res.data; const err = (res.error as { error?: CrmError } | undefined)?.error; const status = res.response?.status; @@ -180,8 +217,8 @@ function crmUnwrap(res: SdkResult): T { lines.push(` · ${path}: ${d.message ?? ""}`.trimEnd()); } } - const hint = crmErrorHint(err, retryAfterSeconds(res.response)); - if (hint) fail(lines.join("\n"), hint); + const next = hint(err, retryAfterSeconds(res.response)); + if (next) fail(lines.join("\n"), next); return unwrap(res); } @@ -450,6 +487,150 @@ export function registerAdminCrm(admin: Command): void { print(crmUnwrap(await getCrmQuota({})).data, { json: opts.json }); }); + // ------------------------------------------------------------- suppressions + // Admin 1.9: the master CRM's unsubscribe list. `add` only stops messages + // (idempotent, safe direction), so it does not ask; `remove` re-enables + // sending to that person and the backend wants `confirm: true`. + const suppressions = crm + .command("suppressions") + .description("Unsubscribed people: the master CRM never writes to them"); + + tableOptions( + suppressions + .command("list") + .description("Unsubscribes, newest first (emails masked)") + .option("--query ", "full email or part of it") + .option( + "--scope ", + "global (platform only, default) | all (plus each organization's)", + ) + .option("--limit ", "max results 1-500 (server default 100)"), + ).action(async (opts) => { + configureAdminClient(); + const query: Record = {}; + if (opts.query) query.query = opts.query; + if (opts.scope) { + const scope = String(opts.scope).toLowerCase(); + if (scope !== "global" && scope !== "all") + fail(`Invalid --scope: ${opts.scope}. Use global or all.`); + query.scope = scope; + } + if (opts.limit !== undefined) { + const n = Number(opts.limit); + if (!Number.isInteger(n) || n < 1 || n > 500) + fail(`Invalid --limit: ${opts.limit}. Use an integer from 1 to 500.`); + query.limit = n; + } + const body = crmUnwrap(await getCrmSuppressions({ query: query as never })); + printRows(body.data, opts, SUPPRESSION_COLUMNS); + }); + + suppressions + .command("add ") + .description( + "Unsubscribe a person from master CRM campaigns (idempotent; organizers' own campaigns are not affected)", + ) + .option("--json", "raw JSON output") + .action(async (email, opts) => { + configureAdminClient(); + const body = crmUnwrap( + await postCrmSuppressions({ body: { email: String(email).trim() } }), + ); + print(body.data, { json: opts.json }); + }); + + suppressions + .command("remove ") + .description( + "Remove a team-added unsubscribe: the person receives CRM campaigns again", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (email, opts) => { + configureAdminClient(); + const value = String(email).trim(); + await confirmOrExit( + `Remove the unsubscribe of ${value}? Master CRM campaigns will reach them again`, + opts.yes, + ); + const body = crmUnwrap( + await deleteCrmSuppressions({ body: { email: value, confirm: true } }), + ); + print(body.data, { json: opts.json }); + }); + + // ---------------------------------------------------------------- test-send + crm + .command("test-send") + .description( + "Send the composed message to YOURSELF as [Prueba] (your email, or your staff phone by WhatsApp)", + ) + .requiredOption( + "--data ", + "message JSON: channel, sender, subject, body, templateName (WhatsApp), imageUrl, promotedEventId", + ) + .option("--sender ", "freeticket | (overrides --data)") + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (opts) => { + configureAdminClient(); + const raw = parseData(opts.data); + if (!raw || typeof raw !== "object" || Array.isArray(raw)) + fail("--data must be a JSON object (channel, sender, subject, body)."); + const input = { ...(raw as Record) }; + if (opts.sender) input.sender = parseSender(opts.sender); + const channel = String(input.channel ?? "?"); + await confirmOrExit( + `Send a [Prueba] of "${String(input.subject ?? "(no subject)")}" by ${channel} to yourself${channel === "WHATSAPP" ? " (uses 1 of the daily WhatsApp quota)" : ""}?`, + opts.yes, + ); + const body = crmUnwrap( + await postCrmTestSend({ + body: { ...input, confirm: true } as AdminCrmTestSendInput, + }), + ); + print(body.data, { json: opts.json }); + }); + + // ------------------------------------------------------------ organizations + tableOptions( + crm + .command("organizations [query]") + .description( + "Active organizations by name or slug (for scope.level orgs or sender.workspaceId)", + ), + ).action(async (query, opts) => { + configureAdminClient(); + const body = crmUnwrap( + await getCrmOrganizations({ query: query ? { query } : {} }), + ); + printRows(body.data, opts, ORGANIZATION_COLUMNS); + }); + + // ------------------------------------------------------------------- people + const people = crm + .command("people") + .description("People inside an audience scope"); + + tableOptions( + people + .command("search ") + .description( + "Find people of a scope by email or name (full email: what the `people` filter condition takes)", + ) + .option( + "--scope ", + "the filter's scope object (inline JSON or @scope.json); default: the whole platform", + ), + ).action(async (query, opts) => { + configureAdminClient(); + const input: AdminCrmPeopleSearchInput = { query: String(query) }; + if (opts.scope) + input.scope = parseData(opts.scope) as AdminCrmPeopleSearchInput["scope"]; + const body = crmUnwrap(await postCrmPeopleSearch({ body: input })); + printRows(body.data, opts, PERSON_COLUMNS); + }); + // ------------------------------------------------------------------ preview crm .command("preview") diff --git a/src/commands/admin-settlements.test.ts b/src/commands/admin-settlements.test.ts new file mode 100644 index 0000000..6a45a04 --- /dev/null +++ b/src/commands/admin-settlements.test.ts @@ -0,0 +1,443 @@ +import { mkdtempSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { Command } from "commander"; +import { + afterEach, + beforeEach, + describe, + expect, + it, + type MockInstance, + vi, +} from "vitest"; + +const sdk = vi.hoisted(() => ({ + getSettlements: vi.fn(), + getSettlementsId: vi.fn(), + postSettlements: vi.fn(), + postSettlementsFiles: vi.fn(), + postSettlementsIdRegenerate: vi.fn(), + postSettlementsIdProofs: vi.fn(), + postSettlementsIdSend: vi.fn(), + postSettlementsIdMarkPaid: vi.fn(), + deleteSettlementsId: vi.fn(), +})); + +vi.mock("../admin-client/sdk.gen", async (importOriginal) => ({ + ...(await importOriginal()), + ...sdk, +})); + +const { MAX_PDF_BYTES, parseAmount, readPdf, settlementErrorHint } = + await import("./admin-settlements"); +const { flagKey, registerAdmin } = await import("./admin"); + +const SETTLEMENT = { + id: "stl_1", + reference: "LQ-EVT-01112026-SHOW-FTCO", + label: "Función 1", + status: "GENERATED", + amount: 1500000, + currency: "COP", + organization: { id: "org_1", name: "Teatro", taxId: null }, + event: { id: "evt_1", name: "Show" }, + eventDate: { id: "ed_1", startsAt: "2026-11-01T00:00:00.000Z" }, +}; + +const ok = (data: unknown) => ({ data: { data }, response: new Response() }); +const apiError = (status: number, error: Record) => ({ + data: undefined, + error: { error: { retryable: false, ...error } }, + response: new Response(null, { status }), +}); + +const dir = mkdtempSync(join(tmpdir(), "ft-settlements-")); +const pdf = join(dir, "liquidacion.pdf"); +writeFileSync(pdf, "%PDF-1.7 fake"); +const notPdf = join(dir, "notes.txt"); +writeFileSync(notPdf, "hello"); + +function build(): Command { + const program = new Command(); + program.exitOverride(); + registerAdmin(program); + return program; +} + +function settlementsTree(): Command { + const admin = build().commands.find((c) => c.name() === "admin") as Command; + return admin.commands.find((c) => c.name() === "settlements") as Command; +} + +describe("ft admin settlements command tree", () => { + it("registers reads and every write", () => { + const names = settlementsTree() + .commands.map((c) => c.name()) + .sort(); + expect(names).toEqual([ + "attach", + "create", + "delete", + "get", + "list", + "mark-paid", + "regenerate", + "send", + "upload", + ]); + }); + + it("puts every settlement write behind --yes", () => { + const root = settlementsTree(); + for (const n of [ + "create", + "regenerate", + "attach", + "send", + "mark-paid", + "delete", + ]) { + const cmd = root.commands.find((c) => c.name() === n) as Command; + expect(cmd.options.map((o) => o.long)).toContain("--yes"); + } + }); +}); + +describe("ft admin settlements commands", () => { + const env = { ...process.env }; + let stdout: string; + let stderr: string[]; + let exit: MockInstance; + + beforeEach(() => { + process.env.FT_ADMIN_TOKEN = "ftpat_test"; + stdout = ""; + stderr = []; + vi.spyOn(process.stdout, "write").mockImplementation( + (chunk: string | Uint8Array) => { + stdout += String(chunk); + return true; + }, + ); + vi.spyOn(console, "log").mockImplementation((...a) => { + stdout += `${a.join(" ")}\n`; + }); + vi.spyOn(console, "error").mockImplementation((...a) => { + stderr.push(a.join(" ")); + }); + exit = vi.spyOn(process, "exit").mockImplementation((() => { + throw new Error("exited"); + }) as never); + sdk.getSettlementsId.mockResolvedValue(ok(SETTLEMENT)); + }); + + afterEach(() => { + process.env = { ...env }; + vi.restoreAllMocks(); + for (const fn of Object.values(sdk)) fn.mockReset(); + }); + + const run = (...args: string[]) => + build().parseAsync(["node", "ft", "admin", "settlements", ...args]); + + it("list maps --organization to organizationId and --status through", async () => { + sdk.getSettlements.mockResolvedValue({ + data: { data: [SETTLEMENT], page: { nextCursor: null, hasMore: false } }, + response: new Response(), + }); + await run("list", "--organization", "org_1", "--status", "PAID", "--json"); + expect(sdk.getSettlements).toHaveBeenCalledWith({ + query: { + limit: 20, + cursor: undefined, + organizationId: "org_1", + status: "PAID", + }, + }); + }); + + it("upload sends the PDF as base64 with its file name", async () => { + sdk.postSettlementsFiles.mockResolvedValue( + ok({ + storagePath: "settlements/org_1/a.pdf", + fileName: "liquidacion.pdf", + }), + ); + await run("upload", pdf, "--organization", "org_1", "--json"); + expect(sdk.postSettlementsFiles).toHaveBeenCalledWith({ + body: { + organizationId: "org_1", + fileName: "liquidacion.pdf", + contentBase64: Buffer.from("%PDF-1.7 fake").toString("base64"), + }, + }); + expect(JSON.parse(stdout).storagePath).toBe("settlements/org_1/a.pdf"); + }); + + it("upload refuses a non-PDF before calling the API", async () => { + await expect( + run("upload", notPdf, "--organization", "org_1"), + ).rejects.toThrow("exited"); + expect(sdk.postSettlementsFiles).not.toHaveBeenCalled(); + }); + + it("create manual --pdf uploads first, then posts with the storagePath", async () => { + sdk.postSettlementsFiles.mockResolvedValue( + ok({ + storagePath: "settlements/org_1/a.pdf", + fileName: "liquidacion.pdf", + }), + ); + sdk.postSettlements.mockResolvedValue( + ok({ id: "stl_9", status: "GENERATED" }), + ); + const input = { + mode: "manual", + organizationId: "org_1", + label: "Función 1", + amount: 1000, + }; + await run( + "create", + "--data", + JSON.stringify(input), + "--pdf", + pdf, + "--yes", + "--json", + ); + expect(sdk.postSettlements).toHaveBeenCalledWith({ + body: { + ...input, + storagePath: "settlements/org_1/a.pdf", + fileName: "liquidacion.pdf", + }, + }); + expect(sdk.postSettlements).toHaveBeenCalledTimes(1); + }); + + it("create auto posts the body as given", async () => { + sdk.postSettlements.mockResolvedValue( + ok({ id: "stl_9", status: "GENERATED" }), + ); + const input = { mode: "auto", eventDateId: "ed_1", commissionRate: 2.99 }; + await run("create", "--data", JSON.stringify(input), "--yes", "--json"); + expect(sdk.postSettlements).toHaveBeenCalledWith({ body: input }); + }); + + it("create rejects --pdf with mode auto", async () => { + await expect( + run( + "create", + "--data", + '{"mode":"auto","eventDateId":"ed_1"}', + "--pdf", + pdf, + "--yes", + ), + ).rejects.toThrow("exited"); + expect(sdk.postSettlements).not.toHaveBeenCalled(); + }); + + it("create on DUPLICATE_SETTLEMENT points at the existing id, once", async () => { + sdk.postSettlements.mockResolvedValue( + apiError(409, { + code: "DUPLICATE_SETTLEMENT", + message: "Ya existe.", + details: { existingId: "stl_old" }, + }), + ); + await expect( + run("create", "--data", '{"mode":"auto","eventDateId":"ed_1"}', "--yes"), + ).rejects.toThrow("exited"); + expect(exit).toHaveBeenCalledWith(1); + expect(sdk.postSettlements).toHaveBeenCalledTimes(1); + expect(stderr.join("\n")).toContain("ft admin settlements get stl_old"); + }); + + it("send --yes shows the settlement and sends confirm: true", async () => { + sdk.postSettlementsIdSend.mockResolvedValue( + ok({ id: "stl_1", status: "SENT" }), + ); + await run("send", "stl_1", "--yes", "--json"); + expect(sdk.getSettlementsId).toHaveBeenCalledWith({ + path: { id: "stl_1" }, + }); + expect(sdk.postSettlementsIdSend).toHaveBeenCalledWith({ + path: { id: "stl_1" }, + body: { confirm: true }, + }); + expect(stderr.join("\n")).toContain("LQ-EVT-01112026-SHOW-FTCO"); + }); + + it("delete --yes sends confirm: true", async () => { + sdk.deleteSettlementsId.mockResolvedValue( + ok({ id: "stl_1", deleted: true }), + ); + await run("delete", "stl_1", "--yes", "--json"); + expect(sdk.deleteSettlementsId).toHaveBeenCalledWith({ + path: { id: "stl_1" }, + body: { confirm: true }, + }); + }); + + it("mark-paid uploads each --proof to the settlement's org, then confirms", async () => { + sdk.postSettlementsFiles.mockResolvedValue( + ok({ + storagePath: "settlements/org_1/p.pdf", + fileName: "liquidacion.pdf", + }), + ); + sdk.postSettlementsIdMarkPaid.mockResolvedValue( + ok({ id: "stl_1", status: "PAID" }), + ); + await run( + "mark-paid", + "stl_1", + "--proof", + pdf, + "--proofs", + '[{"storagePath":"settlements/org_1/old.pdf","fileName":"old.pdf"}]', + "--yes", + "--json", + ); + expect( + sdk.postSettlementsFiles.mock.calls[0]?.[0].body.organizationId, + ).toBe("org_1"); + expect(sdk.postSettlementsIdMarkPaid).toHaveBeenCalledWith({ + path: { id: "stl_1" }, + body: { + confirm: true, + proofs: [ + { storagePath: "settlements/org_1/old.pdf", fileName: "old.pdf" }, + { + storagePath: "settlements/org_1/p.pdf", + fileName: "liquidacion.pdf", + }, + ], + }, + }); + }); + + it("mark-paid without receipts stops before any call", async () => { + await expect(run("mark-paid", "stl_1", "--yes")).rejects.toThrow("exited"); + expect(sdk.getSettlementsId).not.toHaveBeenCalled(); + expect(sdk.postSettlementsIdMarkPaid).not.toHaveBeenCalled(); + }); + + it("attach sends confirm only with --amount", async () => { + sdk.postSettlementsIdProofs.mockResolvedValue( + ok({ id: "stl_1", status: "GENERATED" }), + ); + await run( + "attach", + "stl_1", + "--storage-path", + "settlements/org_1/a.pdf", + "--file-name", + "a.pdf", + "--yes", + "--json", + ); + expect(sdk.postSettlementsIdProofs).toHaveBeenLastCalledWith({ + path: { id: "stl_1" }, + body: { storagePath: "settlements/org_1/a.pdf", fileName: "a.pdf" }, + }); + await run( + "attach", + "stl_1", + "--storage-path", + "settlements/org_1/a.pdf", + "--file-name", + "a.pdf", + "--amount", + "1200.5", + "--yes", + "--json", + ); + expect(sdk.postSettlementsIdProofs).toHaveBeenLastCalledWith({ + path: { id: "stl_1" }, + body: { + storagePath: "settlements/org_1/a.pdf", + fileName: "a.pdf", + amount: 1200.5, + confirm: true, + }, + }); + }); + + it("regenerate passes commission and fixed fee as numbers", async () => { + sdk.postSettlementsIdRegenerate.mockResolvedValue( + ok({ id: "stl_1", status: "AWAITING_PAYMENT" }), + ); + await run( + "regenerate", + "stl_1", + "--commission-rate", + "2.9916", + "--fixed-fee", + "500", + "--yes", + "--json", + ); + expect(sdk.postSettlementsIdRegenerate).toHaveBeenCalledWith({ + path: { id: "stl_1" }, + body: { commissionRate: 2.9916, fixedFee: 500 }, + }); + }); + + it("AMOUNT_MISMATCH says nothing was written", async () => { + sdk.postSettlementsIdRegenerate.mockResolvedValue( + apiError(409, { code: "AMOUNT_MISMATCH", message: "No cuadra." }), + ); + await expect(run("regenerate", "stl_1", "--yes")).rejects.toThrow("exited"); + expect(stderr.join("\n")).toContain("nothing was written"); + }); +}); + +describe("helpers", () => { + it("readPdf enforces the 3 MB cap and the %PDF header", () => { + const pdfBuf = Buffer.from("%PDF-1.4"); + expect(readPdf("/x/a.pdf", { size: () => 8, read: () => pdfBuf })).toEqual({ + fileName: "a.pdf", + contentBase64: pdfBuf.toString("base64"), + }); + const exit = vi.spyOn(process, "exit").mockImplementation((() => { + throw new Error("exited"); + }) as never); + vi.spyOn(console, "error").mockImplementation(() => {}); + expect(() => + readPdf("/x/big.pdf", { + size: () => MAX_PDF_BYTES + 1, + read: () => pdfBuf, + }), + ).toThrow("exited"); + expect(() => + readPdf("/x/a.txt", { size: () => 5, read: () => Buffer.from("hello") }), + ).toThrow("exited"); + expect(exit).toHaveBeenCalledTimes(2); + vi.restoreAllMocks(); + }); + + it("parseAmount allows two decimals at most", () => { + expect(parseAmount("1500.25")).toBe(1500.25); + vi.spyOn(process, "exit").mockImplementation((() => { + throw new Error("exited"); + }) as never); + vi.spyOn(console, "error").mockImplementation(() => {}); + expect(() => parseAmount("1.234")).toThrow("exited"); + expect(() => parseAmount("0")).toThrow("exited"); + vi.restoreAllMocks(); + }); + + it("settlementErrorHint leaves unknown codes alone", () => { + expect(settlementErrorHint({ code: "NOT_FOUND" }, undefined)).toBeNull(); + }); + + it("flagKey reads the option name, not the query name", () => { + expect(flagKey("--organization ")).toBe("organization"); + expect(flagKey("--with-total")).toBe("withTotal"); + expect(flagKey("--event-date ")).toBe("eventDate"); + }); +}); diff --git a/src/commands/admin-settlements.ts b/src/commands/admin-settlements.ts new file mode 100644 index 0000000..9a331a3 --- /dev/null +++ b/src/commands/admin-settlements.ts @@ -0,0 +1,380 @@ +import { readFileSync, statSync } from "node:fs"; +import { basename } from "node:path"; +import chalk from "chalk"; +import type { Command } from "commander"; +import { + deleteSettlementsId, + getSettlementsId, + postSettlements, + postSettlementsFiles, + postSettlementsIdMarkPaid, + postSettlementsIdProofs, + postSettlementsIdRegenerate, + postSettlementsIdSend, +} from "../admin-client/sdk.gen"; +import type { + AdminSettlement, + AdminSettlementAttachProofInput, + AdminSettlementCreateInput, + AdminSettlementFile, + AdminSettlementRegenerateInput, +} from "../admin-client/types.gen"; +import { configureAdminClient, fail } from "../lib/api"; +import { confirmOrExit, parseData } from "../lib/input"; +import { print } from "../lib/output"; +import { crmUnwrap, type ErrorHint } from "./admin-crm"; + +/** + * `ft admin settlements …` writes (admin contract 1.9). Read-only `list` and + * `get` come from the generic admin resource; these are the money moves: + * + * - every write shows the settlement it touches (or the body it will create), + * then goes through `confirmOrExit`: no TTY and no `--yes` is a hard stop; + * - `send`, `mark-paid` and `delete` always send `confirm: true` (the backend + * answers 422 CONFIRMATION_REQUIRED without it); `attach` sends it only with + * `--amount`, which is when the contract asks for it; + * - nothing is retried by the CLI. The backend is idempotent where it matters + * (DUPLICATE_SETTLEMENT, INVALID_STATE on a second send/mark-paid). + */ + +/** Backend cap on one uploaded PDF (decoded). */ +export const MAX_PDF_BYTES = 3 * 1024 * 1024; + +export const settlementErrorHint: ErrorHint = (err, retryAfter) => { + switch (err.code) { + case "DUPLICATE_SETTLEMENT": { + const id = (err.details as { existingId?: string } | undefined) + ?.existingId; + return id + ? `That function already has an active settlement: ${id}\nSee it with \`ft admin settlements get ${id}\`. Delete it first if it is really wrong.` + : "That function already has an active settlement. Find it with `ft admin settlements list --organization `."; + } + case "AMOUNT_MISMATCH": + return "The recalculated balance does not match the settlement amount, so nothing was written. Generate the settlement from scratch (delete + create)."; + case "INVALID_STATE": + return "The settlement is not in the state this step needs (e.g. send needs GENERATED, mark-paid and regenerate need AWAITING_PAYMENT). Check it with `ft admin settlements get `."; + case "CONFIRMATION_REQUIRED": + return "The backend wants `confirm: true`. The CLI adds it after you answer yes or pass --yes."; + case "STORAGE_UNAVAILABLE": + case "UPLOAD_FAILED": + case "DRAFT_FAILED": + return "Storage or PDF generation failed on the backend; nothing was created. Safe to run it again by hand in a moment."; + case "PAYLOAD_TOO_LARGE": + return "The PDF is over the 3 MB limit. Compress it and upload again."; + case "RATE_LIMITED": + return retryAfter !== undefined + ? `Too many requests. Wait ${retryAfter}s and run it again (the CLI never retries a write on its own).` + : "Too many requests. Wait a moment and run it again."; + default: + return null; + } +}; + +const unwrapS = (res: { + data?: T; + error?: unknown; + response: Response; +}): T => crmUnwrap(res, settlementErrorHint); + +/** + * Reads a local PDF for `POST /settlements/files`: checks it exists, fits the + * 3 MB cap and starts with `%PDF` before anything leaves the machine. + * Exported for tests (pass `read`/`size` to avoid the disk). + */ +export function readPdf( + path: string, + io: { + read?: (p: string) => Buffer; + size?: (p: string) => number; + } = {}, +): { fileName: string; contentBase64: string } { + const size = io.size ?? ((p: string) => statSync(p).size); + const read = io.read ?? ((p: string) => readFileSync(p)); + let bytes: number; + try { + bytes = size(path); + } catch { + fail(`Cannot read ${path}: file not found.`); + } + if (bytes > MAX_PDF_BYTES) + fail( + `${path} is ${(bytes / 1024 / 1024).toFixed(1)} MB; the limit is 3 MB.`, + "Compress the PDF and try again.", + ); + const buf = read(path); + if (buf.subarray(0, 4).toString("latin1") !== "%PDF") + fail(`${path} is not a PDF (it does not start with %PDF).`); + return { fileName: basename(path), contentBase64: buf.toString("base64") }; +} + +/** `--amount` → a positive number with at most two decimals. */ +export function parseAmount(value: string): number { + const n = Number(value); + if (!Number.isFinite(n) || n <= 0 || n > 9999999999.99) + fail(`Invalid --amount: ${value}. Use a positive number.`); + if (Math.round(n * 100) / 100 !== n) + fail(`Invalid --amount: ${value}. At most two decimals.`); + return n; +} + +function parseNumber(flag: string, value: string, max: number): number { + const n = Number(value); + if (!Number.isFinite(n) || n < 0 || n > max) + fail(`Invalid ${flag}: ${value}. Use a number from 0 to ${max}.`); + return n; +} + +async function upload( + organizationId: string, + path: string, +): Promise { + const file = readPdf(path); + return unwrapS( + await postSettlementsFiles({ body: { organizationId, ...file } }), + ).data; +} + +function money(amount: number, currency: string): string { + return `${amount.toLocaleString("en-US")} ${currency}`; +} + +/** Shows a settlement before a write on it, and returns it. */ +async function showSettlement(id: string): Promise { + const s = unwrapS(await getSettlementsId({ path: { id } })).data; + console.error( + [ + `${chalk.bold(s.reference)} (${s.id})`, + ` ${s.organization.name} · ${s.status} · ${money(s.amount, s.currency)}`, + ` ${s.label}${s.event ? ` · ${s.event.name}` : ""}${s.eventDate ? ` · ${s.eventDate.startsAt}` : ""}`, + ].join("\n"), + ); + return s; +} + +export function registerAdminSettlementWrites(root: Command): void { + root + .command("upload ") + .description( + "Upload a PDF (max 3 MB) to an organization's private settlement bucket; prints its storagePath", + ) + .requiredOption("--organization ", "organization the file belongs to") + .option("--json", "raw JSON output") + .action(async (file, opts) => { + configureAdminClient(); + print(await upload(opts.organization, file), { json: opts.json }); + }); + + root + .command("create") + .description( + "Create a settlement in GENERATED (does not notify the organizer). mode manual: a PDF + typed amount; mode auto: computed from a function", + ) + .requiredOption( + "--data ", + 'body: {"mode":"auto","eventDateId":"..."} or {"mode":"manual","organizationId":"...","label":"...","amount":...} (inline or @file.json)', + ) + .option( + "--pdf ", + "mode manual: upload this PDF first and fill storagePath/fileName", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (opts) => { + configureAdminClient(); + const raw = parseData(opts.data); + if (!raw || typeof raw !== "object" || Array.isArray(raw)) + fail("--data must be a JSON object with `mode` (manual | auto)."); + const input = { ...(raw as Record) }; + if (input.mode !== "manual" && input.mode !== "auto") + fail("--data needs `mode`: manual or auto."); + if (opts.pdf && input.mode !== "manual") + fail("--pdf only applies to mode manual (auto generates its own PDF)."); + if (opts.pdf && !input.organizationId) + fail("mode manual needs `organizationId` to upload the PDF."); + // Validate the file before asking, so the confirmation is the last step. + if (opts.pdf) readPdf(opts.pdf); + console.error( + input.mode === "auto" + ? `auto settlement of function ${String(input.eventDateId ?? "?")}${input.integrate === false ? " (EXAMPLE, not tied to the function)" : ""}` + : `manual settlement "${String(input.label ?? "?")}" for ${String(input.organizationId)}: ${money(Number(input.amount), String(input.currency ?? "COP"))}`, + ); + await confirmOrExit( + "Create this settlement? It starts in GENERATED and is not sent to the organizer", + opts.yes, + ); + if (opts.pdf) { + const file = await upload(String(input.organizationId), opts.pdf); + input.storagePath = file.storagePath; + input.fileName = file.fileName; + } + const body = unwrapS( + await postSettlements({ body: input as AdminSettlementCreateInput }), + ); + print(body.data, { json: opts.json }); + if (!opts.json) + console.error( + chalk.dim( + `\nReview it, then \`ft admin settlements send ${body.data.id}\` to notify the organizer`, + ), + ); + }); + + root + .command("regenerate ") + .description( + "Replace the PDF of an AWAITING_PAYMENT settlement with the final one (amount never changes)", + ) + .option( + "--commission-rate ", + "gateway commission in PERCENT before VAT (e.g. 2.9916)", + ) + .option( + "--fixed-fee ", + "fixed fee per transaction, COP before VAT (e.g. 500)", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + const input: AdminSettlementRegenerateInput = {}; + if (opts.commissionRate !== undefined) + input.commissionRate = parseNumber( + "--commission-rate", + opts.commissionRate, + 100, + ); + if (opts.fixedFee !== undefined) + input.fixedFee = parseNumber("--fixed-fee", opts.fixedFee, 100000); + await showSettlement(id); + await confirmOrExit(`Regenerate the PDF of settlement ${id}?`, opts.yes); + const body = unwrapS( + await postSettlementsIdRegenerate({ path: { id }, body: input }), + ); + print(body.data, { json: opts.json }); + }); + + root + .command("attach ") + .description( + "Legacy DRAFT → GENERATED: attach the settlement PDF (transfer receipts go in mark-paid)", + ) + .option("--pdf ", "upload this PDF and attach it") + .option("--storage-path ", "an already uploaded file (see upload)") + .option("--file-name ", "file name for --storage-path") + .option( + "--amount ", + "also change the amount paid to the organizer (max 2 decimals)", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + if (!opts.pdf && !opts.storagePath) + fail("Pass --pdf or --storage-path --file-name ."); + if (opts.storagePath && !opts.fileName) + fail("--storage-path needs --file-name."); + const amount = + opts.amount !== undefined ? parseAmount(opts.amount) : undefined; + if (opts.pdf) readPdf(opts.pdf); + const s = await showSettlement(id); + await confirmOrExit( + `Attach the PDF to settlement ${id}${amount !== undefined ? ` and set the amount to ${money(amount, s.currency)}` : ""}?`, + opts.yes, + ); + const file = opts.pdf + ? await upload(s.organization.id, opts.pdf) + : { storagePath: opts.storagePath, fileName: opts.fileName }; + const input: AdminSettlementAttachProofInput = { + ...file, + ...(amount !== undefined ? { amount, confirm: true } : {}), + }; + const body = unwrapS( + await postSettlementsIdProofs({ path: { id }, body: input }), + ); + print(body.data, { json: opts.json }); + }); + + root + .command("send ") + .description( + "GENERATED → SENT: the organizer sees it, can split the payment and gets an email", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + await showSettlement(id); + await confirmOrExit( + `Send settlement ${id} to the organizer? They get an email`, + opts.yes, + ); + const body = unwrapS( + await postSettlementsIdSend({ path: { id }, body: { confirm: true } }), + ); + print(body.data, { json: opts.json }); + }); + + root + .command("mark-paid ") + .description( + "AWAITING_PAYMENT → PAID with the transfer receipts; emails the organizer", + ) + .option( + "--proof ", + "receipt PDF(s), one per payout account (uploaded first)", + ) + .option( + "--proofs ", + 'already uploaded receipts: [{"storagePath":"...","fileName":"..."}] (inline or @file.json)', + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + const files: string[] = opts.proof ?? []; + const given = opts.proofs ? parseData(opts.proofs) : []; + if (!Array.isArray(given)) + fail("--proofs must be a JSON array of {storagePath, fileName}."); + if (files.length + given.length === 0) + fail( + "Pass at least one receipt: --proof or --proofs .", + ); + if (files.length + given.length > 20) + fail("At most 20 receipts per settlement."); + for (const f of files) readPdf(f); + const s = await showSettlement(id); + await confirmOrExit( + `Mark settlement ${id} as PAID (${money(s.amount, s.currency)}) with ${files.length + given.length} receipt(s)? The organizer gets an email`, + opts.yes, + ); + const proofs = [...(given as AdminSettlementFile[])]; + for (const f of files) proofs.push(await upload(s.organization.id, f)); + const body = unwrapS( + await postSettlementsIdMarkPaid({ + path: { id }, + body: { confirm: true, proofs }, + }), + ); + print(body.data, { json: opts.json }); + }); + + root + .command("delete ") + .description( + "Delete a settlement (irreversible; membership ones only in DRAFT/GENERATED)", + ) + .option("--yes", "skip confirmation") + .option("--json", "raw JSON output") + .action(async (id, opts) => { + configureAdminClient(); + await showSettlement(id); + await confirmOrExit( + `Delete settlement ${id}? This cannot be undone`, + opts.yes, + ); + const body = unwrapS( + await deleteSettlementsId({ path: { id }, body: { confirm: true } }), + ); + print(body.data, { json: opts.json }); + }); +} diff --git a/src/commands/admin.ts b/src/commands/admin.ts index b417be7..1caf278 100644 --- a/src/commands/admin.ts +++ b/src/commands/admin.ts @@ -9,6 +9,8 @@ import { getMe, getPlatformPlans, getPlatformPlansId, + getSettlements, + getSettlementsId, getTokens, getUsers, getUsersId, @@ -33,6 +35,7 @@ import { CONFIG_PATH, loadConfig, saveConfig } from "../lib/config"; import { confirmOrExit, parseData, parseLimit } from "../lib/input"; import { print, printNextCursor, resolveColumns, toCsv } from "../lib/output"; import { registerAdminCrm } from "./admin-crm"; +import { registerAdminSettlementWrites } from "./admin-settlements"; type SdkFn = ( opts: any, @@ -64,6 +67,8 @@ interface AdminResource { listFlags?: { flag: string; describe: string; query: string }[]; /** This list endpoint has no cursor pagination (e.g. feature-flags). */ noPaging?: boolean; + /** Extra subcommands under the resource root (e.g. settlement writes). */ + extend?: (root: Command) => void; } /** @@ -284,6 +289,31 @@ export function registerAdmin(program: Command): void { columns: ["id", "name", "lastUsedAt", "expiresAt", "createdAt"], noPaging: true, }, + { + // Admin 1.9: EVENT settlements of every organization (membership ones + // are not listed here, same as the panel). Every write moves money or + // notifies the organizer, so they live in admin-settlements.ts behind a + // confirmation that also sends the contract's `confirm: true`. + name: "settlements", + describe: "Organizer settlements, cross-tenant (writes move money)", + list: getSettlements, + get: getSettlementsId, + columns: ["id", "reference", "status", "amount", "currency", "createdAt"], + listFlags: [ + { + flag: "--status ", + describe: + "DRAFT | GENERATED | SENT | AWAITING_PAYMENT | PAID | REQUESTED | PENDING | REJECTED", + query: "status", + }, + { + flag: "--organization ", + describe: "only this organization's", + query: "organizationId", + }, + ], + extend: registerAdminSettlementWrites, + }, { name: "audit-log", describe: "Superadmin audit log", @@ -334,7 +364,9 @@ function registerAdminResource(parent: Command, spec: AdminResource): void { query.cursor = opts.cursor; } for (const f of spec.listFlags ?? []) { - const v = opts[camel(f.query)]; + // Read the value by the flag's own name: `--workspace ` lands in + // opts.workspace even though it travels as `workspaceId`. + const v = opts[flagKey(f.flag)]; if (v !== undefined) query[f.query] = v; } const columns = resolveColumns(opts, spec.columns); @@ -443,8 +475,14 @@ function registerAdminResource(parent: Command, spec: AdminResource): void { print(body?.data ?? body ?? { ok: true }, { json: opts.json }); }); } + + spec.extend?.(root); } -function camel(s: string): string { - return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase()); +/** `--organization ` → `organization`, `--with-total` → `withTotal`. */ +export function flagKey(flag: string): string { + const long = flag.split(/[ ,]/).find((p) => p.startsWith("--")) ?? flag; + return long + .replace(/^--/, "") + .replace(/-([a-z])/g, (_, c) => c.toUpperCase()); } diff --git a/src/destructive-confirm.test.ts b/src/destructive-confirm.test.ts index 507ea96..47ff8b4 100644 --- a/src/destructive-confirm.test.ts +++ b/src/destructive-confirm.test.ts @@ -24,6 +24,16 @@ const sdk = vi.hoisted(() => ({ postCrmCampaignsIdBatchesStop: vi.fn(), postCrmAudiencePreview: vi.fn(), getCrmCampaignsId: vi.fn(), + deleteCrmSuppressions: vi.fn(), + postCrmTestSend: vi.fn(), + // Settlement writes (admin 1.9), plus the read they show first. + getSettlementsId: vi.fn(), + postSettlements: vi.fn(), + postSettlementsIdRegenerate: vi.fn(), + postSettlementsIdProofs: vi.fn(), + postSettlementsIdSend: vi.fn(), + postSettlementsIdMarkPaid: vi.fn(), + deleteSettlementsId: vi.fn(), })); const PREVIEW = { @@ -70,6 +80,15 @@ vi.mock("./admin-client/sdk.gen", async (importOriginal) => ({ postCrmCampaignsIdBatchesStop: sdk.postCrmCampaignsIdBatchesStop, postCrmAudiencePreview: sdk.postCrmAudiencePreview, getCrmCampaignsId: sdk.getCrmCampaignsId, + deleteCrmSuppressions: sdk.deleteCrmSuppressions, + postCrmTestSend: sdk.postCrmTestSend, + getSettlementsId: sdk.getSettlementsId, + postSettlements: sdk.postSettlements, + postSettlementsIdRegenerate: sdk.postSettlementsIdRegenerate, + postSettlementsIdProofs: sdk.postSettlementsIdProofs, + postSettlementsIdSend: sdk.postSettlementsIdSend, + postSettlementsIdMarkPaid: sdk.postSettlementsIdMarkPaid, + deleteSettlementsId: sdk.deleteSettlementsId, })); const { program } = await import("./program"); @@ -198,3 +217,100 @@ describe("ft admin crm writes refuse without a TTY and without --yes", () => { expect(write).not.toHaveBeenCalled(); }); }); + +describe("ft admin crm/settlements money and re-enable writes refuse without a TTY and without --yes", () => { + const tty = process.stdin.isTTY; + const env = { ...process.env }; + let exit: MockInstance; + let stderr: MockInstance; + + beforeEach(() => { + Object.defineProperty(process.stdin, "isTTY", { + value: false, + configurable: true, + }); + process.env.FT_ADMIN_TOKEN = "ftpat_test"; + sdk.getSettlementsId.mockResolvedValue({ + data: { + data: { + id: "stl_1", + reference: "LQ-EVT-X", + label: "F1", + status: "GENERATED", + amount: 1000, + currency: "COP", + organization: { id: "org_1", name: "Teatro", taxId: null }, + event: null, + eventDate: null, + }, + }, + response: new Response(), + }); + stderr = vi.spyOn(console, "error").mockImplementation(() => {}); + exit = vi.spyOn(process, "exit").mockImplementation((() => { + throw new Error("exited"); + }) as never); + }); + + afterEach(() => { + Object.defineProperty(process.stdin, "isTTY", { + value: tty, + configurable: true, + }); + process.env = { ...env }; + vi.restoreAllMocks(); + for (const fn of Object.values(sdk)) fn.mockReset(); + }); + + it.each([ + [["crm", "suppressions", "remove", "a@x.co"], sdk.deleteCrmSuppressions], + [ + ["crm", "test-send", "--data", '{"channel":"EMAIL"}'], + sdk.postCrmTestSend, + ], + [ + [ + "settlements", + "create", + "--data", + '{"mode":"auto","eventDateId":"ed_1"}', + ], + sdk.postSettlements, + ], + [["settlements", "regenerate", "stl_1"], sdk.postSettlementsIdRegenerate], + [ + [ + "settlements", + "attach", + "stl_1", + "--storage-path", + "p", + "--file-name", + "f.pdf", + ], + sdk.postSettlementsIdProofs, + ], + [["settlements", "send", "stl_1"], sdk.postSettlementsIdSend], + [ + [ + "settlements", + "mark-paid", + "stl_1", + "--proofs", + '[{"storagePath":"p","fileName":"f.pdf"}]', + ], + sdk.postSettlementsIdMarkPaid, + ], + [["settlements", "delete", "stl_1"], sdk.deleteSettlementsId], + ])("ft admin %j exits 1 and never calls the write", async (args, write) => { + await expect( + program.parseAsync(["node", "ft", "admin", ...(args as string[])]), + ).rejects.toThrow("exited"); + expect(exit).toHaveBeenCalledWith(1); + const messages = stderr.mock.calls.map((c) => String(c[0])); + expect(messages.some((m) => /^Refusing: .*no TTY to confirm/.test(m))).toBe( + true, + ); + expect(write).not.toHaveBeenCalled(); + }); +}); diff --git a/src/program.test.ts b/src/program.test.ts index 4cd88c5..08187d4 100644 --- a/src/program.test.ts +++ b/src/program.test.ts @@ -73,3 +73,28 @@ test("admin 1.7 CRM commands are wired under `ft admin crm`", () => { ]; expect(expected.filter((p) => !tree.has(p))).toEqual([]); }); + +test("contract 1.55 / admin 1.9 commands are wired", () => { + const tree = new Map(walk(program)); + const expected = [ + "courtesy-requests create", + "admin settlements list", + "admin settlements get", + "admin settlements upload", + "admin settlements create", + "admin settlements regenerate", + "admin settlements attach", + "admin settlements send", + "admin settlements mark-paid", + "admin settlements delete", + "admin crm suppressions list", + "admin crm suppressions add", + "admin crm suppressions remove", + "admin crm test-send", + "admin crm organizations", + "admin crm people search", + ]; + expect(expected.filter((p) => !tree.has(p))).toEqual([]); + const longs = tree.get("settlements list")?.options.map((o) => o.long) ?? []; + expect(longs).toContain("--kind"); +}); diff --git a/src/program.ts b/src/program.ts index 2d7ba19..658b8ef 100644 --- a/src/program.ts +++ b/src/program.ts @@ -45,6 +45,7 @@ import { patchWebhooksId, postContentPlaybackToken, postContentPosts, + postCourtesyRequests, postDiscounts, postEvents, postEventsIdCancel, @@ -143,7 +144,18 @@ registerResource(program, { describe: "Settlements paid to the organizer", list: getSettlements, get: getSettlementsId, - columns: ["id", "reference", "status", "amount", "currency", "createdAt"], + // `kind` (contract 1.54): EVENT settlements of ticket sales or MEMBERSHIP + // ones of a period; membership rows carry `period`/`membershipPlan` instead + // of `event`/`eventDate`. + columns: [ + "id", + "reference", + "kind", + "status", + "amount", + "currency", + "createdAt", + ], listFlags: [ { flag: "--event ", describe: "filter by event", query: "event" }, { @@ -151,6 +163,11 @@ registerResource(program, { describe: "SENT | AWAITING_PAYMENT | PAID", query: "status", }, + { + flag: "--kind ", + describe: "EVENT | MEMBERSHIP (default: both)", + query: "kind", + }, ], extend: (root) => { root @@ -429,6 +446,16 @@ registerResource(program, { ], }); +// Courtesy invitation requests of an enterprise landing (contract 1.55): same +// shape as the waitlist's `create` (enterprise service key; the org comes from +// the key). One per (organization, email): a resubmit answers 409. The list and +// CSV export live only in the dashboard (/dashboard/cortesias). +registerResource(program, { + name: "courtesy-requests", + describe: "Courtesy invitation requests of an enterprise landing", + create: postCourtesyRequests, +}); + // Merch store catalog (contract 1.38): products are born DRAFT; local photos // go through the signed upload URL, never as a URL the backend downloads. registerMerch(program); From b906a2bd93bcacf7e738666070ca01d9b5616111 Mon Sep 17 00:00:00 2001 From: Lucas-FullStackX Date: Mon, 23 Nov 2026 13:52:07 -0500 Subject: [PATCH 5/5] docs(admin): settlements get covers event settlements only; send/mark-paid email is best-effort Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fo7cm88pv5nC6H9aXKtwc1 --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 11c3682..a12ba12 100644 --- a/README.md +++ b/README.md @@ -289,6 +289,11 @@ ft admin settlements mark-paid --proof a.pdf --proof b.pdf [--yes] # AWAIT ft admin settlements delete [--yes] ``` +`get` and `list` cover event settlements only; a membership settlement id +returns 404 there. The organizer email on `send` and `mark-paid` is +best-effort: a 200 means the state changed, not that the email arrived, and a +retry returns 409 `INVALID_STATE` instead of resending. + **Every write moves money or notifies the organizer.** Each one shows the settlement (or the body it will create) and asks; without a TTY it refuses unless you pass `--yes`. `send`, `mark-paid` and `delete` send the contract's