{ "openapi": "3.0.0", "info": { "title": "Widgetic API Gateway", "version": "1.0.0", "description": "API documentation for the Widgetic API Gateway", "license": { "name": "Widgetic Integration License", "url": "https://docs.widgetic.com/resources/license" } }, "servers": [ { "url": "https://api.widgetic.com/v1", "description": "Production server", "variables": { "env": { "default": "production", "description": "Environment" }, "apiUrl": { "default": "https://api.widgetic.com", "description": "API URL" }, "apiVersion": { "default": "/v1", "description": "API Version path prefix" } } } ], "paths": { "/embed/compositions/{compositionId}/entries/{table}": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "post": { "operationId": "createPublicCompositionEntry", "summary": "Append a visitor entry through the gateway", "description": "Public append-only write into a published composition database. No API key. The browser must send a permitted `Origin` header: the artifact iframe origin, or any website when the owner has not restricted the allowed websites (when the owner has, one of the websites the owner listed, Widgetic's own sites, the visitor's own machine or the owner's own platform). When the request comes from the shared artifact origin, it must also carry the per-composition write token (`X-Widgetic-Write-Token` header or `writeToken` body field, handed to the widget in `widgetic:host` as `entries.writeToken` and returned as `entryWriteToken` on `getPublicCompositionEmbed`). Host `context` is stored for partner attribution; it is not authenticated unless the partner signs it (see **Signed context**). Request bodies are limited to 16 KB before parsing.\n**Address.** `https://api.widgetic.com/embed/compositions/{compositionId}/entries/{table}`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.\n**Signed context.** A partner that wants to trust `context` (to bill a customer by it, say) makes a signing secret (`rotatePartnerEntryContextSecret`), and its server signs the context it hands to the embed. The signature travels inside `context` as two reserved keys, `widgetic_exp` (UTC seconds, at most seven days ahead) and `widgetic_sig`. The gateway checks them after the `Origin` and before anything else is judged, stored or announced, and keeps and announces the context WITHOUT them. A context that is not signed as the partner requires is refused with 403 `CONTEXT_SIGNATURE_REQUIRED`, `CONTEXT_SIGNATURE_INVALID` or `CONTEXT_SIGNATURE_EXPIRED`; when the check cannot be made just now the answer is a retryable 503 `CONTEXT_SIGNATURE_UNAVAILABLE`, never an unchecked entry. Until a partner makes a secret nothing changes: the two keys are dropped and the rest is taken as it came. A signature is good until its `widgetic_exp` and may be used again until then, so a partner that must count each submission once keeps a unique value of its own (a `submissionId`, say) in the context. The recipe and a test vector are in the description of `rotatePartnerEntryContextSecret`.", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "compositionId", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string" } }, { "in": "header", "name": "X-Widgetic-Write-Token", "required": false, "description": "Signed per-composition write token handed to the widget in `widgetic:host` as `entries.writeToken` (and returned by `GET /embed/compositions/{compositionId}` as `entryWriteToken`). Required when the request comes from the shared Widgetic artifact origin; verified whenever present.", "schema": { "type": "string" } }, { "in": "header", "name": "X-Widgetic-Visitor-Id", "required": false, "description": "A random id the widget's browser makes once and keeps (16 to 64 characters of `A-Za-z0-9_-`), sent so a table's per-visitor `limit` (declared in the widget database file) can count this browser. Not an identity and not a secret. Without it, or with a malformed value, the limit counts only by network address.", "schema": { "type": "string", "pattern": "^[A-Za-z0-9_-]{16,64}$" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicCompositionEntryRequest" } } } }, "responses": { "201": { "description": "Entry stored", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicCompositionEntryCreated" } } } }, "400": { "description": "Invalid body or values (`ENTRY_BODY_INVALID`, `ENTRY_VALUE_INVALID`, `ENTRY_CONTEXT_INVALID`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "403": { "description": "Origin not allowed (`ORIGIN_NOT_ALLOWED`), per-composition write token missing, invalid or expired (`WRITE_TOKEN_REQUIRED`, `WRITE_TOKEN_INVALID`, `WRITE_TOKEN_EXPIRED`), or the context is not signed as the partner requires (`CONTEXT_SIGNATURE_REQUIRED`, `CONTEXT_SIGNATURE_INVALID`, `CONTEXT_SIGNATURE_EXPIRED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "404": { "description": "Composition unavailable or table not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "413": { "description": "Body too large (`PAYLOAD_TOO_LARGE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "415": { "description": "Not JSON (`UNSUPPORTED_MEDIA_TYPE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "422": { "description": "Row rejected (`ENTRY_ROW_REJECTED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "429": { "description": "Rate limited (`RATE_LIMITED`), always with `Retry-After`. Three limits answer this way: 20 entries a minute per visitor address and composition, 300 a minute per composition, and a day's allowance per composition (default 50,000 stored entries in 24 hours; `details.scope` is `composition_daily` for that one). Only an entry that was stored counts against the day's allowance. A fourth answers a table that declares a per-visitor `limit`: `error.code` is `ENTRY_LIMIT_REACHED`, `details.scope` is `visitor_limit` (this browser) or `address_limit` (this network address), and `details.perVisitor` and `details.per` repeat what the table declares.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "503": { "description": "Database unavailable or statement timeout, or the gateway could not tell just now whether the context must be signed (`CONTEXT_SIGNATURE_UNAVAILABLE`). Try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } } } } }, "/embed/workflows/{workflowId}": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "get": { "operationId": "getPublicWorkflow", "summary": "Read the published Workflow of an embed", "description": "Public read of a workflow for the embed that carries `workflow-id`. No API key. The answer is the live version (its graph, the composition a new visitor starts on, the time zone, the languages its compositions can be shown in, and the token that lets the browser report counts), or `status: paused` with nothing else, in which case the embed shows only its first composition. A workflow that is a draft, archived or unknown answers 404, and the embed then behaves as a plain embed of its `composition-id`. So does a workflow whose owner is not being served (a plan that lapsed, a partner whose agreement is not in force): the answer is the one the compositions of that owner give.\n**Address.** `https://api.widgetic.com/embed/workflows/{workflowId}`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.\nThe answer may be reused for a few seconds (`Cache-Control: public, max-age=15`), so a publish or a pause reaches visitors within moments. The graph is readable by anyone who has the workflow's id: its rules run in the visitor's browser, so a rule must never hold a secret.", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "workflowId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The live version, or the word paused", "content": { "application/json": { "schema": { "title": "PublicWorkflowResponse", "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/PublicWorkflow" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } } } } }, "400": { "description": "The id is not a workflow id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "404": { "description": "No published workflow with this id (`NOT_FOUND`), or its owner is not being served: the code and the sentence are the ones the compositions of that owner get (`SUSPENDED` for a partner whose agreement is not in force, `NOT_FOUND` with the subscription sentence for a plan that lapsed)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "429": { "description": "Rate limited (`RATE_LIMITED`), always with `Retry-After`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "503": { "description": "Workflows cannot be read right now. The embed then behaves as a plain embed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } } } } }, "/embed/workflows/{workflowId}/versions/{versionId}": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "get": { "operationId": "getPublicWorkflowVersion", "summary": "Read one published version of a Workflow", "description": "Public read of one version of a workflow, for a visitor who started on it before a newer one was published: they finish on the version they started on (for up to 30 days; after that they get the latest). The graph of a version never changes once published; the languages its compositions can be shown in (`translations`) are read each time, as for the live version. Like the read of the live version, it answers `status: paused` with nothing else while the workflow is paused, and 404 when the workflow is a draft or archived, or has no such version.\n**Address.** `https://api.widgetic.com/embed/workflows/{workflowId}/versions/{versionId}`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "workflowId", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "versionId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The version, or the word paused", "content": { "application/json": { "schema": { "title": "PublicWorkflowResponse", "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/PublicWorkflow" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } } } } }, "400": { "description": "An id is not a workflow or version id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "404": { "description": "No published workflow with this id, or it has no such version (`NOT_FOUND`), or its owner is not being served (`SUSPENDED` for a partner whose agreement is not in force, `NOT_FOUND` with the subscription sentence for a plan that lapsed)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "429": { "description": "Rate limited (`RATE_LIMITED`), always with `Retry-After`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "503": { "description": "Workflows cannot be read right now. The embed then behaves as a plain embed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } } } } }, "/embed/workflows/{workflowId}/events": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "post": { "operationId": "reportPublicWorkflowEvents", "summary": "Report what visitors did in a Workflow, as counts", "description": "Public report of counts for a workflow, sent by the embed. No API key. Each event is one id and a number: a visitor reached a block (`n`), took a connection (`e`), or could not be moved on (`f`). Nothing else is kept: no visitor, no value a visitor typed, no address. A batch carries at most 100 events and 16 KB. The same report may carry `heights`: how tall a step settled at in the browser, which the embed code of the workflow uses to start its box at a real height (a composition, a whole number of pixels, nothing about the visitor).\nA report is accepted only with the `token` the workflow's own read handed out for that `versionId`, so a page that never read the workflow cannot raise its numbers. An expired token (`EVENT_TOKEN_EXPIRED`) is refused with 401: read the workflow again for a new one. Counts for ids that are not in that version, or for a workflow that is not live, are not recorded and the answer says so (`recorded: false`) with 200: the visitor's page has nothing to fix.\nThe body is JSON, sent as `application/json` or as `text/plain` (a \"simple\" cross-origin request, which is what lets a report leave a page that is being closed).\n**Address.** `https://api.widgetic.com/embed/workflows/{workflowId}/events`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "workflowId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicWorkflowEventsRequest" } }, "text/plain": { "schema": { "type": "string", "description": "The same JSON, as text." } } } }, "responses": { "200": { "description": "Nothing was counted or kept (`recorded` is false, with the reason)", "content": { "application/json": { "schema": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/PublicWorkflowEventsAccepted" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } } } } }, "202": { "description": "The counts were recorded", "content": { "application/json": { "schema": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/PublicWorkflowEventsAccepted" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } } } } }, "400": { "description": "The body is not what the door reads (`EVENTS_BODY_INVALID`, or a field that is not valid)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "401": { "description": "The token is missing, wrong, or expired (`EVENT_TOKEN_REQUIRED`, `EVENT_TOKEN_INVALID`, `EVENT_TOKEN_EXPIRED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "404": { "description": "The workflow's owner is not being served, so no count is taken (`SUSPENDED` for a partner whose agreement is not in force, `NOT_FOUND` with the subscription sentence for a plan that lapsed). Dropping the counts is fine.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "413": { "description": "Body too large (`PAYLOAD_TOO_LARGE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "415": { "description": "Not JSON or plain text (`UNSUPPORTED_MEDIA_TYPE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "429": { "description": "Rate limited (`RATE_LIMITED`), always with `Retry-After`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "503": { "description": "Counts cannot be recorded right now (`EVENT_TOKEN_UNAVAILABLE`, or `SERVICE_UNAVAILABLE`). Dropping them is fine.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } } } } }, "/embed/workflows/{workflowId}/frame": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "get": { "operationId": "getPublicWorkflowFrame", "summary": "Show a published Workflow in a page of its own", "description": "A page that runs a published workflow, for a place that can only be given an address or an iframe: a chat messenger, a link page, a site builder, a blog that follows oEmbed. No API key, no SDK to add. The page holds the Embed SDK and the same tag a website carries (``), so a visitor moves from one composition to the next in place, by the same rules, exactly as on a website. A paused workflow shows its first composition alone, as its embeds do.\n**What the frame can count.** Only what happens inside it: entries, a widget's goals and actions, and waits. The page events a website can send to a workflow (`widgetic:workflow-event`) are events of the page around the embed, and they do not cross an iframe, so a connection that waits for one never fires from a frame.\nA workflow that is a draft, is archived, or does not exist, and one whose owner is not being served, answers 404 with a short page that gives no reason. If the owner of the workflow's first composition listed the websites it may appear on, the page is sent with `Content-Security-Policy: frame-ancestors` naming those websites (and Widgetic's own, and the website where the partner the owner administers integrates Widgetic, with its subdomains), so a browser refuses to show it inside any other website. Opening the address directly still works. An owner who listed nothing is not restricted.\nThe page links its oEmbed card, so a site that follows oEmbed turns the address of the frame into an embed.\n**Address.** `https://api.widgetic.com/embed/workflows/{workflowId}/frame`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "workflowId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The page that runs the workflow", "content": { "text/html": { "schema": { "type": "string" } } } }, "400": { "description": "Invalid workflow UUID (standard validation response)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The workflow is not available (a short page that gives no reason): not published, unknown, or its owner is not being served", "content": { "text/html": { "schema": { "type": "string" } } } }, "429": { "description": "Rate limited (`RATE_LIMITED`), always with `Retry-After`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be read right now (a short page)", "content": { "text/html": { "schema": { "type": "string" } } } } } } }, "/embed/compositions/{compositionId}": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "get": { "operationId": "getPublicCompositionEmbed", "summary": "Resolve a composition UUID to a published widget URL", "description": "Public customer embed lookup. No API key. Used by embed-sdk.js on third-party sites.\nIf the composition's owner listed the websites it may appear on (the workspace's domain list, or the `allowedDomains` of a partner the owner administers), a request from any other website is refused with 403 `DOMAIN_NOT_ALLOWED`. The website is read from the `Origin` header, or the host of `Referer` when there is no `Origin`; a request that names neither (a server, a tool) is not refused. An owner who listed nothing is not restricted, and a page on the visitor's own machine (`localhost`, `127.0.0.1` or `[::1]`, on any port) is always allowed. So is the website where a partner integrates Widgetic, with every subdomain of it (`platformDomain` in the answer of `GET /partners/mine`), for the widgets of that partner: a partner's list never has to name it. The list stops other websites from showing the embed in a visitor's browser; it does not hide the published content from someone who holds the composition ID.\n**Address.** `https://api.widgetic.com/embed/compositions/{compositionId}`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.\n**Limit.** 500 calls for each visitor address and browser in one counting window, shared with the frame and the status routes. Over it the answer is 429 `RATE_LIMITED` with a `Retry-After` header.\n", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "compositionId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Published embed URL and optional direct frameless module", "content": { "application/json": { "schema": { "type": "object", "properties": { "compositionId": { "type": "string" }, "widgetId": { "type": "string" }, "version": { "type": "integer" }, "widgetVersion": { "type": "integer", "description": "Published widget version on the CDN artifact this composition uses." }, "playerVersion": { "type": "integer", "description": "Version of the player: the gateway frame wrapper that shows the widget, and the host bridge it speaks with the embedding page and the widget (currently 6). Raised when the messages between page, frame, and widget change in a way a widget could notice, such as a new `widgetic:host` field or a new forwarded event (2 added `entries`, 3 added `adapters`, 4 added `entries.writeToken`, 5 added the A/B goal: `widgetic:ab-goal` to the widget and `widgetic:goal` back, 6 added the watch of a workflow: `widgetic:workflow-watch` to the widget, the watched values in `widgetic:submitted` and the watched action in `widgetic:goal`). It is not `widgetVersion` (the version of the published widget) and not the `version` inside a `widgetic:host` message." }, "dataSource": { "type": "object", "nullable": true, "properties": { "url": { "type": "string" }, "refreshSeconds": { "type": "integer" } } }, "embedUrl": { "type": "string" }, "entryWriteToken": { "type": "string", "description": "Signed per-composition write token for `POST /embed/compositions/{compositionId}/entries/{table}`, also handed to the widget inside `widgetic:host` as `entries.writeToken`." }, "entries": { "type": "object", "description": "Where a direct or iframe embed writes visitor entries.", "properties": { "url": { "type": "string" }, "writeToken": { "type": "string" } } }, "adapters": { "type": "object", "description": "Where the widget's adapter modules (e-mail, upload, AI answers, decision, ...) call the gateway, and the public key of the CAPTCHA an operation may ask a visitor to solve. The same two facts the frame page gives the widget, so an embed that does not use the frame page (the Embed SDK, a widget mounted directly) can tell the widget too: the SDK passes them to the widget with `entries`. `entries.url` is where the widget writes visitor entries; this is where it calls operations.", "properties": { "url": { "type": "string", "description": "The operations' address; an operation is `{url}/{adapterId}/{operation}`.", "example": "https://api.widgetic.com/embed/compositions/0f6f7f0e-3c2a-4b86-9e51-2d8d5f4a7c11/adapters" }, "captcha": { "type": "object", "description": "Present only when the gateway has a CAPTCHA. There is one, so no provider is named.", "properties": { "siteKey": { "type": "string", "description": "The public site key of the CAPTCHA widget." } } } } }, "width": { "type": "integer" }, "height": { "type": "integer" }, "design": { "type": "object" }, "content": { "type": "object" }, "contentItems": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "iframeAllow": { "type": "string", "description": "The browser features the widget needs the iframe that shows it to be allowed to use, as the value of that iframe's `allow` attribute (for example `camera; microphone`; the words are `camera`, `display-capture` and `microphone`). Present only for a widget that uses a module that needs one, and absent for every other widget. A page that embeds the frame itself copies it onto its own iframe (`allow=\"...\"`); a page that does not leaves the widget to say, in its own words, that the feature is blocked there. The frame wrapper already passes it on to the iframe it holds.", "example": "camera; microphone" }, "media": { "type": "object", "description": "How the owner wants the images of this embed delivered.", "properties": { "optimize": { "type": "boolean", "description": "The owner's \"Optimize images for the web\" account setting (ON until they turn it off). When true the Embed SDK may ask Cloudflare for a right-sized, modern-format copy of each content image; when false it uses the originals." } } }, "direct": { "type": "object", "nullable": true, "description": "Present only when a confirmed direct (frameless) ESM artifact was published for this version", "properties": { "moduleUrl": { "type": "string" }, "contractVersion": { "type": "integer" }, "moduleHash": { "type": "string", "nullable": true } } } } } } }, "x-response-envelope": "raw" }, "403": { "description": "The composition's owner limited it to the websites they listed, and this request came from another (`code` is `DOMAIN_NOT_ALLOWED`; `details.reason` is `domain_not_allowed` or `opaque_origin`).\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "404": { "description": "Composition not found, not published, or embed suspended for billing (`code` is `NOT_FOUND`, `UNPUBLISHED` or `SUSPENDED`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "429": { "description": "Embed rate limit exceeded (`code` is `RATE_LIMITED`; the `Retry-After` header says when to ask again)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } } } } }, "/embed/compositions/{compositionId}/frame": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "get": { "operationId": "getPublicCompositionIframe", "summary": "Embed a published composition with its saved values", "description": "Public HTML wrapper with an inner published artifact iframe. No API key or SDK required.\nIf the composition's owner listed the websites it may appear on, the page is sent with `Content-Security-Policy: frame-ancestors` naming those websites (and Widgetic's own, and the website where the partner the owner administers integrates Widgetic, with its subdomains), so a browser refuses to show it inside any other website whatever `Referer` policy that website uses. Opening the address directly still works. An owner who listed nothing is not restricted.\n**Address.** `https://api.widgetic.com/embed/compositions/{compositionId}/frame`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.\n", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "compositionId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Composition iframe document", "content": { "text/html": { "schema": { "type": "string" } } } }, "400": { "description": "Invalid composition UUID (standard validation response)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition unavailable", "content": { "text/html": { "schema": { "type": "string" } } } }, "429": { "description": "Embed rate limit exceeded (the same count as the lookup route; `Retry-After` says when to ask again)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/embed/compositions/status": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "post": { "operationId": "postPublicCompositionEmbedStatus", "summary": "Batch-check whether compositions are currently served for embed", "description": "Public batch health check for embed-sdk.js. No API key. Uses the same serving gate and domain policy as `GET /embed/compositions/{compositionId}`: the caller's website is read from `Origin`, or the host of `Referer` when there is no `Origin`. A request that names neither (a server or tool) is not refused for domain reasons.\n**Address.** `https://api.widgetic.com/embed/compositions/status`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.\n**Limit.** The route counts against the same limit as the lookup and the frame routes: 500 calls for each visitor address and browser in one counting window. A call is ONE hit whatever the number of `ids` it carries (up to 100), so a server that checks many compositions spends one call for each hundred of them. A visitor who is over the limit gets 429 `RATE_LIMITED` for the WHOLE call, with a `Retry-After` header and no state for any id: there is no per-composition rate-limit state in the answer.", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "ids" ], "properties": { "ids": { "type": "array", "minItems": 1, "maxItems": 100, "items": { "type": "string", "format": "uuid" } } } } } } }, "responses": { "200": { "description": "Per-composition embed serve states", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "statuses": { "type": "object", "description": "One state for each distinct composition id asked for, keyed by that id.", "additionalProperties": { "type": "string", "description": "`served`: published and allowed on the caller's website. `unpublished`: not published, or its owner's plan does not serve it. `domain_not_allowed`: the owner listed websites and the caller's is not one of them. `suspended`: the partner of its owner is suspended. `not_found`: there is no such composition.", "enum": [ "served", "unpublished", "domain_not_allowed", "suspended", "not_found" ] } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] }, "example": { "success": true, "data": { "statuses": { "8baf5703-e134-4c34-94be-4b8616152277": "served" } } } } } }, "400": { "description": "Validation error (no ids, more than 100, or an id that is not a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Embed rate limit exceeded. The refusal covers the whole call (`code` is `RATE_LIMITED`; the `Retry-After` header says when to ask again).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } } } } }, "/embed/compositions/{compositionId}/adapters/{adapterId}/{operation}": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "post": { "operationId": "callPublicCompositionAdapter", "summary": "Call a gateway operation of an adapter a published widget uses", "description": "The door a widget's adapter module calls, from the visitor's browser, for the operations that cannot run in the browser: anything with a secret, a charge in credits or the owner's storage behind it. A widget that uses such an adapter is handed the address of this route as `adapters.url` in its `widgetic:host` message (see the host bridge contract) and calls `{adapters.url}/{adapterId}/{operation}`. It is not meant to be called by hand, and it takes no API key.\n**Address.** `https://api.widgetic.com/embed/compositions/{compositionId}/adapters/{adapterId}/{operation}`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.\n**What it serves.** Only an adapter, and a version of it, that the widget's LIVE manifest (what the version that is published uses) lists, and only an operation that runs on the gateway. Anything else is one 404 `ADAPTER_NOT_AVAILABLE`, whatever the reason, so the route is no way to ask what a widget contains. An adapter an administrator stopped offering to NEW widgets keeps serving the widgets that already use it.\n**Who may call.** The same rule as the entry route: a permitted `Origin` header, which is the artifact origin the widget runs from or any website when the owner has not restricted the allowed websites (when the owner has, one of the websites the owner listed, Widgetic's own sites, the visitor's own machine or the owner's own platform). Page script cannot forge it. A request without a permitted `Origin` is 403 `ORIGIN_NOT_ALLOWED`. A composition that is not served (unpublished, or its owner's plan does not serve it) is 404, with the codes of the other public embed routes. When the partner of the owner signs the host context, a context that is not signed as the partner requires is refused with 403 `CONTEXT_SIGNATURE_REQUIRED`, `CONTEXT_SIGNATURE_INVALID` or `CONTEXT_SIGNATURE_EXPIRED`.\n**Cost and retries.** An operation priced in credits is charged to the owner of the widget (for a customer a partner manages, to the partner's administrator, within the monthly credits set for that customer), once for each `requestId`, before it runs, and given back if it does not answer. A `requestId` that was charged and not given back is 409 `REQUEST_ALREADY_USED` and the operation is NOT run a second time; one whose charge was given back may be tried again with the same `requestId`. A visitor never sees an owner's balance: a feature that cannot be used because its owner has no credits left, because the customer's monthly credits are spent, or because an administrator stopped the adapter, is the same 503 `ADAPTER_UNAVAILABLE` as every other \"not right now\". The owner is told through a notice.\n**Limits.** In front of everything, 120 calls a minute for each visitor address and composition and 600 a minute for a composition (429 `RATE_LIMITED`). Then, for each operation of a widget, a rate for each visitor address a minute and a cap for the widget a day: 30 and 5000 for an operation that is free, 10 and 500 for one that costs credits, unless the adapter says otherwise (never above 120 and 100000). A visitor over the rate is 429 `RATE_LIMITED`; a widget over its cap is 429 `WIDGET_LIMIT_REACHED`. Both carry a `Retry-After` header. The body is at most 64 KiB (413 `PAYLOAD_TOO_LARGE`) and JSON (415 `UNSUPPORTED_MEDIA_TYPE`); an operation has 30 seconds to answer (504 `ADAPTER_TIMEOUT`, and the charge is given back).", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "compositionId", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "adapterId", "required": true, "description": "The id of the adapter, the name its module is known by, for example `upload`.", "schema": { "type": "string", "maxLength": 40, "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" } }, { "in": "path", "name": "operation", "required": true, "description": "The name of one operation of the adapter, as its documentation gives it.", "schema": { "type": "string", "maxLength": 40, "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallRequest" } } } }, "responses": { "200": { "description": "The operation answered", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallResult" } } } }, "400": { "description": "The body is not a call (`ADAPTER_BODY_INVALID`: a field that is not named here, a `requestId` of another shape, an `input` that is not an object), or the operation refused its input with a code of its own.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "403": { "description": "Origin not allowed (`ORIGIN_NOT_ALLOWED`), the operation asks for a CAPTCHA that is missing or failed (`CAPTCHA_REQUIRED`), or the context is not signed as the partner requires (`CONTEXT_SIGNATURE_REQUIRED`, `CONTEXT_SIGNATURE_INVALID`, `CONTEXT_SIGNATURE_EXPIRED`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "404": { "description": "The widget does not use this adapter, this version or this operation, or its owner switched it off in the editor (`ADAPTER_NOT_AVAILABLE`), or the composition is not there or not served (`NOT_FOUND`, `UNPUBLISHED`, `SUSPENDED`; an id that is not a UUID is `NOT_FOUND` too).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "409": { "description": "This `requestId` was already charged and not given back (`REQUEST_ALREADY_USED`). Start a new request.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "413": { "description": "Body too large (`PAYLOAD_TOO_LARGE`), or the operation refused an input it cannot take", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "415": { "description": "Not JSON (`UNSUPPORTED_MEDIA_TYPE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "422": { "description": "The operation refused an input it understood and cannot use, with a code of its own", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "429": { "description": "A limit was reached (`code` is `RATE_LIMITED`, or `WIDGET_LIMIT_REACHED` for the widget's daily cap); the `Retry-After` header says when to ask again. The body is the standard rate-limit envelope with the flat `code` beside it.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "502": { "description": "The operation failed (`ADAPTER_FAILED`, or a code of its own); any charge was given back", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "503": { "description": "The feature cannot be used right now (`ADAPTER_UNAVAILABLE`; the cause is never said), or the gateway could not tell whether the context must be signed (`CONTEXT_SIGNATURE_UNAVAILABLE`). Try again later.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "504": { "description": "The operation took too long (`ADAPTER_TIMEOUT`); any charge was given back", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } } } } }, "/embed/compositions/{compositionId}/adapters/upload/files/{ticket}": { "servers": [ { "url": "https://api.widgetic.com", "description": "The public embed routes are served at the root of the API host, not under /v1." } ], "put": { "operationId": "uploadPublicCompositionAdapterFile", "summary": "Send the file a visitor chose through the upload adapter of a published widget", "description": "The second of the two calls the `upload` adapter's module makes from the visitor's browser (the first, the `begin-upload` operation of `callPublicCompositionAdapter`, answers with the ticket this route takes). The module sends the file itself, as the body, with its media type as the `Content-Type`. It is not meant to be called by hand, and it takes no API key.\n**Address.** `https://api.widgetic.com/embed/compositions/{compositionId}/adapters/upload/files/{ticket}`: the root of the API host, NOT under `/v1`. A client generated from this description for `https://api.widgetic.com/v1` must be given the base address `https://api.widgetic.com` for the calls of the `Public Embed` tag.\n**The ticket.** Single-use and valid for ten minutes, given for one file: its name, its media type and its exact size are what the visitor said when the ticket was asked for, after the widget's owner's settings (the kinds of file they take, the largest size) were applied. The `Content-Type` and the `Content-Length` of this request must be those, and the body must be exactly that many bytes (400 `UPLOAD_FILE_CHANGED` otherwise). The gateway never believes the type it was told: the first bytes of the file must be a file of that type and one the owner accepts (422 otherwise). A ticket whose file was stored and is sent again is answered with the same file, so a visitor whose connection dropped after the file landed does not store it twice; a ticket whose attempt failed is spent, and the module asks for a new one.\n**The virus check.** Before anything is stored, the file is checked for viruses, wherever it would be kept (Widgetic's storage or a partner's own bucket). A file that fails the check is refused with 422 `UPLOAD_FILE_UNSAFE` and nothing is stored. When the check cannot be done, nothing is stored either, and the answer is the same neutral 503 `UPLOAD_UNAVAILABLE` as for any other cause the visitor is not told. The ticket of a refused file is spent.\n**What it stores.** The file goes to the widget owner's storage: Widgetic's, or the partner's own bucket for a widget of a customer a partner manages. It counts against the owner's storage allowance and is filed in the folder the owner chose, as a file sent by a visitor, which the owner's own file list leaves out. A full allowance, a partner's storage that cannot be used and a stopped feature are all the same 503 `UPLOAD_UNAVAILABLE` to a visitor, and the owner is told through a notice.\n**Who may call.** The same rule as the entry route: a permitted `Origin` header, which is the artifact origin the widget runs from or any website when the owner has not restricted the allowed websites (when the owner has, one of the websites the owner listed, Widgetic's own sites, the visitor's own machine or the owner's own platform). A request without a permitted `Origin` is 403 `ORIGIN_NOT_ALLOWED`. A composition that is not served (unpublished, or its owner's plan does not serve it) is 404, with the codes of the other public embed routes.\n**Limits.** 30 requests a minute for each visitor address and composition and 240 a minute for a composition (429 `RATE_LIMITED`, with a `Retry-After` header); at most 10 MB for a file, and only so many files held in memory at once on each gateway process (503 `UPLOAD_BUSY`, with a `Retry-After`). A file that does not arrive within two minutes is 408 `UPLOAD_TIMEOUT`. Every answer but a success closes the connection, so a client that is refused before it has sent the file reads the answer and stops.", "tags": [ "Public Embed" ], "x-visibility": "public", "x-access-level": "public", "parameters": [ { "in": "path", "name": "compositionId", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "ticket", "required": true, "description": "The ticket the `begin-upload` operation answered with.", "schema": { "type": "string", "minLength": 20, "maxLength": 128, "pattern": "^[A-Za-z0-9_-]{20,128}$" } } ], "requestBody": { "required": true, "content": { "application/pdf": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "audio/aac": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "audio/flac": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "audio/mp4": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "audio/mpeg": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "audio/ogg": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "audio/wav": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "audio/webm": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "image/gif": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "image/heic": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "image/heif": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "image/jpeg": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "image/png": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "image/webp": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "video/mp4": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "video/quicktime": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } }, "video/webm": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileBytes" } } } }, "responses": { "200": { "description": "The file is stored", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterFileResult" } } } }, "400": { "description": "What arrived is not the file the ticket was given for (`UPLOAD_FILE_CHANGED`: another type, another size, or a body that ended early or ran long).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "403": { "description": "Origin not allowed (`ORIGIN_NOT_ALLOWED`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "404": { "description": "The ticket is not valid, has expired or belongs to another widget (`UPLOAD_TICKET_INVALID`), the widget no longer uses the adapter or its owner switched it off (`ADAPTER_NOT_AVAILABLE`), or the composition is not there or not served (`NOT_FOUND`, `UNPUBLISHED`, `SUSPENDED`; an id that is not a UUID is `NOT_FOUND` too).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "408": { "description": "The file did not arrive in time (`UPLOAD_TIMEOUT`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "409": { "description": "The ticket was already used and its file was not stored (`UPLOAD_TICKET_USED`). Ask for a new ticket.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "411": { "description": "The request did not say how long the file is (`UPLOAD_LENGTH_REQUIRED`): send `Content-Length`.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "413": { "description": "The file is larger than the owner allows or than the platform takes (`UPLOAD_TOO_LARGE`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "415": { "description": "Not a media type the upload adapter takes (`UNSUPPORTED_MEDIA_TYPE`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "422": { "description": "The bytes are not a file of the kind they say (`UPLOAD_FILE_UNRECOGNIZED`, `UPLOAD_FILE_MISMATCH`), not a kind this widget's owner accepts (`UPLOAD_TYPE_NOT_ACCEPTED`), or a file the virus check refused (`UPLOAD_FILE_UNSAFE`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "429": { "description": "A limit was reached (`code` is `RATE_LIMITED`); the `Retry-After` header says when to ask again. The body is the standard rate-limit envelope with the flat `code` beside it.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicEmbedFailure" } } } }, "502": { "description": "The file could not be saved (`UPLOAD_FAILED`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } }, "503": { "description": "Uploads cannot be used right now (`UPLOAD_UNAVAILABLE` or `ADAPTER_UNAVAILABLE`; the cause is never said), or every place in memory is taken (`UPLOAD_BUSY`). Try again later.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PublicAdapterCallError" } } } } } } }, "/workspaces/{workspaceId}/workflows/composition-options": { "get": { "operationId": "listWorkspaceWorkflowCompositionOptions", "summary": "List the compositions a workflow can show, and what each can do", "description": "The workspace's compositions as the workflow editor offers them, newest first. For each one: whether it can be\nshown (its widget has a published version), the websites it may be embedded on, and which triggers it supports.\n\n- **Input added** (`inputs`) is enabled only for a composition that declares at least one table a visitor's\n entries can be written to. Its `tables` are all of them; its `fields` are the columns a rule may read (not\n `id` and `created_at`, not a column that is not text, a number or yes/no, and not one whose name says it holds\n a person's private details, such as an email or a phone number).\n- **Action in the widget** (`actions`) is enabled only when the published widget version declares at least one\n goal. Its `items` are the goals a trigger can wait for.\n\nWhen one of them is not enabled, `reason` says why (`widget_keeps_no_data`, `widget_reports_no_actions` or\n`widget_not_published`), so the editor can show the trigger disabled with an explanation. Publishing checks every\nreference again against what the composition can do at that moment.\nThe workspace is named by its UUID. Any active member can read it.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "name": "search", "in": "query", "required": false, "description": "Text the composition's name must contain", "schema": { "type": "string", "maxLength": 120 } }, { "name": "ids", "in": "query", "required": false, "description": "Only these compositions (comma-separated ids, at most 50), those of them you may see. Ask for the\ncompositions a workflow shows with this, so each is found whatever page it would be on. An id you may not\nsee is left out, as one that does not exist is.\n", "schema": { "type": "string" } }, { "name": "limit", "in": "query", "required": false, "description": "Page size (1-100, 50 when not given)", "schema": { "type": "integer" } }, { "name": "offset", "in": "query", "required": false, "description": "How many to skip (0 when not given)", "schema": { "type": "integer" } }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The compositions the editor can offer", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowCompositionOptions" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID), or ids is not a list of at most 50 composition ids", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/presets": { "get": { "operationId": "listWorkspaceWorkflowPresets", "summary": "List the starting points for a new Workflow", "description": "The workflows you can start from in this workspace: published workflows that Widgetic offers or, for one of a\npartner's managed users, that the partner offers (a managed user is never shown Widgetic's, and a person is never\nshown a partner's). Only what can be started now is listed, in the order the offerer set (smallest `position`\nfirst, then by `key`). Each shows what you would get, and none shows who made it or any id of its own.\nStart from one with `createWorkspaceWorkflowFromPreset`.\nThe workspace is named by its UUID. Any active member can read the list.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The starting points (an empty list when none is offered)", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowPresetChoices" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/from-preset": { "post": { "operationId": "createWorkspaceWorkflowFromPreset", "summary": "Start a Workflow from a starting point", "description": "Makes your own copy of a starting point (`listWorkspaceWorkflowPresets`): a copy of every widget it chains (an\nordinary private widget that serves the starting point's published code), a composition of your own on each copy\n(a draft, with the content, design, embed settings and tables of the original), and a draft workflow wired like the\nstarting point's live version. The workflow is named as you ask, or after the starting point. Nothing you do to the\ncopy reaches the starting point, and nothing its offerer changes afterwards reaches your copy. The workflow stays a\ndraft: publish it when it is ready.\n\nA start takes a few seconds, because each widget is copied. Send an `Idempotency-Key` so that asking again after\na timeout makes one copy. When a start fails (503 with `details.reason` `preset_copy_failed`) the compositions it\nmade are removed again, so asking again is safe; the widget copies it made stay in the workspace as ordinary\nwidgets. The workspace's limit of workflows is checked before anything is copied.\n\nA starting point that is not offered to you, or that can no longer be started, is 404.\nThe workspace is named by its UUID. Any active member can start one.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "required": [ "key" ], "properties": { "key": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$", "description": "The starting point, as `listWorkspaceWorkflowPresets` gives it.", "example": "welcome-then-offer" }, "name": { "type": "string", "minLength": 1, "maxLength": 120, "nullable": true, "description": "The new workflow's name. The starting point's title when left out." } } } } } }, "responses": { "201": { "description": "The workflow was made, as a draft", "content": { "application/json": { "schema": { "title": "WorkflowDetailResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowDetail" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace, the key or the name is not acceptable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No starting point with this key is offered to you, or it can no longer be started", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The workspace already holds as many workflows as it may", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The starting point could not be set up right now (`details.reason` is `preset_copy_failed`; nothing was left that you must clean up), or workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows": { "get": { "operationId": "listWorkspaceWorkflows", "summary": "List the Workflows of a Workspace", "description": "Lists the workspace's workflows, newest first unless `sort` says otherwise. Archived workflows are left out\nunless `status` asks for them (`archived`, or `all`).\nThe workspace is named by its UUID. Any active member can read the list.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "name": "search", "in": "query", "required": false, "description": "Text the workflow's name must contain", "schema": { "type": "string", "maxLength": 120 } }, { "name": "managedUserId", "in": "query", "required": false, "description": "Only the workflows made for this customer of yours (a managed user, by Widgetic's id). Not together with `managedUserExternalId`.", "schema": { "type": "string", "format": "uuid" } }, { "name": "managedUserExternalId", "in": "query", "required": false, "description": "Only the workflows made for the customer you registered with this id of your own (a managed user's `externalId`). Not together with `managedUserId`.", "schema": { "type": "string", "maxLength": 255 } }, { "name": "status", "in": "query", "required": false, "description": "One state to list (`draft`, `live`, `paused`, `archived`), or `all` for every state. Without it, the ones in use (draft, live and paused).", "schema": { "type": "string", "enum": [ "draft", "live", "paused", "archived", "all" ] } }, { "name": "sort", "in": "query", "required": false, "description": "`:` where field is createdAt, lastPublishedAt, runsCount or name (or just asc / desc for createdAt). Newest first when not given.", "schema": { "type": "string", "example": "runsCount:desc" } }, { "name": "limit", "in": "query", "required": false, "description": "Page size (1-100, 50 when not given)", "schema": { "type": "integer" } }, { "name": "offset", "in": "query", "required": false, "description": "How many to skip (0 when not given)", "schema": { "type": "integer" } }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "A page of the workspace's workflows", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowList" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID), or a query value is not one this list accepts", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createWorkspaceWorkflow", "summary": "Create a Workflow", "description": "Makes a draft workflow. Give it a composition and the workflow is born with one block, which starts it; without\none it starts empty. A workspace holds up to 500 workflows.\nThe workspace is named by its UUID. Any active member can create one.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 120, "example": "Welcome journey" }, "compositionId": { "type": "string", "format": "uuid", "nullable": true, "description": "A composition of this workspace to start with." }, "timezone": { "type": "string", "nullable": true, "description": "An IANA time zone name; UTC when not given.", "example": "Europe/Bucharest" } } } } } }, "responses": { "201": { "description": "The workflow was created", "content": { "application/json": { "schema": { "title": "WorkflowDetailResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowDetail" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace, the name, the time zone or the composition is not acceptable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The workspace already holds as many workflows as it may", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}": { "get": { "operationId": "getWorkspaceWorkflow", "summary": "Get a Workflow", "description": "Reads a workflow with its draft graph and the version that is live.\nThe workspace is named by its UUID. Any active member can read it.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The workflow", "content": { "application/json": { "schema": { "title": "WorkflowDetailResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowDetail" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "saveWorkspaceWorkflow", "summary": "Save the Draft of a Workflow", "description": "Saves the name, the time zone and/or the graph of the draft. Send at least one. The save names the `revision` the\neditor started from and is refused with 409 (`BUSINESS_STATE_CONFLICT`) when the draft has moved on, so two\npeople editing do not overwrite each other without knowing; read the workflow again and apply the change to it.\nA save is never refused for what is wrong with the graph (a block with no connection yet is normal in a draft):\nonly the shape is judged here, and what stops a workflow going live is told when it is published. A graph larger\nthan 200,000 bytes, or with more than 100 blocks or 300 connections, is refused.\nAn archived workflow cannot be saved. Saving a live workflow changes the draft only: visitors keep getting the\npublished version until the changes are published.\nThe workspace is named by its UUID. Any active member can save.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "revision" ], "properties": { "revision": { "type": "integer", "minimum": 1, "description": "The revision the editor read." }, "name": { "type": "string", "minLength": 1, "maxLength": 120 }, "timezone": { "type": "string", "example": "Europe/Bucharest" }, "graph": { "$ref": "#/components/schemas/WorkflowGraph" } } } } } }, "responses": { "200": { "description": "The draft was saved; the answer is the workflow without its graph (its new `revision` is in it)", "content": { "application/json": { "schema": { "title": "WorkflowResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/Workflow" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "Nothing to save, or the name, the time zone or the shape of the graph is not acceptable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The draft changed since `revision` (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`), or the\nworkflow is archived. Nothing is overwritten. `details.currentRevision` is the revision to start again from,\nand for a workflow of a team workspace `details.lastEditedBy` (`{ id, name }`, or `null`) and\n`details.lastEditedAt` say who saved first and when.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteWorkspaceWorkflow", "summary": "Delete a Workflow", "description": "Deletes a workflow, in whatever state it is in (draft, live, paused or archived), with all its versions and\ncounts. It cannot be undone: archive the workflow instead to keep it. The compositions it chained are not\ntouched, and a page whose embed still names the workflow shows the embed's first composition, as for a paused\none. Asking for a workflow that is already gone is \"not found\".\nThe workspace is named by its UUID. Any active member can delete.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The workflow was deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowRemoved" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/duplicate": { "post": { "operationId": "duplicateWorkspaceWorkflow", "summary": "Duplicate a Workflow", "description": "Makes a draft copy of a workflow (its draft graph, not its versions or counts), named \" (copy)\".\nThe workspace is named by its UUID. Any active member can duplicate.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "201": { "description": "The copy", "content": { "application/json": { "schema": { "title": "WorkflowDetailResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowDetail" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The workspace already holds as many workflows as it may", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/publish": { "post": { "operationId": "publishWorkspaceWorkflow", "summary": "Publish the Draft of a Workflow", "description": "Checks the draft and, when nothing stops it, makes it the next version and the one new visitors get. Versions never\nchange once published. A visitor already partway through keeps the version they started on (for up to 30 days).\nThe check reads what each composition can do right now (a table the visitor adds to, a goal the widget reports,\nthe websites it may be embedded on), so a workflow never goes live pointing at something that has gone.\nIt is refused with 422 (`BUSINESS_OPERATION_INVALID`) when the draft has errors; the `issues` in the error's\n`details` name the blocks to fix: an unconnected trigger, a condition without rules, a composition that is not\npublished, a field or action that is gone, a composition whose allowed websites exclude the site the workflow\nstarts on. Nothing is published when the draft has no changes since the live version.\nThe `revision` is the one the editor read, and a publish of a draft that has moved on is refused with 409.\nThe workspace is named by its UUID. Any active member can publish.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "revision" ], "properties": { "revision": { "type": "integer", "minimum": 1 } } } } } }, "responses": { "200": { "description": "Published; the answer holds the workflow, the new version and any advice", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowPublishResult" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID), or the revision is missing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The draft changed since `revision`, it is archived, or there is nothing new to publish (BUSINESS_STATE_CONFLICT; `details.reason` says which). When the draft changed, `details.currentRevision` is the revision to start again from and, for a workflow of a team workspace, `details.lastEditedBy` and `details.lastEditedAt` say who saved first and when.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The draft cannot be published as it is; `details.issues` lists what to fix (WorkflowIssue), and nothing has changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/discard": { "post": { "operationId": "discardWorkspaceWorkflowChanges", "summary": "Discard the Unpublished Changes of a Workflow", "description": "Puts the draft back to the live version (its graph and its time zone). Only for a workflow that has been\npublished; one that never was has no live version to go back to. Names the `revision` the editor read.\nThe workspace is named by its UUID. Any active member can discard.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "revision" ], "properties": { "revision": { "type": "integer", "minimum": 1 } } } } } }, "responses": { "200": { "description": "The draft is the live version again", "content": { "application/json": { "schema": { "title": "WorkflowDetailResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowDetail" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID), or the revision is missing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The draft changed since `revision`, the workflow is archived, or it was never published (BUSINESS_STATE_CONFLICT). When the draft changed, `details.currentRevision`, `details.lastEditedBy` and `details.lastEditedAt` are as for a save.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/versions": { "get": { "operationId": "listWorkspaceWorkflowVersions", "summary": "List the Published Versions of a Workflow", "description": "Every version the workflow has had, newest first, with who published it and when. The one visitors get is marked\n`isLive`.\nThe workspace is named by its UUID. Any active member can read.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The versions", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowVersionList" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/versions/{versionId}": { "get": { "operationId": "getWorkspaceWorkflowVersion", "summary": "Get a Published Version of a Workflow", "description": "One published version with its graph, for the read-only preview and for the Runs view.\nThe workspace is named by its UUID. Any active member can read.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/WorkflowVersionId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The version", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowVersionDetail" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow or version in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/versions/{versionId}/restore": { "post": { "operationId": "restoreWorkspaceWorkflowVersion", "summary": "Restore a Version of a Workflow into the Draft", "description": "Copies a published version into the draft, so it can be changed and published again. Nothing is published and\nnothing visitors see changes: the version stays in the history as it was. Names the `revision` the editor read.\nThe workspace is named by its UUID. Any active member can restore.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/WorkflowVersionId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "revision" ], "properties": { "revision": { "type": "integer", "minimum": 1 } } } } } }, "responses": { "200": { "description": "The draft now holds the version", "content": { "application/json": { "schema": { "title": "WorkflowDetailResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowDetail" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID), or the revision is missing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow or version in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The draft changed since `revision`, or the workflow is archived (BUSINESS_STATE_CONFLICT). When the draft changed, `details.currentRevision`, `details.lastEditedBy` and `details.lastEditedAt` are as for a save.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/pause": { "post": { "operationId": "pauseWorkspaceWorkflow", "summary": "Pause a Workflow", "description": "While a workflow is paused, its embeds show only their first composition (the `composition-id` of the embed) and no\nvisitor moves on. The live version is kept, and visitors partway through carry on from where they were when it is\nresumed. Only a live workflow can be paused.\nThe workspace is named by its UUID. Any active member can pause.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The workflow is paused", "content": { "application/json": { "schema": { "title": "WorkflowResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/Workflow" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The workflow is not live (BUSINESS_STATE_CONFLICT)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/resume": { "post": { "operationId": "resumeWorkspaceWorkflow", "summary": "Resume a Paused Workflow", "description": "Makes a paused workflow live again, on the version that was live when it was paused.\nThe workspace is named by its UUID. Any active member can resume.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The workflow is live", "content": { "application/json": { "schema": { "title": "WorkflowResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/Workflow" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The workflow is not paused (BUSINESS_STATE_CONFLICT)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/archive": { "post": { "operationId": "archiveWorkspaceWorkflow", "summary": "Archive a Workflow", "description": "Takes a workflow out of the default list and stops it serving: its embeds show only their first composition,\nas when paused. It is kept, with its versions and counts, until it is deleted.\nThe workspace is named by its UUID. Any active member can archive.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The workflow is archived", "content": { "application/json": { "schema": { "title": "WorkflowResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/Workflow" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The workflow is already archived (BUSINESS_STATE_CONFLICT)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/unarchive": { "post": { "operationId": "unarchiveWorkspaceWorkflow", "summary": "Unarchive a Workflow", "description": "Brings an archived workflow back into the list: as paused when it was ever published (resume it to serve visitors\nagain), as a draft when it never was.\nThe workspace is named by its UUID. Any active member can unarchive.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The workflow is back in the list", "content": { "application/json": { "schema": { "title": "WorkflowResponse", "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/Workflow" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The workflow is not archived (BUSINESS_STATE_CONFLICT)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/workflows/{workflowId}/managed-user": { "put": { "operationId": "setWorkspaceWorkflowManagedUser", "summary": "Move a Workflow to Another Managed User", "description": "Files a workflow of your partner workspace under a managed user, or moves it to another one, after it was made.\nName the managed user by Widgetic's id (`managedUserId`) or by your own identifier for the user\n(`managedUserExternalId`), never both. It must be one of your managed users, and switched on\n(`409 MANAGED_USER_INACTIVE` otherwise).\n\nThe workflow's blocks, its versions, its state (live, paused, archived) and the counts of what visitors did stay as\nthey were, and a live workflow keeps serving. Only `updatedAt` moves, as it does for any change. The compositions\nit chains are not moved with it: each stays filed under the managed user it has. Sending the managed user the\nworkflow already has is not an error.\n\nOnly with your own API key, in your partner workspace: a call made for one managed user (an editor session, or the\n`X-Managed-User-Id` header) is refused with `403`, and so is a workspace that is not your partner workspace. The\nAPI key needs the `partner:write` and `content:write` scopes, and the plan must include workflows.", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserReference" } } } }, "responses": { "200": { "description": "The workflow is filed under the managed user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID); no managed user was named (`MANAGED_USER_REFERENCE_REQUIRED`), both ways of naming one were sent (`MANAGED_USER_REFERENCE_AMBIGUOUS`), or the id or the `managedUserExternalId` is not valid (`MANAGED_USER_REFERENCE_INVALID`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), the workspace is not your partner workspace, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace (`RESOURCE_WORKFLOW_NOT_FOUND`), or none of your managed users has that id (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off (`MANAGED_USER_INACTIVE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The managed user already has as many workflows as one can have (`BUSINESS_OPERATION_INVALID`, `details.reason` is `too_many_workflows`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, WorkflowsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst workflowsApi = new WorkflowsApi(config);\n\ntry {\n // Name the managed user by your own id for it (or send managedUserId, Widgetic's id)\n const filed = await workflowsApi.setWorkspaceWorkflowManagedUser({\n workspaceId: 'workspace_123',\n workflowId: 'workflow_123',\n managedUserReference: { managedUserExternalId: 'user-42' }\n });\n console.log('Filed under:', filed.data.managedUserId);\n} catch (error) {\n console.error('Failed to move the workflow:', error);\n}\n" } ] }, "delete": { "operationId": "removeWorkspaceWorkflowManagedUser", "summary": "Take a Workflow's Managed User Label Off", "description": "Takes a workflow of your partner workspace off the managed user it is filed under, so it is your own again. The\nworkflow's blocks, versions, state and counts stay as they were (only `updatedAt` moves), and the compositions it\nchains stay with the managed users they are filed under. A workflow that is filed under no one answers the same, so a retry is safe. Your own\nworkflows count toward the 500 a workspace can hold; one that would go over that is refused (`422`).\n\nOnly with your own API key, in your partner workspace: a call made for one managed user (an editor session, or the\n`X-Managed-User-Id` header) is refused with `403`, and so is a workspace that is not your partner workspace. The\nAPI key needs the `partner:write` and `content:write` scopes, and the plan must include workflows.", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" } ], "responses": { "200": { "description": "The workflow is filed under no managed user (`managedUserId` is `null`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "400": { "description": "The workspace is not the id of a workspace (a UUID)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), the workspace is not your partner workspace, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace (`RESOURCE_WORKFLOW_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Your own workflows already fill the workspace (`BUSINESS_OPERATION_INVALID`, `details.reason` is `too_many_workflows`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, WorkflowsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst workflowsApi = new WorkflowsApi(config);\n\ntry {\n const unfiled = await workflowsApi.removeWorkspaceWorkflowManagedUser({\n workspaceId: 'workspace_123',\n workflowId: 'workflow_123'\n });\n console.log('Filed under:', unfiled.data.managedUserId); // null\n} catch (error) {\n console.error('Failed to take the label off:', error);\n}\n" } ] } }, "/workspaces/{workspaceId}/workflows/{workflowId}/stats": { "get": { "operationId": "getWorkspaceWorkflowStats", "summary": "Get what Visitors Did in a Workflow", "description": "Counts per block and per connection over a range of UTC days (the last 30 days when not given, up to 366), for one\nversion or for all of them. Only counts: how many visitors reached a block, took a connection, or could not be\nmoved on, and, where the visitor's browser said why a block could not be shown, how many of those failures had each\nreason (`failedReasons`: a timeout, an error of the widget, a build that failed, or another reason). No visitor and\nno value a visitor typed is ever stored.\nThe workspace is named by its UUID. Any active member can read.\n", "tags": [ "Workflows" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "$ref": "#/components/parameters/WorkflowWorkspaceId" }, { "$ref": "#/components/parameters/WorkflowId" }, { "name": "versionId", "in": "query", "required": false, "description": "Count one version only", "schema": { "type": "string", "format": "uuid" } }, { "name": "from", "in": "query", "required": false, "description": "First UTC day (YYYY-MM-DD)", "schema": { "type": "string", "example": "2026-10-01" } }, { "name": "to", "in": "query", "required": false, "description": "Last UTC day (YYYY-MM-DD)", "schema": { "type": "string", "example": "2026-10-27" } }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The counts", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowStats" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A day is not YYYY-MM-DD, the range is backwards or longer than 366 days, or the version is not this workflow's", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, the plan does not include workflows (`AUTHZ_PLAN_RESTRICTION`), or the call is made for one managed user (`X-Managed-User-Id`) in a workspace other than your partner workspace (`MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such workflow in this workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/workflow-presets": { "get": { "operationId": "listPartnerWorkflowPresets", "summary": "List the workflows a partner offers as places to start", "description": "The partner's starting points, ordered by `position` and then by `key`: the published workflows it offers its managed\nusers when they make a new workflow. Each says whether people can start from it now and, when they cannot, why. The\nlist is the same for every managed user, and a managed user is shown only what is available.\n\nA starting point is one of the partner account's own published workflows, built from compositions the account made\nfor itself (not for a customer or a team) and from widgets the partner already offers as presets\n(`setPartnerPreset`), and it uses at most 10 widgets. A partner offers up to 50.\n\nThe caller must be the person who administers the partner (an API key of that account works), or a Widgetic\nadministrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose starting points to list" } ], "responses": { "200": { "description": "The partner's starting points (an empty list when it offers none)", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/OfferedWorkflowPresetList" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The partner id is not an id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/workflow-presets/{key}": { "put": { "operationId": "setPartnerWorkflowPreset", "summary": "Offer a workflow as a place to start, or replace what a key offers", "description": "Offers one of the partner account's own published workflows to its managed users under `key`. If the partner already\noffers something under that key it is replaced, so sending the same request twice is safe. Saving replaces the whole\nstarting point: a `title`, `description` or `position` you leave out goes back to its default.\n\nKeys are 1 to 64 characters: lowercase letters, digits, hyphens and underscores, the first a letter or a digit.\n\nA workflow is offered once. What people get is the workflow's live version as it is when they start, so publishing\nthe workflow changes what new starts get; workflows people already started are never touched. The offer is\nrefused, and `error.details.reason` says why, when the workflow:\n\n- is not the partner account's own (a workflow of a team or of a customer, or of somebody else), or does not exist:\n 404, the same for both;\n- is archived (409 `workflow_archived`), or was never published (409 `workflow_not_published`);\n- shows no composition (422 `workflow_empty`), or a block shows a composition made for a customer or a team\n (422 `composition_not_own`);\n- chains more than 10 widgets (422 `too_many_widgets`), or a widget that the partner does not offer as a preset\n (422 `widget_not_preset`; `error.details.widgets` lists them, each with its `id` and `name`, so they can be offered\n first with `setPartnerPreset`);\n- is already offered under another key (409 `workflow_already_offered`; `error.details.key` says which), or the\n partner already offers 50 (409 `too_many_presets`).\n\nThe caller must be the person who administers the partner (an API key of that account works), or a Widgetic\nadministrator, who offers the partner's workflow on its behalf.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose starting point to set" }, { "in": "path", "name": "key", "required": true, "schema": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" }, "description": "The name your code and the picker use for the starting point" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OfferWorkflowPresetRequest" } } } }, "responses": { "200": { "description": "The starting point as saved", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/OfferedWorkflowPreset" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The key or a field is malformed or not allowed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only), or the workflow is not one of the partner account's own", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The workflow is archived, was never published, is already offered, the partner already offers as many as it may, or the partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The workflow cannot be given away as it is (see the description for the reasons)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "removePartnerWorkflowPreset", "summary": "Stop offering a workflow as a place to start", "description": "Removes the starting point under `key`. The workflow itself is not touched, and neither are the workflows people\nalready started from it.\n\nRemoving a starting point the partner does not offer is not an error: the answer is `removed: false`.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose starting point to remove" }, { "in": "path", "name": "key", "required": true, "schema": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" }, "description": "The key of the starting point to remove" } ], "responses": { "200": { "description": "Whether a starting point was removed", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/WorkflowPresetRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The key is malformed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Workflows cannot be used on this server right now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/widgets/{id}/managed-user": { "put": { "operationId": "setWidgetManagedUser", "summary": "Move a Widget to Another Managed User", "description": "Files a widget you made under a managed user, or moves it to another one, after it was created. Name the managed\nuser by Widgetic's id (`managedUserId`) or by your own identifier for the user (`managedUserExternalId`), never\nboth. It must be one of your managed users, and switched on (`409 MANAGED_USER_INACTIVE` otherwise).\n\nThe widget's canvas moves with it, because a widget made without a canvas of its own gets one filed under the same\nmanaged user. The compositions made from the widget do not move: each keeps the managed user it is filed under,\nso a widget can stay shared by compositions of several of your customers. Nothing else about the widget changes.\nReports read who something is filed under when they are asked for, so the widget counts for its new managed user\nfrom then on. Sending the managed user it already has is not an error.\n\nOnly the account that made the widget can do this (`404` for any other), and only with your own API key: a call\nmade for one managed user (an editor session, or the `X-Managed-User-Id` header) is refused with `403`.\nThe API key needs the `partner:write` and `content:write` scopes.", "tags": [ "Widgets" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Widget ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserReference" } } } }, "responses": { "200": { "description": "The widget is filed under the managed user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "400": { "description": "No managed user was named (`MANAGED_USER_REFERENCE_REQUIRED`), both ways of naming one were sent (`MANAGED_USER_REFERENCE_AMBIGUOUS`), or the id or the `managedUserExternalId` is not valid (`MANAGED_USER_REFERENCE_INVALID`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The widget is not yours, or does not exist (`RESOURCE_WIDGET_NOT_FOUND`), or none of your managed users has that id (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off (`MANAGED_USER_INACTIVE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, WidgetsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst widgetsApi = new WidgetsApi(config);\n\ntry {\n // Name the managed user by your own id for it (or send managedUserId, Widgetic's id)\n const filed = await widgetsApi.setWidgetManagedUser({\n id: 'widget_123',\n managedUserReference: { managedUserExternalId: 'user-42' }\n });\n console.log('Filed under:', filed.data.managedUserId);\n} catch (error) {\n console.error('Failed to move the widget:', error);\n}\n" } ] }, "delete": { "operationId": "removeWidgetManagedUser", "summary": "Take a Widget's Managed User Label Off", "description": "Takes a widget off the managed user it is filed under, so it is your own again. Its canvas comes off the managed\nuser with it. The compositions made from the widget keep the managed user each one is filed under. A widget that\nis filed under no one answers the same, so a retry is safe.\n\nOnly the account that made the widget can do this (`404` for any other), and only with your own API key: a call\nmade for one managed user (an editor session, or the `X-Managed-User-Id` header) is refused with `403`.\nThe API key needs the `partner:write` and `content:write` scopes.", "tags": [ "Widgets" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Widget ID" } ], "responses": { "200": { "description": "The widget is filed under no managed user (`managedUserId` is `null`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The widget is not yours, or does not exist (`RESOURCE_WIDGET_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, WidgetsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst widgetsApi = new WidgetsApi(config);\n\ntry {\n const unfiled = await widgetsApi.removeWidgetManagedUser({\n id: 'widget_123'\n });\n console.log('Filed under:', unfiled.data.managedUserId); // null\n} catch (error) {\n console.error('Failed to take the label off:', error);\n}\n" } ] } }, "/widgets": { "get": { "operationId": "getWidgets", "summary": "List Widgets", "description": "Lists the widgets your account owns, newest first. A widget is the reusable piece a composition is made\nfrom; this is your own library, not a catalogue of Widgetic's widgets.\n\nPass `page` (counting from 1) and `size` (1 to 100, 20 when left out) to read the list one page at a time.\n`meta` then carries `total`, `hasNextPage` and `hasPreviousPage`, so a client can walk the list to its end.\nA page past the end is an empty list. Without `page` and `size` the call returns the whole list in one\nresponse, which only suits an account with a few widgets.\n\nPass `canvasId` to find the widget on one of your canvases. A canvas holds one widget, so that list has one\nwidget, or none while the canvas is empty. It is always returned whole, whatever `page` and `size` say.\n\nPass `managedUserId` (Widgetic's id for one of your managed users) or `managedUserExternalId` (your own\nidentifier for the user) to list only the widgets made for that managed user. Only a partner has managed\nusers, so this needs an active partner API key. The widgets of your other managed users, and your own, are\nleft out. It combines with `page`, `size` and `canvasId`. A managed user that is not yours, or does not\nexist, is answered with 404 and `MANAGED_USER_NOT_FOUND`.\n", "tags": [ "Widgets" ], "x-access-level": "user", "x-visibility": "public", "security": [ { "apiKeyAuth": [] } ], "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1 }, "description": "Page to return, counting from 1. Giving `page` or `size` turns paging on." }, { "in": "query", "name": "size", "schema": { "type": "integer", "minimum": 1, "maximum": 100 }, "description": "How many widgets a page holds (20 when `page` is given without it). Giving `page` or `size` turns paging on." }, { "in": "query", "name": "canvasId", "schema": { "type": "string", "format": "uuid" }, "description": "Find the widget on this canvas. A canvas holds one widget, so the list has one widget, or none while the canvas is empty. The list is returned whole." }, { "in": "query", "name": "managedUserId", "schema": { "type": "string", "format": "uuid" }, "description": "List only the widgets made for this managed user (Widgetic's id for the user). Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both." }, { "in": "query", "name": "managedUserExternalId", "schema": { "type": "string", "maxLength": 255 }, "description": "List only the widgets made for the managed user you registered with this `externalId` (your own identifier for the user). Partners only. Send this or `managedUserId`, not both." } ], "responses": { "200": { "description": "List of widgets", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/Widget" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A parameter is not valid (for example `size` above 100, a `canvasId` or `managedUserId` that is not a UUID, or both `managedUserId` and `managedUserExternalId`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The key's role may not use this endpoint.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user named by `managedUserId` or `managedUserExternalId` is not one of yours (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. See the Retry-After header.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createWidget", "summary": "Create Widget", "description": "Creates a widget for your account: a named record with a type and some starting content, on a canvas of\nits own (or on an empty canvas of yours that you name: a canvas holds one widget, and one that already has a\nwidget is refused with 409 and `CANVAS_ALREADY_HAS_WIDGET`). It costs no credits and has no code yet; the code is generated for\nit afterwards. The new widget is yours, and you can list it with `getWidgets`. A widget is a draft until\nyou say otherwise (`isDraft: false`).\n\nIf a step after the widget was saved does not go through, the widget is still created, and\n`data.warnings` says what did not. Read it before relying on the widget.\n\nA widget can be placed on one of your canvases (`canvasId`), in a project you can edit (`projectId`) or in a\nworkspace where you may create widgets (`organizationId`). Naming anything you cannot use is refused\nwith 403, and the answer is the same whether it exists or not.\n\nEvery widget belongs to one workspace. It goes where its project is; with no project, in the workspace you\nname (`organizationId`); and when you name neither, in the workspace the call works in (the one your API key\nor connection belongs to, or the one you last chose on widgetic.com). A project of one workspace together with\nthe id of another is refused with 400. A person who belongs to no workspace yet is told so (403\n`NO_WORKSPACE`), and a call that acts for no person (an internal service) must name the workspace.\n\nTo make the widget for one of your managed users, send `managedUserId` or `managedUserExternalId`. Only a\npartner has managed users, so this needs an active partner API key. The widget stays in your account and is\nyours to edit; the tag lets you list one user's widgets with `getWidgets`. The managed user must be yours\nand active: one that is not yours, or does not exist, is answered with 404 and `MANAGED_USER_NOT_FOUND`,\nand one that is switched off with 409 and `MANAGED_USER_INACTIVE`. The tag is set here and does not change\nafterwards.\n\nThis call has a limit of its own: 120 per minute for each account (ask Widgetic if you need more). Past\nthat the call is answered with 429 and a `Retry-After`. A widget has no database of its own: what the\nvisitors of a composition leave is kept in the tables of that composition, made when the composition is.\nThe `Idempotency-Key` header is required; send the same key when you retry, so one widget is created, not\ntwo.\n", "tags": [ "Widgets" ], "x-access-level": "user", "x-visibility": "public", "security": [ { "apiKeyAuth": [] } ], "parameters": [ { "in": "header", "name": "Idempotency-Key", "required": true, "schema": { "type": "string" }, "description": "A unique value (a UUID is fine) that makes a retry of this request safe." } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewWidget" } } } }, "responses": { "201": { "description": "Widget created successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "allOf": [ { "$ref": "#/components/schemas/Widget" }, { "type": "object", "properties": { "warnings": { "type": "array", "description": "What did not go through, when the widget was created without all of its parts (for example, the canvas it sits on could not be told that this is its main widget). Absent when everything did.", "items": { "type": "string" } } } } ] }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "Invalid request, or the `Idempotency-Key` header is missing.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The key's role may not use this endpoint, or `canvasId`, `projectId` or `organizationId` names\nsomething you may not use.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user named by `managedUserId` or `managedUserExternalId` is not one of yours (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off, so nothing new can be made for it (`MANAGED_USER_INACTIVE`), or the canvas named by `canvasId` already has a widget (`CANVAS_ALREADY_HAS_WIDGET`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many widgets created in a minute. See the Retry-After header.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/widgets/{id}/composition": { "post": { "operationId": "createCompositionFromWidget", "summary": "Create a composition for a widget in one call", "description": "After a managed user publishes a widget from the creator, call this with the widget id, the customer's\nmanaged user (when the widget is not already filed under one), and optional content, design, embed settings\nand locale. Every input is validated before a single insert; a failure never leaves a half-made composition.\n\nWhen the widget is already tagged with a managed user, you may omit `managedUserId`. When you send it, it\nmust match that tag. Only a partner has managed users, so `managedUserId` needs an active partner API key.\n\nA widget that keeps what visitors send (a form, a vote, a rating) declares its tables in its own source\n(`src/lib/meta/database.json`); they are made for the composition here, in a schema of its own, as the widget\nwas when it was last published. A widget that keeps nothing leaves the composition without tables. If the\ntables cannot be made just now, or the widget's file cannot be used, the composition is still created (`201`)\nand `meta.warnings` says why; the tables are made the next time the widget is generated.\n\nThe widget must be published. The `Idempotency-Key` header is required.\n", "tags": [ "Widgets" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The widget id" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" }, "content": { "type": "object" }, "design": { "type": "object", "nullable": true }, "embedSettings": { "type": "object" }, "locale": { "type": "string" }, "managedUserId": { "type": "string", "format": "uuid", "description": "The managed user the composition is made for (Widgetic's id for the user). Partners only, with an active partner API key. Leave it out when the widget is already tagged with a managed user; when you send it, it must match that tag." } } }, "example": { "name": "Published widget embed", "managedUserId": "123e4567-e89b-12d3-a456-426614174000", "locale": "de-DE" } } } }, "responses": { "201": { "description": "Composition created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionResponse" } } } }, "400": { "description": "Validation failed (`VALIDATION_ERROR`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Widget or managed user not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Managed user inactive or widget not published", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limited", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/widgets/batch": { "post": { "operationId": "getWidgetsBatch", "summary": "Get Widgets Batch", "description": "Retrieves multiple widgets by their IDs in a single request. An id that is not found, or that is not yours, is reported in `errors` exactly like one that does not exist. Called with an editor session, only the widgets made for the session's managed user are returned.", "tags": [ "Widgets" ], "x-access-level": "user", "x-visibility": "public", "security": [ { "apiKeyAuth": [] } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "widgetIds" ], "properties": { "widgetIds": { "type": "array", "items": { "type": "string" } } } } } } }, "responses": { "200": { "description": "Widgets batch result", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetWidgetsBatchResponse" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/uploads": { "post": { "operationId": "uploadFile", "tags": [ "Uploads" ], "summary": "Upload a file", "description": "Stores one file for the account and returns its public address. This is how a user's own images,\nvideo and PDFs reach a widget's content.\n\nSend a `multipart/form-data` request with the file in the field named `file`. The file counts\nagainst the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and\n`QUOTA_STORAGE_EXCEEDED`. An API key always uploads to the workspace it was made for, and so does a\nShopify store's session; a person signed in on widgetic.com uploads to the workspace they are currently\nworking in. The storage of one workspace never adds to another's, and one never lends room to the other.\nA file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a\ntype that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `getUploadLimits` lists the size\nlimit and the accepted types.\n\nA file is judged by what is in it, not by the type it is sent as. A file that is not the type it claims (a\nweb page sent as `image/png`) is refused with 415 and `UPLOAD_UNSUPPORTED_TYPE`, and a picture sent under\nthe wrong picture type is stored under the type it really is, which `mime_type` in the answer says. An SVG\nis rewritten as it is stored: script, `foreignObject`, animation and references to other addresses are\ntaken out, it must be UTF-8 and at most 2 MB, and the stored file can be larger or smaller than the one\nsent. Anything that is not an image, audio or video (a PDF, for example) is served as a download rather\nthan shown in a page.\n\nWhen the full storage is a Shopify store's team's, extra storage cannot be added through Shopify yet, so the\nmessage ends by saying so and what to do instead: delete files, or contact support. On a Solo plan it names\nthe Teams plan (which holds more) and `error.details.planPageUrl` is the address of the plan page on Shopify.\n`error.suggestedAction` says the same in a few words, instead of the usual \"upgrade your storage plan\". Any\nother workspace gets the shorter message.\n\nTo upload the file for one of your managed users, send `managedUserId` (Widgetic's id for the user) or\n`managedUserExternalId` (your own identifier for the user), not both. Only a partner has managed users, so\nthis needs an active partner API key. The file stays in your account and counts against its allowance; the\ntag lets you list one user's files with `listUploads`. The managed user must be yours and active: one that is not yours, or does not exist, is refused with 404 and\n`MANAGED_USER_NOT_FOUND`, and one that is switched off with 409 and `MANAGED_USER_INACTIVE`, before the\nfile is stored. The tag is set here and does not change afterwards.\n\nCalled with an editor session (`createManagedUserEditorSession`), the file is always filed for the\nsession's own managed user and is always media for widget content: naming another managed user is\nrefused with 403 and `MANAGED_USER_SESSION_MISMATCH`, and `contextType`, `source`, `widgetId` and\n`conversationId` are ignored. A full storage allowance is refused with the same 413 and\n`QUOTA_STORAGE_EXCEEDED`, but the message only says that it is not available right now (not how much is\nstored: that is the partner's business) and `error.details.limit` is `storage`.\n\nAn account that administers a partner with a storage destination (`setPartnerStorageDestination`) has\nits files stored in the partner's own bucket instead. Such a file takes none of the allowance, its `url`\nis served from the partner's public address, and its `storage_key` is the key in the partner's bucket.\nThe file is never stored with Widgetic instead: when the destination cannot be used the upload is refused\nwith 503 and `STORAGE_DESTINATION_UNAVAILABLE`, and when the partner's storage rejects the file with\n502 and `STORAGE_DESTINATION_WRITE_FAILED`.\n\nPartner storage is not optional, and it does not depend on how the file arrives. A partner's own uploads (with\nits API key, an SDK token, or from the Widgetic website, the resumable route and the media library alike)\nand the uploads of its customers' editor sessions are kept in the partner's own storage or not at all, so a\npartner with no destination (or one that removed it after the session was made) has them refused with 409\nand `PARTNER_STORAGE_REQUIRED`; they are never stored with Widgetic. An editor session's browser is only\ntold that the feature is not available right now.\n", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "required": [ "file" ], "properties": { "file": { "type": "string", "format": "binary", "description": "The file to store" }, "contextType": { "type": "string", "enum": [ "widget-codegen", "browser-ic", "content-property" ], "default": "content-property", "description": "What the file is for. Send `content-property` for media that becomes widget content (images, video and PDF); the other values are used by Widgetic's own editor.\n" }, "source": { "type": "string", "enum": [ "chat-upload", "chat-screenshot", "browser-ic-screenshot", "preview-screenshot", "file-browser-upload" ], "default": "file-browser-upload", "description": "Which part of the product, or which client, the file comes from" }, "managedUserId": { "type": "string", "format": "uuid", "description": "Upload the file for one of your managed users, by Widgetic's id for the user. Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both." }, "managedUserExternalId": { "type": "string", "maxLength": 255, "description": "The same, by your own identifier for the user, the `externalId` you gave when you created the managed user. Partners only. Send this or `managedUserId`, not both." }, "purpose": { "type": "string", "enum": [ "canvas", "chat", "field" ], "description": "Where in your product you use the file. It is kept with the file, so that a customer's storage can be counted by purpose (`getManagedUserStorageUsage`). Optional; any other value is refused with 400 and `UPLOAD_INVALID_PURPOSE`." } } } } } }, "responses": { "200": { "description": "The stored file", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadResponse" } } } }, "400": { "description": "No file was sent, more than one was, or it was not in the field named `file`; or a managed user field is not valid (`MANAGED_USER_REFERENCE_INVALID`, or `MANAGED_USER_REFERENCE_AMBIGUOUS` when both are sent); or `purpose` is not one of the three (`UPLOAD_INVALID_PURPOSE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "An editor session named a managed user other than its own (`MANAGED_USER_SESSION_MISMATCH`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user is not one of yours (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off, so nothing new can be uploaded for it (`MANAGED_USER_INACTIVE`); or an editor session uploaded and the partner has no storage destination (`PARTNER_STORAGE_REQUIRED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "413": { "description": "The file is over the size limit (`UPLOAD_TOO_LARGE`), or the storage of the workspace the file is for is full (`QUOTA_STORAGE_EXCEEDED`; for a Shopify store's team the message also says what to do, and on a Solo plan `error.details.planPageUrl` is the plan page)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "415": { "description": "The file type is not accepted, or the contents are not the type the file was sent as (`UPLOAD_UNSUPPORTED_TYPE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "502": { "description": "The partner's own storage did not accept the file (`STORAGE_DESTINATION_WRITE_FAILED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The account's storage destination cannot be used right now (`STORAGE_DESTINATION_UNAVAILABLE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "get": { "operationId": "listUploads", "tags": [ "Uploads" ], "summary": "List the account's uploads", "description": "The files of the workspace the caller works in, newest first: the workspace's shared files (every member's, and those of members who have since left). The workspace is the one a person signed in on widgetic.com switched to, or the one an API key or a connection belongs to; an editor session names none and lists the files of the account. Deleted files are not listed. Returns at most `limit` files and has no further pages: a client that needs more narrows the list instead, for example to one managed user's files with `managedUserId` or `managedUserExternalId` (only a partner has managed users, so those two need an active partner API key). The files that visitors sent through a widget's upload adapter (`source` is `widget-visitor-upload`) are not part of this list, so that a popular widget does not push the account's own files out of it; naming one widget with `widgetId` lists what visitors sent to that widget as well.\n", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "Maximum number of files to return" }, { "in": "query", "name": "managedUserId", "schema": { "type": "string", "format": "uuid" }, "description": "List only the files uploaded for this managed user (Widgetic's id for the user). Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both." }, { "in": "query", "name": "managedUserExternalId", "schema": { "type": "string", "maxLength": 255 }, "description": "List only the files uploaded for the managed user you registered with this `externalId` (your own identifier for the user). Partners only. Send this or `managedUserId`, not both." } ], "responses": { "200": { "description": "The account's uploads, newest first", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/Upload" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A managed user field is not valid (`MANAGED_USER_REFERENCE_INVALID`, or `MANAGED_USER_REFERENCE_AMBIGUOUS` when both are sent), or `widgetId` or `conversationId` is not a UUID", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user is not one of yours (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/uploads/limits": { "get": { "operationId": "getUploadLimits", "tags": [ "Uploads" ], "summary": "Upload size limits and accepted file types", "description": "The size limit and the accepted file types of the upload endpoints. Read them from here rather than hard-coding thresholds: they are configuration and can change. The limits are the same for every account, whatever its plan: `multipart_max_bytes` for a file sent in one request (10 MB) and `tus_max_bytes` for a resumable upload (250 MB).\n", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "responses": { "200": { "description": "The current limits", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadLimitsResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/uploads/{id}": { "get": { "operationId": "getUpload", "tags": [ "Uploads" ], "summary": "Get an upload by id", "description": "The details of one of the account's uploads. An upload that belongs to another account is not found.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The upload to read" } ], "responses": { "200": { "description": "The upload", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UploadResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such upload on this account (`UPLOAD_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteUpload", "tags": [ "Uploads" ], "summary": "Delete an upload", "description": "Removes the stored file and the upload row. A file in Widgetic's own storage gives back the space it took from\nthe storage allowance it was charged to (the team's shared space for a file uploaded in a team workspace); a file in\nyour own bucket is removed from your bucket. Deleting an upload that is already gone succeeds the same way as the\nfirst delete. A file you uploaded can always be deleted by you. A file in a team's workspace can also be deleted by\nthe owner and by every active member of that team, whoever uploaded it (the files of a workspace are the whole\nteam's). An upload that belongs to another account, or to a team you are not a member of, is not found.\nIf the storage cannot be reached the call fails and nothing is marked deleted, so it can be repeated.\n", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The upload was deleted or was already deleted", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "properties": { "deleted": { "type": "boolean" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] }, "example": { "success": true, "data": { "deleted": true } } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such upload on this account (`UPLOAD_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/uploads/{id}/managed-user": { "put": { "operationId": "setUploadManagedUser", "tags": [ "Uploads" ], "summary": "Move an upload to another managed user", "description": "Files an upload your account made under a managed user, or moves it to another one, after it was uploaded. Name the\nmanaged user by Widgetic's id (`managedUserId`) or by your own identifier for the user (`managedUserExternalId`),\nnever both. It must be one of your managed users, and switched on (`409 MANAGED_USER_INACTIVE` otherwise).\n\nIt changes whose file this is and nothing else: the file, its address and the storage it is charged to stay as they\nwere. The storage report groups uploads by the managed user they are filed under when it is asked for, so the file\ncounts for its new managed user from then on. Sending the managed user it already has is not an error.\n\nOnly an upload your own account made can be moved (`404` for any other, and for one that was deleted), and only with\nyour own API key: a call made for one managed user (an editor session, or the `X-Managed-User-Id` header) is refused\nwith `403`. The API key needs the `partner:write` and `content:write` scopes. This answer names its fields in\ncamelCase, whatever the other answers of the uploads routes do.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The upload to move" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserReference" } } } }, "responses": { "200": { "description": "The upload is filed under the managed user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "400": { "description": "No managed user was named (`MANAGED_USER_REFERENCE_REQUIRED`), both ways of naming one were sent (`MANAGED_USER_REFERENCE_AMBIGUOUS`), or the id or the `managedUserExternalId` is not valid (`MANAGED_USER_REFERENCE_INVALID`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such upload on this account (`UPLOAD_NOT_FOUND`), or none of your managed users has that id (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off (`MANAGED_USER_INACTIVE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, UploadsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst uploadsApi = new UploadsApi(config);\n\ntry {\n // Name the managed user by your own id for it (or send managedUserId, Widgetic's id)\n const filed = await uploadsApi.setUploadManagedUser({\n id: 'upload_123',\n managedUserReference: { managedUserExternalId: 'user-42' }\n });\n console.log('Filed under:', filed.data.managedUserId);\n} catch (error) {\n console.error('Failed to move the upload:', error);\n}\n" } ] }, "delete": { "operationId": "removeUploadManagedUser", "tags": [ "Uploads" ], "summary": "Take an upload's managed user label off", "description": "Takes an upload off the managed user it is filed under, so it is your own again. Nothing else about the file\nchanges. An upload that is filed under no one answers the same, so a retry is safe.\n\nOnly an upload your own account made can be changed (`404` for any other, and for one that was deleted), and only\nwith your own API key: a call made for one managed user (an editor session, or the `X-Managed-User-Id` header) is\nrefused with `403`. The API key needs the `partner:write` and `content:write` scopes. This answer names its fields\nin camelCase, whatever the other answers of the uploads routes do.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The upload" } ], "responses": { "200": { "description": "The upload is filed under no managed user (`managedUserId` is `null`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such upload on this account (`UPLOAD_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, UploadsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst uploadsApi = new UploadsApi(config);\n\ntry {\n const unfiled = await uploadsApi.removeUploadManagedUser({\n id: 'upload_123'\n });\n console.log('Filed under:', unfiled.data.managedUserId); // null\n} catch (error) {\n console.error('Failed to take the label off:', error);\n}\n" } ] } }, "/tokens/validate": { "get": { "tags": [ "Tokens" ], "operationId": "validateToken", "summary": "Validate current authentication token", "description": "Describes the credential the request was made with: how it signs in (`tokenType`), what it may do (`scopes`), the\naccount it belongs to (`userId`) and the workspace it works in (`workspace`). An API key works in the one workspace it\nwas made for, whichever workspace its owner is looking at on widgetic.com; a signed-in session names none (`workspace`\nis null), and follows the workspace the person has chosen. A credential that belongs to the platform itself, and not to\na customer's account, is held to no scope: it is answered with `tokenType` `service_key`, `scopes` `[\"*:*\"]`, no `userId`\nand no `workspace`.\n", "x-access-level": "user", "x-visibility": "public", "security": [ { "ApiKeyAuth": [] }, { "BearerAuth": [] } ], "responses": { "200": { "description": "Token validation successful", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "valid": { "type": "boolean", "example": true }, "tokenType": { "type": "string", "enum": [ "api_key", "jwt_token", "service_key" ], "example": "api_key" }, "scopes": { "type": "array", "items": { "type": "string" }, "example": [ "compositions:read", "widgets:read" ] }, "userId": { "type": "string", "example": "user_123" }, "expiresAt": { "type": "string", "format": "date-time", "example": "2024-12-31T23:59:59Z" }, "workspace": { "type": "object", "nullable": true, "description": "The workspace the credential works in: the one an API key was made for. Null for a credential that names none (a signed-in session follows the person's workspace choice).", "properties": { "id": { "type": "string", "format": "uuid", "example": "5f1c1a6e-2f0c-4f3a-9d0f-6a2a3a1c9b7e" }, "name": { "type": "string", "nullable": true, "description": "The workspace's name; null when it could not be read just now.", "example": "Studio" } } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Invalid or expired token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/mine": { "get": { "operationId": "getMyPartners", "summary": "Find the partner you administer", "description": "Returns the partner (nearly always one) that the signed-in account administers, with the id every other\npartner route asks for and the standing it is in: `active`, `inactive` (not activated yet), `suspended`\n(paused, with the reason Widgetic gave), `payment_arrears` (a contract invoice is past its due date and\nunpaid, since `overdueSince`; the partner is stopped until it is paid), `winding_down` (the partnership has\nended and nothing can be changed any more) or `closed` (the wind-down is over). Each partner says where its\npartnership is on the way to its end in `partnership`. A partner API key (`wgt_prt_`) is a\nkey of the partner's home workspace and acts as the account that administers the partner, so it reads its own\npartner here.\n\nAn account that administers no partner is not refused: it gets `standing: not_a_partner` and an empty\nlist, so a dashboard can tell \"this is not a partner account\" from \"something failed\".\n\nThe call stays open while the partner is paused, not yet active, in payment arrears, winding down or closed\n(to the owner signed in on widgetic.com; a key is refused once the partnership is closed): that is when its\ndashboard has to say why.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "responses": { "200": { "description": "The partners the account administers, and the account's standing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/MyPartnersResponse" } } } }, "401": { "description": "The API key or session is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The API key does not carry the `partner:read` scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/credits/balance": { "get": { "operationId": "getPartnerCreditBalance", "summary": "Get partner credit balance", "description": "Returns the credits the partner has, and how much of that is reserved by operations that are still running.\nA partner's credits belong to its own workspace, the one that is made with the partner, and are all held in\nONE account: the account of the person who administers it, the same account its API key acts as. There is\nnothing else to create or to fund. What its customers' editor sessions and its own API calls spend comes out of that\nworkspace, and the credits a paid invoice carries are added to it, so this is the balance of the partner's\nworkspace, where `getUserCreditBalance` reads the workspace the request acts in. The other workspaces its\nadministrator may own hold credits of their own, which are not the partner's and are not in this balance.\n\nA partner with no administrator has no account to hold credits, and reads a balance of 0.\n\nAccess: the person who administers the partner, or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Partner ID" } ], "responses": { "200": { "description": "The partner's credit balance", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AccountCreditBalanceResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (a Widgetic administrator asked for an id that does not exist)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/credits/transactions": { "get": { "operationId": "getPartnerCreditTransactions", "summary": "Get partner credit transaction history", "description": "Lists what happened to the partner's credits, newest first: the entries of the credit ledger of the partner's\nworkspace, held in the account of the person who administers it, the one account a partner has for its credits.\nEvery operation that spends credits is a `debit` entry, the credits an invoice carried arrive as `credit`\nentries when the invoice is paid, and the credits of a contract period that end are an `expiration` entry, so\nthis is also how the partner's usage is read. It is the statement of the partner's workspace, where\n`getUserCreditTransactions` reads the workspace the request acts in; the entries of the other workspaces its\nadministrator may own are not in it.\n\nA partner with no administrator has no account, and an empty ledger.\n\nThe page is always bounded: `limit` defaults to 20 and is capped at 100, `offset` defaults to 0.\n\nAccess: the person who administers the partner, or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Partner ID" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Number of transactions to return" }, { "in": "query", "name": "offset", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Number of transactions to skip" }, { "in": "query", "name": "type", "schema": { "type": "string" }, "description": "Only entries of this type, for instance `debit` for the credits spent. The types are listed on `AccountCreditTransaction`.\n" } ], "responses": { "200": { "description": "The partner's ledger entries, newest first", "content": { "application/json": { "schema": { "title": "AccountCreditTransactionListResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/AccountCreditTransaction" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (a Widgetic administrator asked for an id that does not exist)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/credits/extra-invoice": { "post": { "operationId": "createPartnerExtraCreditsInvoice", "summary": "Buy extra credits for a partner", "description": "Asks Widgetic for an invoice for extra credits, on top of the credits of the contract. Name the dollars; the\ninvoice is for the most whole credits they buy at the **list price** of a credit (the price a contract may\nlower belongs to the contract), so it is never for more than you asked, and can be a few cents under it. The\nsmallest purchase is 10 dollars and one request buys at most 100000 (ask Widgetic for an invoice for more).\n\nPay the invoice with the link in the answer. When it is paid the credits are added **once, for good**, to the\naccount of the person who administers the partner, which is the account everything the partner builds is\ncharged to (`getPartnerCreditBalance` shows it). Extra credits **do not expire**, unlike the credits of a\ncontract period, which end with it. Nothing is added before the invoice is paid, and an unpaid invoice for\nextra credits never stops the partner: only an unpaid invoice of the contract does (`payment_arrears`).\n\nAvailable only to partners that have an active paid contract in force with Widgetic (`NO_PAID_CONTRACT` when\nnone is in force) and no overdue contract invoice (`CONTRACT_INVOICE_OVERDUE` while a contract invoice is past\nits due day). A partner that has run out of credits during its period can buy more at the list price.\n\nNot available once an end date is set for the partnership (`PARTNERSHIP_ENDING`, from the day the date is set,\nwhether it is still ahead or past): credits bought for a partnership that is ending would be forfeited with it.\nA partner that needs more credits before its end date asks Widgetic.\n\nAn `Idempotency-Key` is required, and it is what makes a retry safe: the same key with the same body returns\nthe invoice already issued, the same key with a different body is refused with 422, and a duplicate that\narrives while the first is still running is refused with 409. Use one key per purchase you mean to make, and\na new key for the next one. At most 10 requests an hour.\n\nWho may ask: the person who administers the partner, or a Widgetic administrator. A key limited to scopes\nneeds `billing:write`.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Partner ID" }, { "in": "header", "name": "Idempotency-Key", "required": true, "schema": { "type": "string", "minLength": 8, "maxLength": 50, "pattern": "^[A-Za-z0-9_-]+$" }, "description": "A key of your own for this purchase, so that a retry cannot make a second invoice" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RequestExtraCredits" } } } }, "responses": { "200": { "description": "The invoice was issued", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerExtraCreditsInvoiceResponse" } } } }, "400": { "description": "The amount is not a number of dollars and cents, is under 10 or over 100000, or the Idempotency-Key header is missing or malformed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (a Widgetic administrator asked for an id that does not exist)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Another request with this Idempotency-Key is still running", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "This Idempotency-Key was already used with a different body, the partner has no active paid contract (`NO_PAID_CONTRACT`), the partnership has an end date (`PARTNERSHIP_ENDING`), the partner owes an overdue contract invoice (`CONTRACT_INVOICE_OVERDUE`), the partner has no administrator account to add the credits to (`NO_PARTNER_ADMINISTRATOR`), there is no billing email and no contact email to send the invoice to (`NO_BILLING_EMAIL`), or Stripe did not accept the tax ID on the billing profile (`TAX_ID_INVALID`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests; at most 10 an hour", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Stripe could not issue the invoice. Nothing was sent; retry with the same Idempotency-Key.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/billing-overview": { "get": { "operationId": "getPartnerBillingOverview", "summary": "Get comprehensive partner billing overview", "description": "Retrieves the partner's credits (`operationalCredits`), the partner's contract terms (`partnerCustomization`, the same fields as `getPartnerContract`) and billing integration status. Internal negotiation notes are not part of it.\n`operationalCredits` is the credits of the partner's workspace, held in the one account a partner has for its credits: the account of the person who administers it. It holds `balance` (the same balance `getPartnerCreditBalance` reads), `reservedBalance`, `availableBalance` (what a new operation can use) and `recentTransactions` (the ten newest entries of the ledger `getPartnerCreditTransactions` lists). A partner with no administrator has no account, and reads 0 and an empty list.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Partner ID" } ], "responses": { "200": { "description": "Partner billing overview retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/PartnerBillingOverview" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } } } } }, "/partners/{partnerId}/contract": { "get": { "operationId": "getPartnerContract", "summary": "Get a partner's contract", "description": "Returns the commercial terms agreed with the partner: price, included credits and storage, billing\ncycle, commitment, support level, and the dates the contract runs between.\n\nA partner reads its own: the caller must be the person who administers the partner (an API key of\nthat account works), and anyone else is refused with 403 whether or not the partner exists. Widgetic\nadministrators can read any partner's. Responds 404 while no contract has been recorded for the\npartner, which is the case until Widgetic sets its terms.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose contract to read" } ], "responses": { "200": { "description": "The partner's contract", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerContractResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No contract has been recorded for this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/storage": { "put": { "operationId": "setPartnerStorageDestination", "summary": "Set where a partner's uploaded files are stored", "description": "Points the partner at a bucket of its own on an S3-compatible service (Cloudflare R2, Amazon S3,\nWasabi, MinIO and the like). From then on, every file the account that administers the\npartner stores is kept in that bucket instead of with Widgetic, whichever way it arrives: a file sent with\n`uploadFile` (with an API key, an SDK token, an editor session or from the Widgetic website), a resumable\nupload, the media library, and the files the agent tools and the MCP server save. It takes none of the\naccount's storage allowance, and its `url` is served from `publicBaseUrl`. The chunks of a resumable\nupload wait in Widgetic's temporary staging area until it is completed and are removed then: the finished\nfile is stored in your bucket and nowhere else.\n\nA destination is required. Partner storage is not optional: your customers' files, and your own however they\narrive, are kept in this destination and nowhere else. An editor session\n(`createManagedUserEditorSession`) of any surface cannot be made until a destination is set (409\n`PARTNER_STORAGE_REQUIRED`), a destination removed later stops the uploads of the sessions already made\n(the same 409), and your own upload with no destination (on any route, including a resumable upload, which\nis refused when it is started) is refused in the same way instead of being stored with Widgetic. A partner\ncannot be activated until it has a destination that works.\n\nThe destination is checked before it is saved. Widgetic writes a small test file under\n`widgetic-check/`, reads it back from `/`, and deletes it. If any\nstep fails nothing is saved and the answer is 422 `STORAGE_DESTINATION_UNVERIFIED`: `details.step` says\nwhere (`endpoint`, `write` or `public_read`), `details.reason` says why, and `param` names the field most\nlikely to be wrong.\n\nWhat the bucket needs:\n- an access key that may put objects into it (it may also delete objects, which lets the test file be\n cleaned up, but that is not required);\n- its files publicly readable at `publicBaseUrl`, either because the bucket is public or through a CDN.\n\nThe secret access key is stored encrypted and is never returned or logged; a response shows only the last\nfour characters of the access key id (`accessKeyHint`). Saving replaces the whole destination, so send\nevery field again, including the secret. Files already stored stay where they are, and keep working for\nas long as that bucket stays publicly readable.\n\nOnce a destination is set, an upload is never stored with Widgetic instead: when the destination cannot be\nused the upload is refused with 503 `STORAGE_DESTINATION_UNAVAILABLE`, and when the bucket rejects the\nfile with 502 `STORAGE_DESTINATION_WRITE_FAILED`.\n\nThe caller must be the person who administers the partner (an API key of that account works); anyone else\nis refused with 403 whether or not the partner exists. Widgetic administrators can set any partner's.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose storage destination to set" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetPartnerStorageDestinationRequest" } } } }, "responses": { "200": { "description": "The destination passed the check and was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerStorageDestinationResponse" } } } }, "400": { "description": "A field is missing, malformed or not allowed. The error's param names it.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The destination did not pass the check (STORAGE_DESTINATION_UNVERIFIED). Nothing was saved.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Storage destinations are not enabled on this server (PARTNER_STORAGE_DISABLED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "get": { "operationId": "getPartnerStorageDestination", "summary": "Get where a partner's uploaded files are stored", "description": "Returns the partner's storage destination without its secret: the endpoint, bucket, folder and public\naddress, the last four characters of the access key id, when the destination last passed the check, and\nwhy the latest re-check failed if it did. Responds 404 while the partner has no destination, which means\nthe partner cannot be activated, its uploads are refused, and no editor session is made for its customers\nuntil a destination is set.\n\nThe caller must be the person who administers the partner, or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose storage destination to read" } ], "responses": { "200": { "description": "The partner's storage destination", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerStorageDestinationResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The partner has no storage destination", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "removePartnerStorageDestination", "summary": "Stop storing a partner's uploaded files in its own bucket", "description": "Removes the partner's storage destination. Partner storage is not optional, so after this every upload of\nthe account, on any route, and the uploads of your customers' editor sessions are refused (409\n`PARTNER_STORAGE_REQUIRED`) until a destination is set again, and no editor session can be made. Files\nalready in the partner's bucket are not touched and are not moved: they stay where they are, at the\naddresses they were given.\n\nRemoving a destination the partner does not have is not an error: the answer is `removed: false`.\n\nThe caller must be the person who administers the partner, or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose storage destination to remove" } ], "responses": { "200": { "description": "Whether a destination was removed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerStorageRemovalResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/storage/verify": { "post": { "operationId": "verifyPartnerStorageDestination", "summary": "Check that a partner's storage destination still works", "description": "Runs the same check as `setPartnerStorageDestination` against the destination already saved: a test\nfile is written, read back from the public address and deleted. Use it after rotating a key or changing\na bucket policy, or when uploads are failing with 502 or 503.\n\nThe result is recorded either way. A pass refreshes `verifiedAt` and clears `lastVerificationError`; a\nfailure answers 422 `STORAGE_DESTINATION_UNVERIFIED` and is recorded in `lastVerificationError` and\n`lastVerificationFailedAt`, so the destination shows what went wrong the next time it is read. A failed\ncheck does not remove the destination or stop uploads from using it.\n\nThe caller must be the person who administers the partner, or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose storage destination to check" } ], "responses": { "200": { "description": "The destination passed the check", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerStorageDestinationResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The partner has no storage destination", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The destination did not pass the check (STORAGE_DESTINATION_UNVERIFIED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many checks in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Storage destinations are not enabled on this server (PARTNER_STORAGE_DISABLED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/presets": { "get": { "operationId": "listPartnerPresets", "summary": "List the widgets a partner offers as presets", "description": "Returns the partner's presets, ordered by `position` and then by `key`: the widgets it offers its managed\nusers as starting points. The list is the same for every managed user.\n\nUse a preset in one of two ways:\n- **Make a composition of it** (the content and design editor): call `createComposition` with the preset's\n `widgetId` and the managed user. The widget itself stays yours; a composition is the user's own content.\n- **Give the user a copy to build on** (the Widget Creator): call `copyPresetForManagedUser`. The user gets\n a widget and a canvas of their own.\n\nPresets are not the same as the widgets Widgetic puts on every new Widgetic account. Those are chosen by\nWidgetic and are copied at sign-up. A preset here is yours, and is copied only when you ask.\n\nThe caller must be the person who administers the partner (an API key of that account works), or a\nWidgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose presets to list" } ], "responses": { "200": { "description": "The partner's presets (an empty list when it has none)", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/PartnerPreset" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/presets/{key}": { "put": { "operationId": "setPartnerPreset", "summary": "Make a widget a preset, or replace a preset", "description": "Offers one of the partner's own widgets as a preset under `key`. If the partner already has a preset under\nthat key it is replaced, so sending the same request twice is safe. Saving replaces the whole preset: a\n`title`, `description` or `position` you leave out goes back to its default.\n\nKeys are 1 to 64 characters: lowercase letters, digits, hyphens and underscores, the first a letter or a\ndigit (`rating`, `quiz-3`).\n\nThe widget must belong to the partner's account; a widget that does not exist and one that belongs to\nsomebody else are refused in the same way (404 `PRESET_WIDGET_NOT_FOUND`). A widget is a preset under at\nmost one key (409 `PRESET_WIDGET_ALREADY_USED`; `details.key` says which), and an account can have at\nmost 100 presets (409 `PRESET_LIMIT_REACHED`).\n\nLater changes to the widget reach new copies and new compositions; copies made earlier are not touched.\nDeleting the widget removes its preset.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose preset to set" }, { "in": "path", "name": "key", "required": true, "schema": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" }, "description": "The name your code uses for the preset" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetPartnerPresetRequest" } } } }, "responses": { "200": { "description": "The preset as saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerPresetResponse" } } } }, "400": { "description": "The key or a field is malformed or not allowed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner, or the widget is not one of yours (PRESET_WIDGET_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The widget is already a preset under another key (PRESET_WIDGET_ALREADY_USED), or the account has 100 presets (PRESET_LIMIT_REACHED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "removePartnerPreset", "summary": "Take a widget off the partner's presets", "description": "Removes the preset under `key`. The widget itself is not touched, and neither are the copies and the\ncompositions already made from it.\n\nRemoving a preset the partner does not have is not an error: the answer is `removed: false`.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose preset to remove" }, { "in": "path", "name": "key", "required": true, "schema": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" }, "description": "The key of the preset to remove" } ], "responses": { "200": { "description": "Whether a preset was removed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerPresetRemovalResponse" } } } }, "400": { "description": "The key is malformed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/design-defaults": { "get": { "operationId": "getPartnerDesignDefaults", "summary": "Read partner-wide design defaults", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The stored default, or null when unset", "content": { "application/json": { "schema": { "title": "DesignDefaultsResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/DesignDefaults" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Partner not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "setPartnerDesignDefaults", "summary": "Set or clear partner-wide design defaults", "description": "Send `{ \"design\": { ... } }` or `{ \"design\": null }` to remove. New compositions merge this layer over the\nwidget base and under each managed user's default and the request body.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "design" ], "properties": { "design": { "type": "object", "nullable": true } } }, "example": { "design": { "theme": { "radius": 12 } } } } } }, "responses": { "200": { "description": "Defaults saved", "content": { "application/json": { "schema": { "title": "DesignDefaultsResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/DesignDefaults" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "Invalid design document (`VALIDATION_ERROR`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Partner not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/storage/usage": { "get": { "operationId": "getPartnerStorageUsage", "summary": "What a partner's customers store", "description": "Says how many files, and how many bytes, your account keeps, in total and for each of your managed users, and\nhow much of it is in Widgetic's storage and how much in your own storage destination\n(`setPartnerStorageDestination`). Use it to see which customers store the most, or to charge them for it.\n\nA file is counted for a managed user when it was filed under that user: by naming `managed_user_id` or\n`managed_user_external_id` when you upload it (`uploadFile`, or the metadata of a resumable upload), or\nbecause it was uploaded through that user's editor session, which files everything under its user. The files\nthat are not filed under anyone (your own, and the ones uploaded without naming a managed user) are the row\nwhose `managedUserId` is null. Deleted files are not counted. To list the files of one managed user, use the\n`managed_user_id` filter of `listUploads`.\n\nThe answer is counted when you ask, so it is always current. The groups are ordered by size, the heaviest\nfirst, and `page.hasMore` says whether more follow.\n\nThe caller must be the person who administers the partner (an API key of that account works, with the\n`partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose storage to report on" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "How many managed users to list at most" }, { "in": "query", "name": "offset", "schema": { "type": "integer", "minimum": 0, "maximum": 100000, "default": 0 }, "description": "How many managed users to skip" } ], "responses": { "200": { "description": "What the partner's customers store", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerStorageUsageResponse" } } } }, "400": { "description": "A query value is not valid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many report requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// What each customer stores, the heaviest first:\nconst { data: usage } = await partnersApi.getPartnerStorageUsage({ partnerId });\n\nconsole.log(usage.totals.totalBytes);\nfor (const customer of usage.managedUsers) {\n console.log(customer.externalId, customer.totalBytes);\n}\n" } ] } }, "/partners/{partnerId}/analytics/summary": { "get": { "operationId": "getPartnerAnalyticsSummary", "summary": "What was done with a partner's published widgets", "description": "Counts what the visitors of the compositions made through your account did in a period: how many times a\ncomposition was **viewed**, how many times a visitor **interacted** with one, and how many different visitors\nthere were. It covers every composition of your account, your own and the ones made for your managed users;\nnarrow it to one managed user with `managedUserId` or `managedUserExternalId` (not both).\n\nThe numbers come from the events the embedded widgets send while they are shown (the Widgetic embed SDK sends\nthem by itself), counted when you ask. Only views and interactions are counted; the events that describe a\nvisit (its start, its end, the device and the referrer) are not.\n\nThe period runs from `startDate` (included) to `endDate` (not included): the 30 days before now when you give\nneither, and at most 366 days. A date without a time is midnight UTC at the start of that day, so for all of\nOctober give `startDate=2026-10-01` and `endDate=2026-11-01`.\n\nThe caller must be the person who administers the partner (an API key of that account works, with the\n`partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose widgets to report on" }, { "in": "query", "name": "startDate", "schema": { "type": "string" }, "description": "Start of the period, included. An ISO 8601 date (`2026-10-01`) or date-time with its offset (`2026-10-01T08:00:00Z`). Default 30 days before `endDate`.\n" }, { "in": "query", "name": "endDate", "schema": { "type": "string" }, "description": "End of the period, not included, in the same forms. Default now. It must be after `startDate`, by at most 366 days.\n" }, { "in": "query", "name": "managedUserId", "schema": { "type": "string", "format": "uuid" }, "description": "Report only on this managed user (Widgetic's id for the user). Send this or `managedUserExternalId`, not both." }, { "in": "query", "name": "managedUserExternalId", "schema": { "type": "string", "maxLength": 255 }, "description": "Report only on the managed user you registered with this `externalId` (your own identifier for the user). Send this or `managedUserId`, not both." } ], "responses": { "200": { "description": "What was done with the widgets in the period", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerAnalyticsSummaryResponse" } } } }, "400": { "description": "A date is not a date, `startDate` is not before `endDate`, the period is longer than 366 days, or the managed user is named wrongly", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only), or no managed user of yours matches (MANAGED_USER_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many report requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// How the widgets of one customer did in October:\nconst { data: summary } = await partnersApi.getPartnerAnalyticsSummary({\n partnerId,\n startDate: '2026-10-01',\n endDate: '2026-11-01',\n managedUserExternalId: 'customer-4711'\n});\n\nconsole.log(summary.views, summary.interactions, summary.visitors);\n" } ] } }, "/partners/{partnerId}/analytics/managed-users": { "get": { "operationId": "getPartnerAnalyticsByManagedUser", "summary": "What each managed user's widgets did", "description": "Lists every one of your managed users with what their widgets and compositions did in a period: views,\ninteractions and visitors, and how many widgets and compositions they have made. A managed user whose widgets\nwere not viewed is listed too, with zeros. The most viewed come first, and `page.hasMore` says whether more\nfollow.\n\nOnly the compositions made for a managed user count for it: file them under the user when you create them\n(`managedUserId` on `createComposition`), or let the user's editor session do it, which files everything under\nits user. What a visitor did with a composition that is not filed under anyone is in the summary of the whole\naccount (`getPartnerAnalyticsSummary`) and in no managed user's row.\n\nThe period works as it does for `getPartnerAnalyticsSummary`. The caller must be the person who administers the\npartner (an API key of that account works, with the `partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose managed users to report on" }, { "in": "query", "name": "startDate", "schema": { "type": "string" }, "description": "Start of the period, included. An ISO 8601 date (`2026-10-01`) or date-time with its offset. Default 30 days before `endDate`.\n" }, { "in": "query", "name": "endDate", "schema": { "type": "string" }, "description": "End of the period, not included, in the same forms. Default now. At most 366 days after `startDate`." }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "How many managed users to list at most" }, { "in": "query", "name": "offset", "schema": { "type": "integer", "minimum": 0, "maximum": 100000, "default": 0 }, "description": "How many managed users to skip" } ], "responses": { "200": { "description": "What each managed user's widgets did in the period", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerAnalyticsByManagedUserResponse" } } } }, "400": { "description": "A date is not a date, `startDate` is not before `endDate`, or the period is longer than 366 days", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many report requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/analytics/top-widgets": { "get": { "operationId": "getPartnerAnalyticsTopWidgets", "summary": "Which widgets were viewed the most", "description": "Lists the widgets whose compositions were viewed the most in a period, with their views, interactions,\nvisitors and how many of their compositions were viewed. A widget that nobody viewed or used is not listed. The\nmost viewed come first (then the most used), and at most `limit` are listed. Narrow it to one managed user with\n`managedUserId` or `managedUserExternalId` (not both).\n\nThe period works as it does for `getPartnerAnalyticsSummary`. The caller must be the person who administers the\npartner (an API key of that account works, with the `partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose widgets to report on" }, { "in": "query", "name": "startDate", "schema": { "type": "string" }, "description": "Start of the period, included. An ISO 8601 date (`2026-10-01`) or date-time with its offset. Default 30 days before `endDate`.\n" }, { "in": "query", "name": "endDate", "schema": { "type": "string" }, "description": "End of the period, not included, in the same forms. Default now. At most 366 days after `startDate`." }, { "in": "query", "name": "managedUserId", "schema": { "type": "string", "format": "uuid" }, "description": "Report only on this managed user (Widgetic's id for the user). Send this or `managedUserExternalId`, not both." }, { "in": "query", "name": "managedUserExternalId", "schema": { "type": "string", "maxLength": 255 }, "description": "Report only on the managed user you registered with this `externalId`. Send this or `managedUserId`, not both." }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 10 }, "description": "How many widgets to list at most" } ], "responses": { "200": { "description": "The most viewed widgets in the period", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerAnalyticsTopWidgetsResponse" } } } }, "400": { "description": "A date is not a date, `startDate` is not before `endDate`, the period is longer than 366 days, or the managed user is named wrongly", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only), or no managed user of yours matches (MANAGED_USER_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many report requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/analytics/timeline": { "get": { "operationId": "getPartnerAnalyticsTimeline", "summary": "What was done with a partner's widgets, day by day", "description": "Counts views, interactions and visitors for each day of a period (UTC days), oldest first, for a chart. Every\nday of the period is in the list, also one on which nothing happened (all zeros), so the list can be drawn as\nit is. Narrow it to one managed user with `managedUserId` or `managedUserExternalId` (not both).\n\nThe period works as it does for `getPartnerAnalyticsSummary`; `startDate` and `endDate` are best given as dates,\nso that the first and the last day are whole days. The caller must be the person who administers the partner\n(an API key of that account works, with the `partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose widgets to report on" }, { "in": "query", "name": "startDate", "schema": { "type": "string" }, "description": "Start of the period, included. An ISO 8601 date (`2026-10-01`) or date-time with its offset. Default 30 days before `endDate`.\n" }, { "in": "query", "name": "endDate", "schema": { "type": "string" }, "description": "End of the period, not included, in the same forms. Default now. At most 366 days after `startDate`." }, { "in": "query", "name": "managedUserId", "schema": { "type": "string", "format": "uuid" }, "description": "Report only on this managed user (Widgetic's id for the user). Send this or `managedUserExternalId`, not both." }, { "in": "query", "name": "managedUserExternalId", "schema": { "type": "string", "maxLength": 255 }, "description": "Report only on the managed user you registered with this `externalId`. Send this or `managedUserId`, not both." } ], "responses": { "200": { "description": "What was done on each day of the period", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerAnalyticsTimelineResponse" } } } }, "400": { "description": "A date is not a date, `startDate` is not before `endDate`, the period is longer than 366 days, or the managed user is named wrongly", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only), or no managed user of yours matches (MANAGED_USER_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The partner has no administrator account (PARTNER_HAS_NO_ADMINISTRATOR)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many report requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/notifications": { "get": { "operationId": "listPartnerNotifications", "summary": "What your partner account was told", "description": "Lists the notifications of a partner, the newest first: the invoices Widgetic issued and their payments, the\nreminders to pay them, a warning when your credits run low, and the changes to the standing of the account\n(activated, paused, resumed). It is the same list your dashboard shows, and each entry is what your webhook\nreceives as `data` when you have one (`updatePartnerNotificationSettings`).\n\nA page holds `limit` notifications (20 by default, at most 100). When there are older ones `nextBefore` is\nset: ask again with it as `before` to get the next page.\n\nThe caller must be the person who administers the partner (an API key of that account works, with the\n`partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose notifications to list" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "How many notifications to list at most" }, { "in": "query", "name": "before", "schema": { "type": "string", "format": "date-time" }, "description": "Only the notifications made before this moment. Give the `nextBefore` of the previous page." } ], "responses": { "200": { "description": "The notifications, the newest first", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationPageResponse" } } } }, "400": { "description": "`limit` or `before` is not valid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// The latest notifications, then the ones before them:\nconst { data: page } = await partnersApi.listPartnerNotifications({ partnerId, limit: 20 });\nconst older = page.nextBefore\n ? await partnersApi.listPartnerNotifications({ partnerId, before: page.nextBefore })\n : null;\n" } ] } }, "/partners/{partnerId}/notifications/deliveries": { "get": { "operationId": "listPartnerNotificationDeliveries", "summary": "How your notifications reached you", "description": "Lists the sends of your notifications, the newest first: each email to one address and each call to your\nwebhook, with whether it was delivered, when it is tried again if not, how many attempts it had, and why the\nlast one failed. Use it to find out why a webhook of yours did not receive an event.\n\nAn email counts as delivered when it was handed to the mail service; a call to your webhook counts as\ndelivered when your endpoint answered with a 2xx status. Anything else is tried again, after 1 minute, then\n5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours and a day, eight attempts in all, because your address is\nread again at each attempt and you may have mended it. Two answers end the delivery at once: `410 Gone` and\n`413 Payload Too Large`.\n\nThe caller must be the person who administers the partner (an API key of that account works, with the\n`partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose deliveries to list" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 200, "default": 100 }, "description": "How many deliveries to list at most" } ], "responses": { "200": { "description": "The deliveries, the newest first", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationDeliveryLogResponse" } } } }, "400": { "description": "`limit` is not valid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/partners/{partnerId}/notifications/settings": { "get": { "operationId": "getPartnerNotificationSettings", "summary": "Where your notifications go", "description": "Returns who gets the emails, which events you want by email and by webhook, the address of your webhook, and\nwhether it has a secret to sign with. The secret itself is never returned: it is shown once, when it is made.\n`events` lists every kind of event there is, for a settings screen.\n\nThe caller must be the person who administers the partner (an API key of that account works, with the\n`partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose notification settings to read" } ], "responses": { "200": { "description": "The notification settings", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationSettingsResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "updatePartnerNotificationSettings", "summary": "Choose where your notifications go", "description": "Changes who gets the emails, which events you want by email and by webhook, and the address of your webhook.\nA key you leave out of the body is left as it was; send only what changes.\n\n**Email.** `emailRecipients` is the list of addresses (at most five). While it is empty the emails about\ninvoices go to the billing emails of your billing profile (your contact email when there are none), and the\nothers to your contact email. The events about money and about the standing of your account are always\nemailed, whatever `emailEvents` says; it narrows the others.\n\n**Webhook.** `webhookUrl` is where Widgetic sends a signed `POST` for each event, so that your own system\ncan act on it (mark an invoice paid, warn your team that credits are low). The address must be `https` on the\nstandard port, on a public site, and must not redirect. Setting an address when you have no secret yet makes\none, and the answer carries it as `webhookSecret`: **keep it now, it is shown once**. `webhookEvents` narrows\nwhat is sent.\n\nEach call has a JSON body, `{ \"id\": \"evt_...\", \"type\": \"invoice.paid\", \"createdAt\": \"...\", \"partnerId\": \"...\",\n\"data\": { ... } }` (`data` is the `data` of `PartnerNotification`), and these headers:\n`webhook-id` (the same as `id`, and the same on every retry), `webhook-timestamp` (seconds since 1970) and\n`webhook-signature` (`v1,` and a base64 HMAC-SHA256). It is the Standard Webhooks scheme, so any of its\nlibraries verifies it. By hand: take your secret without the `whsec_` prefix, decode it from base64, and sign\nthe text `..` with it; the header holds `v1,` (two signatures separated by a space while a rotated secret overlaps). Reject a `webhook-timestamp`\nthat is more than five minutes old.\n\nAnswer with a 2xx status within ten seconds. Anything else is tried again, eight attempts in all over about\ntwo days (`listPartnerNotificationDeliveries` shows each). Delivery is at least once: if your answer was lost\nthe same event arrives again with the same `id`, so drop what you have already handled by it.\n\nChanging the settings needs an API key with full access: they decide where your notifications go.\nThe caller must be the person who administers the partner, or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose notification settings to change" }, { "$ref": "#/components/parameters/IdempotencyKeyOptional" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdatePartnerNotificationSettingsRequest" } } } }, "responses": { "200": { "description": "The settings were saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationSettingsChangeResponse" } } } }, "400": { "description": "A value is missing, malformed or not allowed (INVALID_NOTIFICATION_SETTINGS). `error.details.problems` names each field and says why. Nothing was saved.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Webhooks cannot be set up on this server right now (WEBHOOK_SIGNING_UNAVAILABLE). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// Send every payment event to your own system:\nconst { data: change } = await partnersApi.updatePartnerNotificationSettings({\n partnerId,\n updatePartnerNotificationSettingsRequest: {\n webhookUrl: 'https://example.com/widgetic/events',\n webhookEvents: ['invoice.issued', 'invoice.paid', 'invoice.failed']\n }\n});\n\n// Shown once: put it in your receiver's configuration now.\nconsole.log(change.webhookSecret);\n" } ] } }, "/partners/{partnerId}/notifications/webhook-secret": { "post": { "operationId": "rotatePartnerWebhookSecret", "summary": "Make a new secret for your webhook", "description": "Makes a new secret to sign your webhook with, and returns it in `webhookSecret`: **keep it now, it is shown\nonce** and cannot be read again. Use it when the secret was lost, or may have leaked.\n\nThe secret you had keeps signing beside the new one for a day, so that your receiver can switch without a\ncall being rejected: during that day each call carries two signatures (see `updatePartnerNotificationSettings`\nfor how they are verified). Rotating again within the day ends the overlap with the first secret.\n\nRetry this call with the same `Idempotency-Key` if its answer was lost: the answer, secret included, is then\ngiven again, and no second secret is made.\n\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose webhook secret to replace" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "responses": { "200": { "description": "The new secret, and the settings", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationSettingsChangeResponse" } } } }, "400": { "description": "The `Idempotency-Key` header is missing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Webhooks cannot be set up on this server right now (WEBHOOK_SIGNING_UNAVAILABLE). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: change } = await partnersApi.rotatePartnerWebhookSecret({ partnerId, idempotencyKey: randomUUID() });\n\n// Shown once: put it in your receiver's configuration now.\nconsole.log(change.webhookSecret);\n" } ] } }, "/partners/{partnerId}/notifications/deliveries/{deliveryId}/replay": { "post": { "operationId": "replayPartnerNotificationDelivery", "summary": "Send a webhook delivery again", "description": "Sends one earlier **webhook** delivery again to your **current** webhook address, with the same event `id`\n(`webhook-id`) as the original notification so a receiver that remembers ids can ignore a duplicate, and a\nnew `createdAt` and signature made with your current secret. The attempt is recorded in the delivery log as a\nnew row that points at the delivery you replayed.\n\nSet a webhook address (and secret) under notification settings before you replay. Changing the settings needs\nan API key with full access. The caller must be the person who administers the partner, or a Widgetic\nadministrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose delivery to replay" }, { "in": "path", "name": "deliveryId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The delivery to send again (must be a webhook delivery of this partner)" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "responses": { "200": { "description": "The replay was attempted; the new delivery row", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationDeliveryResponse" }, "example": { "success": true, "data": { "deliveryId": "a1a1a1a1-1111-4111-8111-111111111111", "notificationId": "b2b2b2b2-2222-4222-8222-222222222222", "eventType": "composition.created", "title": "Composition created", "channel": "webhook", "target": "hooks.example.com", "status": "delivered", "attemptCount": 1, "nextAttemptAt": null, "lastAttemptAt": "2026-10-09T12:00:00.000Z", "deliveredAt": "2026-10-09T12:00:00.000Z", "lastStatusCode": 200, "lastError": null, "createdAt": "2026-10-09T12:00:00.000Z", "replayOfDeliveryId": "c3c3c3c3-3333-4333-8333-333333333333" } } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner or delivery (NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The replay cannot be sent now (BUSINESS_STATE_CONFLICT), for example because no webhook address is set", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many replays in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: delivery } = await partnersApi.replayPartnerNotificationDelivery({\n partnerId,\n deliveryId: 'c3c3c3c3-3333-4333-8333-333333333333',\n idempotencyKey: randomUUID(),\n});\n" } ] } }, "/partners/{partnerId}/notifications/test-event": { "post": { "operationId": "sendPartnerNotificationTestEvent", "summary": "Send a test event to your webhook", "description": "Sends ONE signed call, right now, to the webhook address you saved under notification settings, with a sample\nof what an event of the type you name carries, and answers how it went: whether your receiver answered with a\n2xx status, which status, how long it took, and why not when it did not arrive. Use it to write and try your\nreceiver (above all the signature check) before a real event happens.\n\nThe call is made like every other: it is signed with your current secret (and the previous one while a\nrotation overlaps), it carries the headers `webhook-id`, `webhook-timestamp`, `webhook-signature` and\n`x-widgetic-event` (the event type), and its body is `{ \"id\", \"type\", \"createdAt\", \"partnerId\", \"data\" }`.\nThree things differ. `id` starts with `evt_test_` and is new every time, so a receiver that remembers ids can\ntell a test from an event and drop it. `data` holds made-up values of the shape a real event of that type\ncarries (`PartnerNotification` describes each), never anything about your account. And the call is made once:\nit is not tried again, nothing is stored, and it appears neither in the delivery log nor in the notification\nlist.\n\nIt is sent whatever `webhookEvents` says: a test is not filtered by what you subscribed to. The answer is 200\nwhether or not your receiver took the call (read `delivered`); a call that gets no answer within ten seconds\nis given up and reported as a `timeout`.\n\nA webhook address and a signing secret must be saved first (`updatePartnerNotificationSettings`); until then\nthe answer is 409. This needs an API key with full access, and `Idempotency-Key` is required: a retry with the\nsame key gets the first answer back and no second call is made. The caller must be the person who\nadministers the partner, or a Widgetic administrator. Five tests a minute.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose webhook to try" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationTestEventRequest" }, "example": { "eventType": "invoice.paid" } } } }, "responses": { "200": { "description": "The test call was made. `delivered` says whether your receiver took it.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerNotificationTestEventResultResponse" }, "example": { "success": true, "data": { "delivered": true, "statusCode": 200, "durationMs": 182 } } } } }, "400": { "description": "`eventType` is missing or is not one of the events, or the `Idempotency-Key` header is missing. Nothing was sent.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The test cannot be sent now (BUSINESS_STATE_CONFLICT): no webhook address or no signing secret is saved yet. Nothing was sent.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many tests in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: result } = await partnersApi.sendPartnerNotificationTestEvent({\n partnerId,\n idempotencyKey: randomUUID(),\n partnerNotificationTestEventRequest: { eventType: 'invoice.paid' },\n});\n\n// delivered: true when your receiver answered with a 2xx status\nconsole.log(result.delivered, result.statusCode, result.durationMs, result.error);\n" } ] } }, "/partners/{partnerId}/entry-context-signing": { "get": { "operationId": "getPartnerEntryContextSigning", "summary": "See how the context of your embeds is signed", "description": "Says whether you have a secret to sign the `context` of your embeds with, when it was made, whether the secret\nit replaced is still accepted, and whether an entry without a valid signature is refused (`required`). The\nsecret itself is never part of the answer: it is shown once, when it is made\n(`rotatePartnerEntryContextSecret`, which also explains what signing is for and how to sign).\n\nSigning covers the entries written through the gateway into the compositions of your managed users and into\nthose of your own account. The caller must be the person who administers the partner (an API key of that\naccount works, with the `partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose context signing to read" } ], "responses": { "200": { "description": "How the context of your embeds is signed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerEntryContextSigningResponse" }, "example": { "success": true, "data": { "partnerId": "3f2b8f0e-5b52-4c11-9a52-0f1f4a2d9c11", "required": false, "secretSet": true, "secretRotatedAt": "2026-10-11T08:00:00.000Z", "previousSecretValidUntil": null, "signingAvailable": true } } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Signed context is not available on this server right now (ENTRY_CONTEXT_SIGNING_UNAVAILABLE)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: signing } = await partnersApi.getPartnerEntryContextSigning({ partnerId });\nconsole.log(signing.secretSet, signing.required);\n" } ] }, "put": { "operationId": "updatePartnerEntryContextSigning", "summary": "Require a signed context, or stop requiring it", "description": "Chooses what the gateway does with an entry whose `context` carries no valid signature.\n\nWith `required: false` (the default) an entry that carries a signature is checked and refused when the\nsignature is wrong or out of date, and an entry that carries none is accepted, as it always was. With\n`required: true` an entry without a valid signature is refused with 403 `CONTEXT_SIGNATURE_REQUIRED`: use it\nonce every page of yours that embeds a composition signs its context.\n\nSignatures cannot be required before you have made a secret (`rotatePartnerEntryContextSecret`): the answer\nis 409, so that you cannot lock your own compositions out of taking entries. The change reaches every part of\nthe gateway within a minute.\n\nSaving the same choice twice leaves the same state, so a retry is harmless and `Idempotency-Key` is optional.\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose context signing to change" }, { "$ref": "#/components/parameters/IdempotencyKeyOptional" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdatePartnerEntryContextSigningRequest" }, "example": { "required": true } } } }, "responses": { "200": { "description": "How the context of your embeds is signed now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerEntryContextSigningResponse" } } } }, "400": { "description": "`required` is missing or is not true or false", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Signatures cannot be required yet, because no secret exists (BUSINESS_STATE_CONFLICT). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Signed context is not available on this server right now (ENTRY_CONTEXT_SIGNING_UNAVAILABLE). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// Once every page that embeds a composition signs its context:\nconst signing = await partnersApi.updatePartnerEntryContextSigning({\n partnerId,\n updatePartnerEntryContextSigningRequest: { required: true },\n});\n" } ] } }, "/partners/{partnerId}/entry-context-signing/secret": { "post": { "operationId": "rotatePartnerEntryContextSecret", "summary": "Make a secret to sign the context of your embeds", "description": "Makes a secret to sign the `context` of your embeds with, and returns it in `secret`: **keep it now, it is\nshown once** and cannot be read again. Keep it on your server only: whoever holds it can write contexts your\ncompositions accept. Call this again to make a new secret; the one it replaces is still accepted for a day, so\nthat your server can switch without an entry being refused (making another within that day ends the overlap\nwith the first).\n\n**What signing is for.** `` hands attribution to\na widget, which sends it with every entry it saves. The page is yours but the browser is the visitor's:\nanybody can change that attribute and file an entry under another customer's id. When your server signs the\ncontext, the gateway refuses an entry whose context was changed, and the entries you keep hold attribution\nyour server wrote.\n\n**How to sign** (on your server, for each page you render):\n\n1. Take the context to give the widget. It may hold text and whole numbers only (within ±2^53, written without\n a fraction or an exponent).\n2. Choose when the signature stops being good: `widgetic_exp`, in seconds since 1970 (UTC), no more than\n seven days from now. A minute of difference between clocks is forgiven.\n3. Write the text to sign, with no spaces except those inside values:\n `widgetic-context.v1...`. `` is the id of the composition\n in lower case. `` is the context as JSON with the keys in character-code order (so `Z` comes before\n `a`, and `10` before `9`), no spaces, strings escaped as JSON escapes them, and the two keys of the\n signature left out.\n4. Sign that text: HMAC-SHA256 with the 32 bytes the secret stands for (the base64 text after `ctxsec_`), and\n write the result as base64url without padding.\n5. Give the widget the context with two keys added: `widgetic_exp` and `widgetic_sig` (the signature). The whole\n attribute, the two keys included, stays within the limits of any context: at most 20 keys, 2048 bytes of\n JSON, strings up to 500 characters. The two keys take two of the 20 keys and 87 bytes of the 2048.\n\nA test vector, to check your code against before you rely on it. Secret\n`ctxsec_AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=` (the bytes 0 to 31), composition\n`7c9e6679-7425-40de-944b-e07fc1f90ae7`, `widgetic_exp` 1792000000 and context\n`{\"customerId\":\"c_42\",\"plan\":\"pro\",\"seats\":3}` sign the text\n`widgetic-context.v1.7c9e6679-7425-40de-944b-e07fc1f90ae7.1792000000.{\"customerId\":\"c_42\",\"plan\":\"pro\",\"seats\":3}`\nand give the signature `j6g7151F54tl9C8oEY9levaYSppHME4fAPZ7WPwL8C8`. (The secret is the example's, not a\nreal one.)\n\n**What the gateway does with an entry.** When you have a secret, an entry whose context carries a signature is\nchecked: a signature that does not match is refused with 403 `CONTEXT_SIGNATURE_INVALID`, and one that is past\n`widgetic_exp` with 403 `CONTEXT_SIGNATURE_EXPIRED`. When you also require signatures\n(`updatePartnerEntryContextSigning`) an entry whose context carries none is refused with 403\n`CONTEXT_SIGNATURE_REQUIRED`. The two keys are taken out before the entry is stored or announced: your entries\nand your `entry.created` events hold the context you wrote. A change you make reaches every part of the\ngateway within a minute.\n\n**What it does not do.** A signed context that has been seen (a page's source is public) can be sent again by\nanyone until `widgetic_exp`; when you must not accept the same context twice, put a value that is new for each\npage view in it (a `submissionId` you made up) and keep the ones you have seen. The signature covers the\nentries that reach Widgetic's gateway: a row that gets into a table another way (your own code writing\nstraight into a database you brought, or the record calls of the composition's owner) does not pass\nthrough it, and carries no context.\n\nRetry this call with the same `Idempotency-Key` if its answer was lost: the answer, secret included, is then\ngiven again, and no second secret is made. This needs an API key with full access. The caller must be the\nperson who administers the partner, or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose secret to make" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "responses": { "200": { "description": "The new secret, and how your signing stands now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerEntryContextSecretResponse" } } } }, "400": { "description": "The `Idempotency-Key` header is missing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Signed context is not available on this server right now (ENTRY_CONTEXT_SIGNING_UNAVAILABLE). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: made } = await partnersApi.rotatePartnerEntryContextSecret({ partnerId, idempotencyKey: randomUUID() });\n\n// Shown once: keep it on your server now.\nconsole.log(made.secret);\n" }, { "lang": "TypeScript", "label": "Sign a context (Node.js)", "source": "import { createHmac } from 'node:crypto';\n\n// Returns the context to put in the `context` attribute: yours, plus widgetic_exp and widgetic_sig.\nfunction signContext(\n secret: string, // the ctxsec_ text you were shown\n compositionId: string,\n context: Record, // text and whole numbers only\n lifetimeSeconds = 3600,\n) {\n const key = Buffer.from(secret.slice('ctxsec_'.length), 'base64');\n const widgeticExp = Math.floor(Date.now() / 1000) + lifetimeSeconds;\n const json =\n '{' +\n Object.keys(context)\n .sort()\n .map((name) => `${JSON.stringify(name)}:${JSON.stringify(context[name])}`)\n .join(',') +\n '}';\n const text = `widgetic-context.v1.${compositionId.toLowerCase()}.${widgeticExp}.${json}`;\n const widgeticSig = createHmac('sha256', key).update(text).digest('base64url');\n return { ...context, widgetic_exp: widgeticExp, widgetic_sig: widgeticSig };\n}\n\n// \n" } ] } }, "/partners/{partnerId}/data-database": { "put": { "operationId": "setPartnerDataDatabase", "summary": "Keep the data of a partner's compositions in a Neon database of its own", "description": "Points the partner at a Neon database of its own. From then on, what visitors leave in the compositions of\nthe partner's managed users, and of the compositions made in the partner's own account (the votes, ratings,\nanswers and form submissions of the widgets that collect them), is stored in that database and nowhere else.\nWidgetic's own database is not used for them any more, and nothing of it is copied there.\n\n**What to give.** The connection string of a Neon database and a role made for this, as Neon shows it under\n*Connect* (`postgresql://:@ep-..aws.neon.tech/`). Only Neon databases\nare accepted; a string for any other host is refused with 400. What the database needs:\n- an empty database of its own, so that nothing else of yours shares it. Widgetic makes one schema in it for\n each composition (named `comp_` followed by the composition's id). In that schema go the tables the widget\n declares for what its visitors leave, and two small tables of Widgetic's own, whose names start with\n `_widgetic_`: the context a host page sent with an entry, and how far Widgetic has read the entries to tell\n you about new ones. It touches nothing else;\n- a role that may create schemas and tables in it (the CREATE privilege on the database). The role Neon makes\n with a project has it. A role made in the Neon console can also read and write every other database of the\n same project, so if you keep other data in Neon give Widgetic a project of its own, or make the role with\n SQL (`CREATE ROLE ... LOGIN PASSWORD ...`) and grant it only the CREATE privilege on this database;\n- connections from anywhere: Widgetic's addresses are not fixed, so a Neon project that only accepts\n connections from an allow list of addresses cannot be used. A suspended compute is fine: it wakes on the\n first request.\n\n**It is checked before it is saved.** Widgetic makes a schema in your database, creates a table in it, writes\na row, reads it back, and removes the schema again, all in one step, so that nothing is left if anything\nfails. If it cannot be done nothing is saved and the answer is 422 `PARTNER_DATABASE_UNVERIFIED`:\n`details.reason` says why (`INVALID_CREDENTIALS`, `DATABASE_NOT_FOUND`, `ACCESS_DENIED`, `ACCESS_BLOCKED`,\n`ENDPOINT_NOT_FOUND`, `ENDPOINT_UNREACHABLE`, `TIMEOUT`, `READ_ONLY`, `RATE_LIMITED`, `DATABASE_UNAVAILABLE`,\n`PROBE_MISMATCH` or `DATABASE_ERROR`) and `message` says what to do.\n\n**Existing data does not move.** The data of a composition lives in one database. If any composition of the\npartner already keeps data somewhere else (in Widgetic's database, or in the database you had set), and the\nnew database does not hold it, the change is refused with 409 `PARTNER_DATABASE_HOLDS_DATA` and nothing is\nchanged: those compositions would read as empty from then on. `details.compositionsWithData` says how many.\nSet your database before your customers collect data, or delete the compositions you no longer need. Saving\nthe same database again (a new password) moves nothing and is never refused.\n\n**It is never a fallback.** Once a database is set, a request that needs it while it cannot be used (the\npassword was changed, the project was deleted) is refused with 503 `PARTNER_DATABASE_UNAVAILABLE`. What the\nvisitor sent is not stored with Widgetic instead. Fix the connection and set the database again, or check it\nwith `verifyPartnerDataDatabase`.\n\n**When it takes effect.** A change reaches every part of Widgetic within about a minute.\n\n**What Widgetic keeps.** The connection string is stored encrypted and is never returned or logged; a response\nshows the host, the database and the role, never the password. Widgetic's servers open it to read and write the\ndata of your compositions while they handle a request for it. To cut that off, change the role's password in\nNeon: the compositions stop saving until you set the new string.\n\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator. A retry is harmless: saving the same database twice only refreshes when it was\nchecked and saved.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose database to set" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetPartnerDataDatabaseRequest" } } } }, "responses": { "200": { "description": "The database passed the check and was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerDataDatabaseResponse" } } } }, "400": { "description": "The connection string is missing, malformed, or not a Neon one. The error's param names it.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such partner (reported to administrators only)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Compositions of the partner already keep data elsewhere (PARTNER_DATABASE_HOLDS_DATA), or the partner has no administrator account (BUSINESS_STATE_CONFLICT). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The database did not pass the check (PARTNER_DATABASE_UNVERIFIED). Nothing was saved.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "A partner's own database is not available on this server (PARTNER_DATABASE_UNAVAILABLE), or Widgetic could not check what the current database holds. Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: database } = await partnersApi.setPartnerDataDatabase({\n partnerId,\n setPartnerDataDatabaseRequest: {\n connectionString: 'postgresql://widgetic_data:YOUR_PASSWORD@ep-cool-name-123456.eu-central-1.aws.neon.tech/neondb',\n },\n});\nconsole.log(database.host, database.databaseName, database.verifiedAt);\n" } ] }, "get": { "operationId": "getPartnerDataDatabase", "summary": "See the Neon database a partner keeps the data of its compositions in", "description": "Returns the database set with `setPartnerDataDatabase`, without its password: the host, the database and the\nrole, when it last passed the check, and why the latest re-check failed if it did. Responds 404 while the\npartner has no database of its own, which means the data of its compositions is kept by Widgetic.\n\nThe caller must be the person who administers the partner (an API key of that account works, with the\n`partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose database to read" } ], "responses": { "200": { "description": "The partner's database", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerDataDatabaseResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The partner has no database of its own", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: database } = await partnersApi.getPartnerDataDatabase({ partnerId });\nconsole.log(database.host, database.lastVerificationError);\n" } ] }, "delete": { "operationId": "removePartnerDataDatabase", "summary": "Stop keeping the data of a partner's compositions in its own database", "description": "Removes the partner's database from Widgetic: Widgetic forgets the connection string, and from then on the data\nof the partner's compositions is kept in Widgetic's database again. Nothing in your database is deleted.\n\nRemoving is refused with 409 `PARTNER_DATABASE_HOLDS_DATA` while any composition of the partner keeps its data in\nyour database: it would read as empty from then on, and what it holds would stay where nothing reads it. Delete\nthe compositions you no longer need, or keep the database. If Widgetic cannot check what your database holds\n(it cannot be reached) the answer is 503 `PARTNER_DATABASE_UNAVAILABLE`; check it with\n`verifyPartnerDataDatabase`, or set the same database again to repair its connection.\n\nRemoving a database the partner does not have is not an error: the answer is `removed: false`.\n\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose database to remove" } ], "responses": { "200": { "description": "Whether a database was removed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerDataDatabaseRemovalResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Compositions of the partner keep their data in this database (PARTNER_DATABASE_HOLDS_DATA). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Widgetic could not check what the database holds (PARTNER_DATABASE_UNAVAILABLE). Nothing was changed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: { removed } } = await partnersApi.removePartnerDataDatabase({ partnerId });\n" } ] } }, "/partners/{partnerId}/data-database/verify": { "post": { "operationId": "verifyPartnerDataDatabase", "summary": "Check that a partner's own database still works", "description": "Runs the same check as `setPartnerDataDatabase` against the database already saved: a schema is made in it, a\ntable created, a row written and read back, and the schema removed again. Use it after changing the role's\npassword or the project's settings in Neon, or when saving is failing with 503 `PARTNER_DATABASE_UNAVAILABLE`.\n\nThe result is recorded either way. A pass refreshes `verifiedAt` and clears `lastVerificationError`; a failure\nanswers 422 `PARTNER_DATABASE_UNVERIFIED` and is recorded in `lastVerificationError` and\n`lastVerificationFailedAt`, so the database shows what went wrong the next time it is read. A failed check does\nnot remove the database. `details.reason` is one of the reasons `setPartnerDataDatabase` lists, or\n`STORED_STRING_UNREADABLE` when the connection string Widgetic stored can no longer be read: set the database\nagain, with its connection string.\n\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose database to check" } ], "responses": { "200": { "description": "The database passed the check", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerDataDatabaseResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The partner has no database of its own", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The database did not pass the check (PARTNER_DATABASE_UNVERIFIED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many checks in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "A partner's own database is not available on this server (PARTNER_DATABASE_UNAVAILABLE)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: database } = await partnersApi.verifyPartnerDataDatabase({ partnerId });\nconsole.log(database.verifiedAt);\n" } ] } }, "/organizations/{orgId}/domains": { "get": { "operationId": "getOrganizationDomains", "summary": "Get Organization Allowed Domains", "description": "Lists the websites on a workspace's own list, newest first. It is the list Widgetic checks when a widget of the workspace is embedded: when it holds at least one website, the widget is shown on those websites (and on Widgetic's own) and nowhere else; when it is empty, the widget can be shown anywhere. A partner's home workspace also has the websites set on the partner record by Widgetic added to its list, and those are not in this answer. The answer holds the whole list, however long it is: a partner's list has no limit.", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "orgId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Organization ID" } ], "responses": { "200": { "description": "Organization domains retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/OrganizationDomain" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "addOrganizationDomain", "summary": "Add Organization Allowed Domain", "description": "Adds a new domain to the workspace's allowed domains list for widget embedding restrictions. The list of an ordinary workspace holds at most 50 websites (a 409 says so); the home workspace of a partner has no limit, because a partner adds its customers' websites by code.", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "orgId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Organization ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddDomainRequest" } } } }, "responses": { "201": { "description": "Domain added successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddOrganizationDomainResponse" } } } }, "400": { "description": "Invalid domain format", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to manage domains", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Domain already exists, or the list already holds 50 websites (not for a partner's home workspace)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/organizations/{orgId}/domains/{domainId}": { "put": { "operationId": "updateOrganizationDomain", "summary": "Update Organization Allowed Domain", "description": "Updates an existing domain in the organization's allowed domains list", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "orgId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Organization ID" }, { "in": "path", "name": "domainId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Domain ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateDomainRequest" } } } }, "responses": { "200": { "description": "Domain updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateOrganizationDomainResponse" } } } }, "400": { "description": "Invalid domain format", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to manage domains", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization or domain not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Domain already exists", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteOrganizationDomain", "summary": "Delete Organization Allowed Domain", "description": "Removes a domain from the organization's allowed domains list", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "orgId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Organization ID" }, { "in": "path", "name": "domainId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Domain ID" } ], "responses": { "200": { "description": "Domain deleted successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteOrganizationDomainResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to manage domains", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization or domain not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/operations/{id}": { "get": { "operationId": "getOperation", "summary": "Get operation status", "description": "Follows work that carries on after the response that started it. Duplicating a composition,\nfor one, answers 202 with an `operationId`: ask for that operation until its `status` is\n`completed` (or `failed`, with the reason in `error`). A finished duplication names the new\ncomposition in `metadata.newCompositionId`.\n\nAn operation belongs to the user who started it. Asking for somebody else's operation answers\n404, exactly as for one that does not exist. Administrators may read any operation.\n", "tags": [ "Operations" ], "x-access-level": "user", "x-visibility": "public", "security": [ { "bearerAuth": [] } ], "parameters": [ { "in": "path", "name": "id", "schema": { "type": "string", "format": "uuid" }, "required": true, "description": "Operation identifier returned when the job was created." } ], "responses": { "200": { "description": "Operation payload.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOperationResponse" } } } }, "401": { "description": "Authentication required.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Operation not found, or started by someone else.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users": { "get": { "operationId": "getAllManagedUsers", "summary": "Get Managed Users", "description": "Retrieve the managed users you manage (your end users), with pagination support. (Admins see every partner's managed users.)\n\nSearch them by your own id, name or email (`search`), order them by their last activity (`sort=lastActivityAt:desc`), ask\nfor what each has made (`include=counts`), and page through thousands of them by cursor: the `nextCursor` of one page is\nthe `cursor` of the next, and unlike a page number it does not shift when the order changes between two requests.\n\nTo find the managed user you registered with your own identifier, send it as `externalId`: the list then holds\nthat one user, or is empty when you have none with this id.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number for pagination" }, { "in": "query", "name": "size", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 10 }, "description": "Number of items per page" }, { "in": "query", "name": "sort", "schema": { "type": "string", "default": "createdAt:desc" }, "description": "Sort field and direction, `:`. The field is `createdAt`, `updatedAt`, `externalId` or `lastActivityAt` (the snake_case spellings `created_at`, `updated_at`, `external_id` and `last_activity_at` work too); `asc` or `desc` alone sorts by `createdAt`. Any other field is a 400." }, { "in": "query", "name": "externalId", "schema": { "type": "string", "minLength": 1, "maxLength": 255 }, "description": "Only the managed user registered with this `externalId`, your own identifier for the user. The match is exact: the same letters in the same case. The list holds that user, or is empty (`meta.total` is 0) when none of yours has this id. Send it once, and not empty: a repeated or an empty value is a 400, never a list of everyone." }, { "in": "query", "name": "search", "schema": { "type": "string", "maxLength": 255 }, "description": "Text the managed user's `externalId`, name or email contains, in upper or lower case. Cut to 100 characters. Empty: no search." }, { "in": "query", "name": "cursor", "schema": { "type": "string" }, "description": "Where the page before ended: the `nextCursor` that page answered. A request with a cursor returns the page that follows it and ignores `page`. The cursor is made for one `sort` and one `search`; use it with the same ones (a cursor made for another sort is a 400)." }, { "in": "query", "name": "include", "schema": { "type": "string", "enum": [ "counts" ] }, "description": "`counts` adds what each managed user has made (`counts`: widgets, compositions, workflows) to every row of the page." } ], "responses": { "200": { "description": "Successful retrieval of managed users", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ManagedUser" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A query value is not one this list accepts (a sort it cannot do, a cursor it did not make or one made for another sort)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Partner access required. A partner sees only the managed users they manage.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, ManagedUsersApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst managedUsersApi = new ManagedUsersApi(config);\n\ntry {\n const response = await managedUsersApi.getAllManagedUsers({\n page: 1,\n size: 10\n });\n \n console.log('Managed users:', response.data);\n console.log('Total:', response.meta?.total);\n console.log('Current page:', response.meta?.page);\n} catch (error) {\n if (error.response?.status === 401) {\n console.error('Authentication required');\n } else {\n console.error('Failed to fetch managed users:', error);\n }\n}\n" } ] }, "post": { "operationId": "createManagedUser", "summary": "Create Managed User", "description": "Creates a new managed user for a partner account.\n\nThe `Idempotency-Key` header is required (`400` without it). Send the same key when you retry, so one\nmanaged user is created, not two.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewManagedUser" }, "example": { "externalId": "external-user-123", "metadata": { "firstName": "John", "lastName": "Doe", "role": "editor" } } } } }, "responses": { "201": { "description": "Managed user created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserResponse" } } } }, "400": { "description": "Invalid input", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner, or `managerId` names another manager (a partner can create managed users only for themselves)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "A managed user with this `externalId` already exists for this manager. External ids are unique per manager, so this never refers to another partner's record.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, ManagedUsersApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst managedUsersApi = new ManagedUsersApi(config);\n\ntry {\n const managedUser = await managedUsersApi.createManagedUser({\n // The call needs an idempotency key: reuse the same key if you retry this call.\n idempotencyKey: randomUUID(),\n newManagedUser: {\n externalId: \"external-user-123\",\n managerId: \"123e4567-e89b-12d3-a456-426614174001\",\n metadata: {\n firstName: \"John\",\n lastName: \"Doe\",\n role: \"editor\"\n }\n }\n });\n \n console.log('Created managed user:', managedUser);\n} catch (error) {\n console.error('Failed to create managed user:', error);\n}\n" } ], "parameters": [ { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ] } }, "/users/{managerId}/managed-users": { "get": { "operationId": "getManagedUsersByManagerId", "summary": "Get Managed Users By Manager", "description": "Retrieve managed users for a specific manager with pagination support. Send `externalId` to find the one registered\nwith your own identifier for the user.", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "managerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the manager" }, { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number for pagination" }, { "in": "query", "name": "size", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 10 }, "description": "Number of items per page" }, { "in": "query", "name": "sort", "schema": { "type": "string", "default": "createdAt:desc" }, "description": "Sort field and direction, `:`. The field is `createdAt`, `updatedAt` or `externalId` (the snake_case spellings `created_at`, `updated_at` and `external_id` work too); `asc` or `desc` alone sorts by `createdAt`. Any other field is a 400." }, { "in": "query", "name": "externalId", "schema": { "type": "string", "minLength": 1, "maxLength": 255 }, "description": "Only the managed user registered with this `externalId`, your own identifier for the user. The match is exact: the same letters in the same case. The list holds that user, or is empty (`total` is 0) when none of yours has this id. Send it once, and not empty: a repeated or an empty value is a 400, never a list of everyone." } ], "responses": { "200": { "description": "Successful retrieval of managed users", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetManagedUsersByManagerIdResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - you can list only your own managed users (an admin or an internal service can list any manager's). The answer does not depend on whether the manager exists.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users/{id}": { "get": { "operationId": "getManagedUserById", "summary": "Get Managed User By ID", "description": "Retrieves a specific managed user by ID.", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the managed user to retrieve" } ], "responses": { "200": { "description": "Managed user retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner. A record managed by another account is never a 403.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found. A record managed by another account answers 404 as well, so you cannot learn whether another partner's record exists.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "updateManagedUser", "summary": "Update Managed User", "description": "Updates an existing managed user. Only `externalId`, `metadata` and `isActive` can change, and `metadata`\nis replaced as a whole, so send all of it. `isActive: false` switches the managed user off: what it\nalready has stays, and nothing new can be filed under it until you send `isActive: true`. Switching it\noff also ends all of its editor sessions, and they do not come back when you switch it on again.\n\nThe `Idempotency-Key` header is required (`400` without it).\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the managed user to update" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateManagedUser" } } } }, "responses": { "200": { "description": "Managed user updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserResponse" } } } }, "400": { "description": "Invalid input", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner. A record managed by another account is never a 403.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found. A record managed by another account answers 404 as well, so you cannot learn whether another partner's record exists.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Another managed user of yours already has this `externalId`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteManagedUser", "summary": "Delete Managed User", "description": "Deletes a managed user by ID. Its editor sessions end with it. What was filed under it (compositions, widgets, uploads) stays in your account, untagged.", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the managed user to delete" } ], "responses": { "200": { "description": "Managed user deleted successfully", "content": { "application/json": { "schema": { "title": "ManagedUserRemovalResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/ManagedUserRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner. A record managed by another account is never a 403.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found. A record managed by another account answers 404 as well, so you cannot learn whether another partner's record exists.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users/{id}/editor-sessions": { "post": { "operationId": "createManagedUserEditorSession", "summary": "Create an editor session for a managed user", "description": "Makes a short-lived credential that lets the browser of ONE of your managed users use Widgetic's editor\npieces, such as the File Browser and the Composition Editor, without your API key ever reaching that\nbrowser. Call this from your server when the page that hosts the editor opens, and hand the `token` in\nthe answer to that page.\n\nThe token is shown once. It starts with `wgt_ses_` and the browser sends it as\n`Authorization: Bearer `. It can do only what the `surfaces` you name allow, and only for this\nmanaged user:\n\n- `files`: upload a file (`uploadFile`) and list the files uploaded for this user (`listUploads`). Every\n file is filed for this user and stored in your own storage destination, never in Widgetic's: a file a\n customer uploads is yours to keep, and takes none of your storage allowance. Partner storage is not\n optional, so no session, whatever its surfaces, can be made until you have set a destination\n (`setPartnerStorageDestination`); until then it is refused with 409 and `PARTNER_STORAGE_REQUIRED`, and\n when the destination cannot be used with 503 and `STORAGE_DESTINATION_UNAVAILABLE`. A destination you\n remove after the session was made stops its uploads too (the same 409; the browser is only told that\n the feature is not available right now). To keep a customer from uploading, leave `files` out of the\n session and hand the editors your own media library instead (`mediaLibrary`).\n- `editor`: edit one of this user's compositions: read it (`getCompositionById`, its content, design,\n embed settings and schemas), check a content change (`validateCompositionContent`), and change its\n name, content, design and embed settings (`updateComposition`, `setDynamicContent`). For a widget that\n answers visitors' questions from documents (the `ai-answers` adapter), it also lists those documents,\n adds one as text or as a file (a text file or a picture; a PDF once PDFs are read), and removes one\n (`getAiAnswersKnowledge`, `addAiAnswersKnowledgeDocument`, `addAiAnswersKnowledgeFile`,\n `removeAiAnswersKnowledgeDocument`); adding costs no credits, and is limited for each of your users\n separately. It can reach\n only compositions you created for this managed user (tag them with `managedUserId` when you create\n them); any other composition, including another of your users', answers 404.\n- `creator`: use Widgetic's Widget Creator for this user, including its AI. Draw on canvases and save\n them (`getAllCanvases`, `getCanvas`, `createCanvas`, `updateCanvas`, `previewDeleteCanvas`,\n `deleteCanvas`); make, change, copy and delete the widgets on them (`createWidget`, `getWidgets`,\n `getWidgetsBatch`, `updateWidget`, `uploadWidgetThumbnail`, `duplicateWidget`, `deleteWidget`);\n list and make the compositions of a widget it built (`getAllCompositions`, `createComposition`), which\n is how it shows the widget with sample values; keep the\n conversation of each widget (`getConversationsByWidgetId`, `createConversationForWidget`,\n `updateConversation`, `getMessages`, `createMessage`, `updateMessage`, `restoreCheckpoint`); and read a\n widget's schemas and give it its repository (`getWidgetContentSchema`, `getWidgetDesignSchema`,\n `updateWidgetRepository`). The AI that builds a widget is part of it: list the models\n (`listLlmModels`), open the widget's repository (`createRepository`,\n `getRepository`), start a generation and follow or cancel it (`generateCode`,\n `streamOperationUpdates`, `getOperation`, `cancelOperation`), build and preview the result\n (`getWidgetRepositoryHead`, `buildWidgetFromRepo`, `previewWidgetVersion`), publish a\n version of the widget and move between its versions (`publishBuiltWidget`,\n `getWidgetPublishHistory`, `setWidgetPublishHistoryLive`, `renameWidgetPublishHistoryTitle`), and\n turn a stroke or a sentence into a decision (`recognizeShape`, `resolveDesignProperty`). It can\n also offer the customer your presets as starting points: read them and ask for a copy for this customer\n (`listMyPresets`, `copyMyPreset`; you choose the presets with `setPartnerPreset`).\n What the session makes is filed for this managed user, and the lists it reads hold only this user's\n canvases, widgets and compositions. It can reach only canvases, widgets, compositions, repositories,\n uploaded files and operations made for this managed user (tag the canvases and widgets you create\n with `managedUserId`); any other canvas, widget, composition, conversation, message, repository, file\n or operation, including another of your users', answers 404. The creator also saves the composition\n it is editing (`updateComposition`, from the `editor` surface) and attaches pictures to its chat\n (`uploadFile`, from the `files` surface), and the surfaces do not imply one another: to open the\n whole creator for a user, ask for `creator`, `editor` and `files` together. A generation or a build\n one user starts can be followed and cancelled by that user and by you, never by another of your\n users. The AI is paid for by your account, as your own calls are: its credits and allowances are\n yours. A session cannot make a widget public (publishing a version does not), file one under a\n project or an organization, or set anything the creator does not set: a body with another field is\n refused with 403 and `EDITOR_SESSION_FIELD_NOT_ALLOWED`.\n- `workflows`: use Widgetic's Workflows editor for this user. List their workflows and the compositions\n a workflow of theirs can chain (`listWorkspaceWorkflows`, `listWorkspaceWorkflowCompositionOptions`);\n list the starting points you offer them and make a workflow from one, which gives the user their own copy\n of every widget it chains, a composition of their own on each copy, and a draft\n (`listWorkspaceWorkflowPresets`, `createWorkspaceWorkflowFromPreset`; you offer them with\n `setPartnerWorkflowPreset`);\n make, open, change and delete one (`createWorkspaceWorkflow`, `getWorkspaceWorkflow`,\n `saveWorkspaceWorkflow`, `deleteWorkspaceWorkflow`) and copy it (`duplicateWorkspaceWorkflow`); publish\n it or discard the changes of its draft (`publishWorkspaceWorkflow`,\n `discardWorkspaceWorkflowChanges`); read and restore its versions (`listWorkspaceWorkflowVersions`,\n `getWorkspaceWorkflowVersion`, `restoreWorkspaceWorkflowVersion`); pause, resume, archive and unarchive it\n (`pauseWorkspaceWorkflow`, `resumeWorkspaceWorkflow`, `archiveWorkspaceWorkflow`,\n `unarchiveWorkspaceWorkflow`); and read its counts (`getWorkspaceWorkflowStats`). The editor's assistant\n chat, beside the canvas, is part of this surface too: the page sends the messages itself (they are not an\n operation you call), and it works for this managed user alone. It reads, tries and changes the draft of the\n workflow that is open, from the compositions you made for this managed user, and it does not build widgets,\n copy templates, make plans, read Open MCPs or suggest what to type next. Its messages use none of your\n credits (30 a minute for each of your users), and a message that names a workflow, a composition or a file\n that is not this managed user's answers 404. The workspace in each\n path is your partner workspace, the `workspaceId` the session answers with: a session has no other, and a\n path that names any other workspace (a team you belong to included) answers 404. What the\n session makes is filed for this managed user (`managedUserId`), the lists hold only this user's workflows,\n and it can reach only workflows made for this managed user; any other workflow, including one of yours\n or of another of your users, answers 404. A workflow can chain only the compositions you made for this\n managed user (tag them with `managedUserId`): one that belongs to anybody else is not available, and\n publishing a workflow that uses it is refused. What a customer's session reads never says who published a\n version. A session cannot set who a workflow belongs\n to or which workspace it is in: a body with another field is refused with 403 and\n `EDITOR_SESSION_FIELD_NOT_ALLOWED`.\n\nEverything else is refused with 403 and `EDITOR_SESSION_ROUTE_NOT_ALLOWED`: a session cannot read your\naccount, make more sessions, change your presets or delete a composition, and a session without the `creator` surface cannot\ncreate or list compositions. Create the composition yourself with your API key, then open the editor on it.\n\nA session ends at `expiresAt` (at most four hours), when you end it (`revokeManagedUserEditorSession`),\nor when the managed user is switched off or deleted. A managed user can have at most 100 live sessions at\nonce (`429 EDITOR_SESSION_LIMIT_REACHED`). A session that is bound to a web page (`allowedOrigin`) is\nrefused from any other origin.\n\nThe AI the session runs is paid for with your credits. Set `maxCredits` to hold the session to a number\nof them: once its generations have taken that many (a generation that fails is refunded and does not\ncount), the next one is refused with 402 and `EDITOR_SESSION_CREDIT_LIMIT_REACHED`, and the browser is told\nonly that the feature is not available right now. Without it, the limit Widgetic has set for your account\napplies when it has set one (the same limit for every session you make, and `maxCredits: null` asks for\nnone), and otherwise the credits of your account are the only ceiling. What each of your users' sessions\nhas spent is in `getManagedUserUsage`.\n\nEach call makes a new session. It does not take an `Idempotency-Key`: the answer holds the token, and\nthe token is never stored where a retry could read it back. The answer is sent with\n`Cache-Control: no-store`.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The managed user the session is for (Widgetic's id for the user)" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewEditorSession" } } } }, "responses": { "201": { "description": "The session, with its token (shown once)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/EditorSessionResponse" } } } }, "400": { "description": "A surface is not one that exists, `expiresInSeconds` or `maxCredits` is out of range, or `allowedOrigin` is not an origin", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner, or Widgetic has switched editor sessions off for your account (`EDITOR_SESSIONS_DISABLED_FOR_PARTNER`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No managed user with this id on your account (`MANAGED_USER_NOT_FOUND`). Another partner's managed user answers 404 as well.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off, so no session can be made for it (`MANAGED_USER_INACTIVE`); or you have not set a storage destination (`PARTNER_STORAGE_REQUIRED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "The managed user already has the most live sessions allowed (`EDITOR_SESSION_LIMIT_REACHED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Editor sessions are switched off for the moment (`EDITOR_SESSIONS_DISABLED`), or your storage destination cannot be used (`STORAGE_DESTINATION_UNAVAILABLE`). Try again later.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, ManagedUsersApi } from '@widgetic/api-sdk-ts';\n\nconst managedUsersApi = new ManagedUsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// On your server, when the page that hosts the editor opens for one of your users:\nconst session = await managedUsersApi.createManagedUserEditorSession({\n id: managedUserId,\n newEditorSession: {\n surfaces: ['files', 'editor'],\n expiresInSeconds: 3600,\n allowedOrigin: 'https://app.example.com',\n maxCredits: 20\n }\n});\n\n// Send session.token to that user's browser, and nothing else of yours.\n" } ] }, "delete": { "operationId": "revokeManagedUserEditorSessions", "summary": "End every editor session of a managed user", "description": "Ends all of the managed user's live editor sessions at once, for example when the user signs out of your\nplatform. Their tokens stop working on the next request (on another server of ours, within a few seconds).\nIt is fine to call it for a user who has none.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The managed user whose sessions end" } ], "responses": { "200": { "description": "How many live sessions were ended", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RevokeManagedUserEditorSessionsResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such managed user on your account (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users/{id}/editor-sessions/{sessionId}": { "delete": { "operationId": "revokeManagedUserEditorSession", "summary": "End one editor session of a managed user", "description": "Ends the session at once: its token stops working on the next request (on another server of ours, within\na few seconds). Ending a session that has already ended is fine.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The managed user the session is for" }, { "in": "path", "name": "sessionId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The `sessionId` of the session, from `createManagedUserEditorSession`" } ], "responses": { "200": { "description": "The session has ended", "content": { "application/json": { "schema": { "title": "ManagedUserRemovalResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/ManagedUserRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such managed user on your account (`MANAGED_USER_NOT_FOUND`), or no such session for it (`EDITOR_SESSION_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users/{id}/usage": { "get": { "operationId": "getManagedUserUsage", "summary": "What a managed user's editor sessions spent", "description": "Says how many credits the editor sessions of one of your managed users took from your account over a\nperiod, in total and for each operation. A generation costs one credit, taken from your account when it\nstarts; one that fails is refunded and is counted as refunded, not as spent.\n\nOnly what was spent through editor sessions is here, and only since usage was first recorded: what you\nspend with your API key, and anything from before, is not. Use it to see which of your users spend the\nmost, or to charge them for it. To hold one session to a number of credits, set `max_credits` when you\nmake it (`createManagedUserEditorSession`).\n\nThe period runs from `startDate` (included) to `endDate` (not included): the 30 days before now when you\ngive neither, and at most 366 days. A date without a time is midnight UTC at the start of that day, so for\nall of October give `startDate=2026-10-01` and `endDate=2026-11-01`.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The managed user whose usage you want (Widgetic's id for the user)" }, { "in": "query", "name": "startDate", "schema": { "type": "string" }, "description": "Start of the period, included: an ISO 8601 date (`2026-10-01`) or date-time with its offset (`2026-10-01T08:00:00Z`). Default: 30 days before `endDate`.\n" }, { "in": "query", "name": "endDate", "schema": { "type": "string" }, "description": "End of the period, not included, in the same forms. Default: now. It must be after `startDate`, by at most 366 days.\n" } ], "responses": { "200": { "description": "What the managed user's editor sessions spent in the period", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserUsageResponse" } } } }, "400": { "description": "A date is not a date, `startDate` is not before `endDate`, or the period is longer than 366 days", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No managed user with this id on your account (`MANAGED_USER_NOT_FOUND`). Another partner's managed user answers 404 as well.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, ManagedUsersApi } from '@widgetic/api-sdk-ts';\n\nconst managedUsersApi = new ManagedUsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// What this user's editor sessions spent in October:\nconst { data: usage } = await managedUsersApi.getManagedUserUsage({\n id: managedUserId,\n startDate: '2026-10-01',\n endDate: '2026-11-01'\n});\n\nconsole.log(usage.totals.credits, usage.operations);\n" } ] } }, "/managed-users/{id}/presets/{key}/copy": { "post": { "operationId": "copyPresetForManagedUser", "summary": "Give a managed user a copy of one of your presets", "description": "Copies the preset `key` (see `setPartnerPreset`) onto a new canvas for one of your managed users, so their\nWidget Creator opens on a widget of their own that starts from yours. The copy is a draft widget in your\naccount, filed under the managed user: `getAllWidgets` with `managedUserId` lists it, and no other managed\nuser's editor can reach it.\n\nThe copy carries the preset's code, design and content schemas, and thumbnail, and starts from a fork of its\ncode repository, so the user's chat edits begin where yours left off. It does not carry the preset's\ndatabase or its compositions. It is not a preset itself, and changing or removing the preset afterwards\nnever touches it.\n\nTo start a composition (the content and design editor) instead, you do not need a copy: call\n`createComposition` with the preset's `widgetId` (from `listPartnerPresets`) and the managed user.\n\nThe `Idempotency-Key` header is required (`400` without it). Send the same key when you retry, so one copy\nis made, not two. A copy that could not be made leaves nothing behind (503 `PRESET_COPY_FAILED`).\n\nThe managed user must be yours and active.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The managed user to give the copy to (Widgetic's id for the user)" }, { "in": "path", "name": "key", "required": true, "schema": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$" }, "description": "The key of the preset to copy" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CopyPartnerPresetRequest" } } } }, "responses": { "201": { "description": "The copy was made", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PartnerPresetCopyResponse" } } } }, "400": { "description": "The key or the name is malformed, or the Idempotency-Key header is missing", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such managed user on your account (`MANAGED_USER_NOT_FOUND`), or no preset with this key (`PRESET_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off, so nothing new can be made for it (`MANAGED_USER_INACTIVE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The copy could not be made right now (`PRESET_COPY_FAILED`). Nothing was created; ask again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, ManagedUsersApi } from '@widgetic/api-sdk-ts';\n\nconst managedUsersApi = new ManagedUsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// Give one of your users their own copy of the preset you registered as \"rating\":\n// The call needs an idempotency key: reuse the same key if you retry this call.\nconst { data: copy } = await managedUsersApi.copyPresetForManagedUser({\n id: managedUserId,\n key: 'rating',\n idempotencyKey: randomUUID(),\n});\n\n// Open the Widget Creator on copy.canvasId and copy.widgetId.\n" } ] } }, "/managed-users/{id}/presets/{key}/composition": { "post": { "operationId": "createCompositionFromPreset", "summary": "Create a composition from one of your presets in one call", "description": "Validates the name, optional content, design, embed settings and locale, then creates a draft composition\nfiled under the managed user, built on the preset's widget, in a single insert. A failure never leaves a\nhalf-made composition.\n\nThe preset's widget must be published. The managed user must be yours and active.\n\nA widget that keeps what visitors send (a form, a vote, a rating) declares its tables in its own source\n(`src/lib/meta/database.json`); they are made for the composition here, in a schema of its own, as the widget\nwas when it was last published. A widget that keeps nothing leaves the composition without tables. If the\ntables cannot be made just now, or the widget's file cannot be used, the composition is still created (`201`)\nand `meta.warnings` says why; the tables are made the next time the widget is generated.\n\nThe `Idempotency-Key` header is required (`400` without it). Send the same key when you retry, so one\ncomposition is created, not two.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "key", "required": true, "schema": { "type": "string" } }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string" }, "content": { "type": "object" }, "design": { "type": "object", "nullable": true }, "embedSettings": { "type": "object" }, "locale": { "type": "string", "description": "BCP-47 language tag stored on embed settings for the widget runtime" } } }, "example": { "name": "Customer rating page", "embedSettings": { "width": 640, "height": 480 }, "locale": "fr-FR" } } } }, "responses": { "201": { "description": "Composition created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionResponse" } } } }, "400": { "description": "Validation failed (`VALIDATION_ERROR`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner. A record managed by another account is never a 403.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found (`MANAGED_USER_NOT_FOUND`) or preset not found (`PRESET_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Managed user inactive (`MANAGED_USER_INACTIVE`) or widget not published (`WIDGET_NOT_PUBLISHED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limited", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, ManagedUsersApi } from '@widgetic/api-sdk-ts';\n\nconst api = new ManagedUsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\nconst { data: composition } = await api.createCompositionFromPreset({\n id: managedUserId,\n key: 'rating',\n // Reuse the same key if you retry this call.\n idempotencyKey: randomUUID(),\n // The request body is camelCase, like every answer of the API.\n createCompositionFromPresetRequest: { name: 'Customer rating page', embedSettings: { width: 640, height: 480 }, locale: 'fr-FR' },\n});\n" } ] } }, "/managed-users/{id}/limits": { "get": { "operationId": "getManagedUserLimits", "summary": "Read monthly credit cap and usage for one managed user", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Cap, spend this UTC month, and when the month resets", "content": { "application/json": { "schema": { "title": "ManagedUserLimitsResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/ManagedUserLimits" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] }, "example": { "success": true, "data": { "monthlyCredits": 500, "creditsUsedThisMonth": 120, "creditsLeftThisMonth": 380, "resetsAt": "2026-11-01T00:00:00.000Z" } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "setManagedUserLimits", "summary": "Set or clear the monthly credit cap for one managed user", "description": "Send monthlyCredits as a whole number from 0 up to 2147483647 to cap what this customer's editor sessions may spend in a UTC calendar month, or null to remove the cap. The cap counts the credits the customer's sessions spent that month (refunded credits do not count) and applies to all of the customer's sessions together, beside any `max_credits` a single session was given. A cap of 0 stops all paid work by this customer until you raise it. The cap starts counting from the first of the month (UTC); a cap set below what was already spent this month stops further work at once.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "monthlyCredits" ], "properties": { "monthlyCredits": { "type": "integer", "minimum": 0, "maximum": 2147483647, "nullable": true } } }, "example": { "monthlyCredits": 1000 } } } }, "responses": { "200": { "description": "Cap saved; same shape as getManagedUserLimits", "content": { "application/json": { "schema": { "title": "ManagedUserLimitsResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/ManagedUserLimits" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "Invalid body (`VALIDATION_ERROR`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users/{id}/storage-usage": { "get": { "operationId": "getManagedUserStorageUsage", "summary": "Storage used by one managed user's uploads", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Bytes and file counts, total and by upload purpose", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "required": [ "totalBytes", "fileCount", "byPurpose" ], "properties": { "totalBytes": { "type": "integer" }, "fileCount": { "type": "integer" }, "byPurpose": { "type": "object", "properties": { "canvas": { "$ref": "#/components/schemas/PurposeStorageBucket" }, "chat": { "$ref": "#/components/schemas/PurposeStorageBucket" }, "field": { "$ref": "#/components/schemas/PurposeStorageBucket" }, "unspecified": { "$ref": "#/components/schemas/PurposeStorageBucket" } } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] }, "example": { "success": true, "data": { "totalBytes": 4096, "fileCount": 2, "byPurpose": { "canvas": { "bytes": 2048, "fileCount": 1 }, "chat": { "bytes": 2048, "fileCount": 1 }, "field": { "bytes": 0, "fileCount": 0 }, "unspecified": { "bytes": 0, "fileCount": 0 } } } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users/{id}/entries": { "get": { "operationId": "listManagedUserEntries", "summary": "List entries across a managed user's compositions", "description": "Merges eligible tables (time and id columns) across the managed user's compositions in global time order, then compositionId, table, and id (byte order). Only tables with both a time and an id column take part. Rate limit 30 requests per minute.", "tags": [ "Managed Users" ], "x-access-level": "partner", "x-visibility": "public", "security": [ { "apiKeyAuth": [] } ], "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "query", "name": "compositionId", "schema": { "type": "string", "format": "uuid" } }, { "in": "query", "name": "table", "schema": { "type": "string", "maxLength": 63 } }, { "$ref": "#/components/parameters/CompositionEntryLimit" }, { "$ref": "#/components/parameters/CompositionEntryOrder" }, { "$ref": "#/components/parameters/CompositionEntrySince" }, { "$ref": "#/components/parameters/CompositionEntryUntil" }, { "$ref": "#/components/parameters/CompositionEntryCursor" }, { "$ref": "#/components/parameters/CompositionEntryContextFilters" }, { "$ref": "#/components/parameters/CompositionEntryColumnFilters" } ], "responses": { "200": { "description": "A page of entries across compositions", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserEntriesPageSuccess" }, "example": { "success": true, "data": [ { "compositionId": "11111111-1111-4111-8111-111111111111", "table": "ratings", "id": "1", "createdAt": "2026-10-01T00:00:00.000000Z", "values": {}, "context": null } ], "meta": { "nextCursor": null, "total": 120, "compositionsConsidered": 2, "moreCompositions": false, "partial": true } } } } }, "400": { "description": "Invalid cursor or filters", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the caller is not a partner, or the key does not hold the `partner:read` and `content:read` scopes. A record managed by another account is never a 403.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limit exceeded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/managed-users/{id}/design-defaults": { "get": { "operationId": "getManagedUserDesignDefaults", "summary": "Read design defaults for one managed user", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The stored default, or null when unset", "content": { "application/json": { "schema": { "title": "DesignDefaultsResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/DesignDefaults" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "setManagedUserDesignDefaults", "summary": "Set or clear design defaults for one managed user", "description": "Send `{ \"design\": { ... } }` to store a JSON object (at most 64 KB, nesting depth 32), or `{ \"design\": null }`\nto remove the override. New compositions for this customer merge this layer over the partner default and\nunder the request body.\n", "tags": [ "Managed Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "design" ], "properties": { "design": { "type": "object", "nullable": true } } }, "example": { "design": { "theme": { "primary": "#336699" } } } } } }, "responses": { "200": { "description": "Defaults saved. The answer is what is stored now, the same as getManagedUserDesignDefaults sends.", "content": { "application/json": { "schema": { "title": "DesignDefaultsResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/DesignDefaults" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "Invalid design document (`VALIDATION_ERROR`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Managed user not found (`MANAGED_USER_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/invoices/partner/{partnerId}": { "get": { "operationId": "getInvoicesByPartnerId", "summary": "List a partner's invoices", "description": "Lists the invoices issued to a partner, newest first. Each carries the price (`subtotal`), the tax on\nit (`taxAmount`) and what is paid (`total`), its status as the payment provider reports it, why the\nlast payment failed (`failureReason`), and the page where it is paid (`hostedInvoiceUrl`).\n\nA partner reads its own: the caller must be the person who administers the partner (an API key of\nthat account works), and anyone else is refused with 403 whether or not the partner exists.\nWidgetic administrators can read any partner's and see exactly what the partner sees; the full\nrecords, with the internal fields, are `getAllInvoices` filtered by partner.\n\nThe page is always bounded: `limit` defaults to 50 and is capped at 100, `offset` defaults to 0.\n", "tags": [ "Invoices" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose invoices to list" }, { "in": "query", "name": "status", "schema": { "type": "string", "enum": [ "draft", "open", "pending", "paid", "failed", "void", "uncollectible", "refunded", "canceled" ] }, "description": "Only invoices with this status" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 50 }, "description": "Maximum number of invoices to return" }, { "in": "query", "name": "offset", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Number of invoices to skip" } ], "responses": { "200": { "description": "The partner's invoices, newest first", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/PartnerInvoice" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/entitlements/partners/{partnerId}": { "get": { "operationId": "getPartnerEntitlements", "summary": "Get partner entitlements", "description": "Retrieves all entitlements for a partner (admin or partner access).", "tags": [ "Entitlements" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Partner ID" }, { "in": "query", "name": "includeExpired", "schema": { "type": "boolean" }, "description": "Include expired entitlements in results" }, { "in": "query", "name": "feature", "schema": { "type": "string" }, "description": "Filter by specific feature" }, { "in": "query", "name": "source", "schema": { "type": "string" }, "description": "Filter by entitlement source" } ], "responses": { "200": { "description": "Partner entitlements retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetPartnerEntitlementsResponse" }, "example": { "success": true, "data": { "partnerId": "123e4567-e89b-12d3-a456-426614174002", "entitlements": [ { "id": "123e4567-e89b-12d3-a456-426614174005", "partnerId": "123e4567-e89b-12d3-a456-426614174002", "feature": "whitelabeling.advanced", "source": "contract", "createdAt": "2023-01-01T00:00:00Z" } ] } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - You don't have permission to access these entitlements", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, EntitlementsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst entitlementsApi = new EntitlementsApi(config);\n\ntry {\n const entitlements = await entitlementsApi.getPartnerEntitlements({\n partnerId: '123e4567-e89b-12d3-a456-426614174002'\n });\n console.log('Partner entitlements:', entitlements);\n} catch (error) {\n console.error('Failed to fetch partner entitlements:', error);\n}\n" } ] } }, "/entitlements/managed-users/{managedUserId}": { "get": { "operationId": "getManagedUserEntitlements", "summary": "Get managed user entitlements", "description": "Retrieves all entitlements for a managed user (admin or partner access).", "tags": [ "Entitlements" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "managedUserId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Managed user ID" }, { "in": "query", "name": "includeExpired", "schema": { "type": "boolean" }, "description": "Include expired entitlements in results" }, { "in": "query", "name": "feature", "schema": { "type": "string" }, "description": "Filter by specific feature" }, { "in": "query", "name": "source", "schema": { "type": "string" }, "description": "Filter by entitlement source" } ], "responses": { "200": { "description": "Managed user entitlements retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetManagedUserEntitlementsResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - You don't have permission to access these entitlements", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, EntitlementsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst entitlementsApi = new EntitlementsApi(config);\n\ntry {\n const entitlements = await entitlementsApi.getManagedUserEntitlements({\n managedUserId: '123e4567-e89b-12d3-a456-426614174003'\n });\n console.log('Managed user entitlements:', entitlements);\n} catch (error) {\n console.error('Failed to fetch managed user entitlements:', error);\n}\n" } ] } }, "/credits/user/{userId}/balance": { "get": { "operationId": "getUserCreditBalance", "summary": "Get an account's credit balance", "description": "Returns the credits an account holds in the workspace the request acts in: the balance, and how much of\nit is reserved by operations that are still running. A credential that belongs to a team acts in that\nteam, a person signed in on widgetic.com acts in the workspace they last switched to, and any other\ncredential acts in the person's default workspace (the oldest workspace they own, and for the person who\nadministers a partner, the partner's own workspace).\n\nAn account reads its own balance; with a partner's API key, that is the account of the person who\nadministers the partner. Widgetic administrators can read any account's, and read all of it (the credits\nof every workspace of that account together). An account that has never held credits reads a balance of\n0. `getPartnerCreditBalance` reads the balance of the partner's workspace by partner id.\n", "tags": [ "Credits" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The account whose balance to read" } ], "responses": { "200": { "description": "The account's credit balance", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AccountCreditBalanceResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The balance belongs to another account", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Credit balance not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The workspace the request acts in could not be determined, so no balance is given (a balance of the wrong workspace would be worse than none). Retry.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/credits/user/{userId}/transactions": { "get": { "operationId": "getUserCreditTransactions", "summary": "List an account's credit ledger", "description": "Lists the entries of an account's credit ledger in the workspace the request acts in, newest first. A\ncredential that belongs to a team acts in that team, a person signed in on widgetic.com acts in the\nworkspace they last switched to, and any other credential acts in the person's default workspace (the\noldest workspace they own, and for the person who administers a partner, the partner's own workspace).\nThis is also how an account's usage is read: every operation that spends credits is a `debit` entry, so\nsumming the `debit` entries over a period gives the credits consumed in it in that workspace, and the\nother types give what was added to it.\n\nAn account reads its own ledger; with a partner's API key, that is the account of the person who\nadministers the partner. Widgetic administrators can read any account's, and read all of it (the entries\nof every workspace of that account together). `getPartnerCreditTransactions` reads the whole ledger of\nthat account by partner id.\n\nThe page is always bounded: `limit` defaults to 100 and is capped at 500, `offset` defaults to 0.\n", "tags": [ "Credits" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The account whose ledger to read" }, { "in": "query", "name": "transactionType", "schema": { "type": "string" }, "description": "Only entries of this type, for instance `debit` for the credits spent. The types are listed on `AccountCreditTransaction`.\n" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 500, "default": 100 }, "description": "Maximum number of entries to return" }, { "in": "query", "name": "offset", "schema": { "type": "integer", "minimum": 0, "default": 0 }, "description": "Number of entries to skip" } ], "responses": { "200": { "description": "The account's ledger entries, newest first", "content": { "application/json": { "schema": { "title": "AccountCreditTransactionListResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/AccountCreditTransaction" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The ledger belongs to another account", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The workspace the request acts in could not be determined, so no ledger is given (the ledger of the wrong workspace would be worse than none). Retry.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions": { "get": { "operationId": "getAllCompositions", "summary": "Get All Compositions", "description": "Retrieves all compositions with pagination support.\n\nPass `managedUserId` (Widgetic's id for one of your managed users) or `managedUserExternalId` (your own\nidentifier for the user) to list only the compositions made for that managed user. Only a partner has\nmanaged users, so this needs an active partner API key. The compositions of your other managed users, and\nyour own, are left out. It combines with the other filters and with paging. A managed user that is not\nyours, or does not exist, is answered with 404 and `MANAGED_USER_NOT_FOUND`.\n\nAn editor session with the `creator` surface may call this to list the compositions of ONE widget it\nbuilt: it must send `widgetId`, and the answer holds only the compositions made for the session's\nmanaged user.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number for pagination" }, { "in": "query", "name": "size", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Number of items per page" }, { "in": "query", "name": "sort", "schema": { "type": "string", "example": "createdAt:desc" }, "description": "The order of the list, as `:`. The field is `createdAt`, `updatedAt`, `name` or `status`\n(the snake_case spelling, such as `created_at`, is read too). `asc` or `desc` alone orders by `createdAt`.\nDefault: `createdAt:desc`. Any other field is a 400.\n" }, { "in": "query", "name": "widgetId", "schema": { "type": "string", "format": "uuid" }, "description": "Filter compositions by widget ID" }, { "in": "query", "name": "workspace", "schema": { "type": "string", "enum": [ "true", "false" ] }, "description": "Filter by workspace" }, { "in": "query", "name": "projectFolder", "schema": { "type": "string", "format": "uuid" }, "description": "Only the compositions in this project (the project's id)." }, { "in": "query", "name": "status", "schema": { "type": "string", "enum": [ "draft", "published", "archived", "demo" ] }, "description": "Only the compositions in this status. Without it, every status is listed." }, { "in": "query", "name": "managedUserId", "schema": { "type": "string", "format": "uuid" }, "description": "List only the compositions made for this managed user (Widgetic's id for the user). Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both. Send it as `managedUserId`; the snake_case spelling `managed_user_id` is refused with a 400, not ignored." }, { "in": "query", "name": "managedUserExternalId", "schema": { "type": "string", "maxLength": 255 }, "description": "List only the compositions made for the managed user you registered with this `externalId` (your own identifier for the user). Partners only. Send this or `managedUserId`, not both." }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "List of compositions retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/Composition" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A parameter is not valid (for example a `managedUserId` that is not a UUID, or both `managedUserId` and `managedUserExternalId`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user named by `managedUserId` or `managedUserExternalId` is not one of yours (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n const response = await compositionsApi.getAllCompositions({\n page: 1,\n size: 20,\n sort: 'createdAt:desc'\n });\n \n // The paging numbers are in meta\n console.log('Compositions:', response.data);\n console.log('Total:', response.meta?.total);\n console.log('Current page:', response.meta?.page);\n} catch (error) {\n if (error.response?.status === 401) {\n console.error('Authentication required');\n } else {\n console.error('Failed to fetch compositions:', error);\n }\n}\n" } ] }, "post": { "operationId": "createComposition", "summary": "Create Composition", "description": "Creates a new composition.\n\nTo make the composition for one of your managed users, send `managedUserId` or `managedUserExternalId`.\nOnly a partner has managed users, so this needs an active partner API key. The composition stays in your\naccount and is yours to edit; the tag lets you list one user's compositions with `getAllCompositions`. The\nmanaged user must be yours and active: one that is not yours, or does not exist, is answered with 404 and\n`MANAGED_USER_NOT_FOUND`, and one that is switched off with 409 and `MANAGED_USER_INACTIVE`. The tag is set\nhere and does not change afterwards. A copy made with `duplicateComposition` keeps the tag of the original.\n\nAn editor session with the `creator` surface may call this to start a composition of a widget it built:\nit sends only `name`, `widgetId` (a widget made for the session's managed user) and `content`, and the\ncomposition is always made for that managed user.\n\nSend `databaseSchema` to give the composition tables of its own for what visitors send it (the shape, the\nallowed types and the limits are described on the field). A `databaseSchema` that cannot be used is refused\nbefore anything is created, with `400` and `INVALID_DATABASE_SCHEMA`. If the composition is created but its\ntables cannot be made just now, the answer is still `201` and `meta.warnings` says so.\n\nLeave `databaseSchema` out and the composition gets the tables its widget declares in its own source\n(`src/lib/meta/database.json`), if it declares any: they are made the same way, in a schema of the\ncomposition's own. A widget that keeps nothing leaves the composition without tables. If the widget's file\ncannot be used, or its tables cannot be made just now, the answer is still `201` and `meta.warnings` says so.\nThe widget is read as it was when it was last published (as it is now, when it never was).\n\nThe `Idempotency-Key` header is required (`400` without it). Send the same key when you retry, so one\ncomposition is created, not two.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/NewComposition" } } } }, "responses": { "201": { "description": "Composition created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionResponse" } } } }, "400": { "description": "Invalid input (including a `managedUserId` that is not a UUID, both `managedUserId` and `managedUserExternalId`, or a `databaseSchema` that cannot be used, `INVALID_DATABASE_SCHEMA`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user named by `managedUserId` or `managedUserExternalId` is not one of yours (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off, so nothing new can be made for it (`MANAGED_USER_INACTIVE`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, CompositionsApi, ResponseError } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n const composition = await compositionsApi.createComposition({\n // The call needs an idempotency key: reuse the same key if you retry this call.\n idempotencyKey: randomUUID(),\n newComposition: {\n name: 'My New Composition',\n widgetId: '123e4567-e89b-12d3-a456-426614174002',\n content: {}\n }\n });\n \n console.log('Created composition:', composition);\n} catch (error) {\n if (error instanceof ResponseError && error.response.status === 400) {\n // The body of the answer says what was wrong\n console.error('Invalid input:', await error.response.json());\n } else {\n console.error('Failed to create composition:', error);\n }\n}\n" } ], "parameters": [ { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ] } }, "/compositions/{id}/duplicate": { "post": { "operationId": "duplicateComposition", "summary": "Duplicate Composition", "description": "Creates a duplicate of an existing composition for the authenticated user.\n\nThe duplicate is made after the answer: the call returns `202` with an `operationId`. Ask\n`GET /operations/{id}` for that operation until its `status` is `completed`; the new composition is\nnamed in `metadata.newCompositionId`. A problem with the duplicate's database (for example, tables that\ncould not be made just now) is listed in `metadata.warnings`, which is absent when there is none.\n\nThe `Idempotency-Key` header is required (`400` without it). Send the same key when you retry, so one\nduplicate is made, not two.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition to duplicate" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "Optional new name for the duplicate (defaults to \"Copy of [original name]\")", "example": "My Duplicated Composition" }, "includeDatabase": { "type": "boolean", "description": "Whether the duplicate gets the tables the original declares (`databaseSchema`), empty and in a schema\nof their own (default false). What visitors left in the original is never copied, and the duplicate\nnever shares the original's data.\n", "default": false } } } } } }, "responses": { "202": { "description": "Composition duplication initiated successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "operationId": { "type": "string", "format": "uuid", "description": "ID of the operation tracking the duplication process", "example": "123e4567-e89b-12d3-a456-426614174000" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Source composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, CompositionsApi, OperationsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\nconst operationsApi = new OperationsApi(config);\n\ntry {\n const started = await compositionsApi.duplicateComposition({\n id: 'composition_123',\n // The call needs an idempotency key: reuse the same key if you retry this call.\n idempotencyKey: randomUUID(),\n duplicateCompositionRequest: {\n name: 'My Duplicated Composition',\n includeDatabase: false\n }\n });\n \n // The duplicate is made after the answer: ask for the operation until it has finished\n const operationId = started.data?.operationId;\n if (!operationId) throw new Error('The answer has no operationId');\n \n const finalStatuses = ['completed', 'failed', 'cancelled'];\n let operation = await operationsApi.getOperation({ id: operationId });\n while (!finalStatuses.includes(operation.data.status ?? '')) {\n await new Promise((resolve) => setTimeout(resolve, 1000));\n operation = await operationsApi.getOperation({ id: operationId });\n }\n \n if (operation.data.status !== 'completed') {\n console.error('Duplication did not finish:', operation.data.status, operation.data.error);\n } else {\n console.log('Duplicated composition:', operation.data.metadata?.newCompositionId);\n if (operation.data.metadata?.warnings?.length) {\n console.warn('Warnings:', operation.data.metadata.warnings);\n }\n }\n} catch (error) {\n if (error.response?.status === 404) {\n console.error('Source composition not found');\n } else {\n console.error('Failed to duplicate composition:', error);\n }\n}\n" } ] } }, "/compositions/{id}/versions": { "get": { "operationId": "getCompositionVersions", "summary": "Get Composition Versions", "description": "Retrieves version history for a specific composition.", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Composition ID" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Version history retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/CompositionVersion" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n const { data: versions } = await compositionsApi.getCompositionVersions({\n id: '123e4567-e89b-12d3-a456-426614174000' // The ID of the composition\n });\n \n console.log('Version history:', versions);\n \n // Access specific version details\n versions?.forEach(version => {\n console.log(`Version ${version.version}:`, {\n createdAt: version.createdAt,\n content: version.content\n });\n });\n} catch (error) {\n if (error.response?.status === 404) {\n console.error('Composition not found');\n } else {\n console.error('Failed to fetch versions:', error);\n }\n}\n" } ] } }, "/compositions/{id}/status": { "put": { "operationId": "updateCompositionStatus", "summary": "Update Composition Status", "description": "Updates the status of a specific composition.\n\nThe `Idempotency-Key` header is required (`400` without it). Send the same key when you retry.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Composition ID" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "status" ], "properties": { "status": { "type": "string", "enum": [ "draft", "published", "archived" ], "description": "New status to set" } } } } } }, "responses": { "200": { "description": "Status updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionResponse" } } } }, "400": { "description": "Invalid status", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n const composition = await compositionsApi.updateCompositionStatus({\n id: 'composition_123',\n // The call needs an idempotency key: reuse the same key if you retry this call.\n idempotencyKey: randomUUID(),\n updateCompositionStatusRequest: {\n status: 'published'\n }\n });\n console.log('Status updated:', composition.data.status);\n} catch (error) {\n if (error.response?.status === 404) {\n console.error('Composition not found');\n } else {\n console.error('Failed to update status:', error);\n }\n}\n" } ] } }, "/compositions/{id}/managed-user": { "put": { "operationId": "setCompositionManagedUser", "summary": "Move a Composition to Another Managed User", "description": "Files a composition you made under a managed user, or moves it to another one, after it was created. Name the\nmanaged user by Widgetic's id (`managedUserId`) or by your own identifier for the user (`managedUserExternalId`),\nnever both. It must be one of your managed users, and switched on (`409 MANAGED_USER_INACTIVE` otherwise).\n\nIt changes whose composition this is and nothing else: its content, design, status, embed address and the entries\nvisitors left stay as they were. Like any change to a composition, it moves `updatedAt`. Reports read who a\ncomposition is filed under when they are asked for, so the composition counts for its new managed user from then\non. Sending the managed user it already has is not an error, and changes nothing (`updatedAt` stays).\n\nOnly the account that made the composition can do this (`404` for any other), and only with your own API key:\na call made for one managed user (an editor session, or the `X-Managed-User-Id` header) is refused with `403`.\nThe API key needs the `partner:write` and `content:write` scopes.", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Composition ID" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserReference" } } } }, "responses": { "200": { "description": "The composition is filed under the managed user", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "400": { "description": "No managed user was named (`MANAGED_USER_REFERENCE_REQUIRED`), both ways of naming one were sent (`MANAGED_USER_REFERENCE_AMBIGUOUS`), or the id or the `managedUserExternalId` is not valid (`MANAGED_USER_REFERENCE_INVALID`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The composition is not yours, or does not exist (`RESOURCE_COMPOSITION_NOT_FOUND`), or none of your managed users has that id (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off (`MANAGED_USER_INACTIVE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n // Name the managed user by your own id for it (or send managedUserId, Widgetic's id)\n const filed = await compositionsApi.setCompositionManagedUser({\n id: 'composition_123',\n managedUserReference: { managedUserExternalId: 'user-42' }\n });\n console.log('Filed under:', filed.data.managedUserId);\n} catch (error) {\n console.error('Failed to move the composition:', error);\n}\n" } ] }, "delete": { "operationId": "removeCompositionManagedUser", "summary": "Take a Composition's Managed User Label Off", "description": "Takes a composition off the managed user it is filed under, so it is your own again. Nothing else about the\ncomposition changes, except `updatedAt`, which moves as for any change. A composition that is filed under no one\nanswers the same and changes nothing, so a retry is safe.\n\nOnly the account that made the composition can do this (`404` for any other), and only with your own API key:\na call made for one managed user (an editor session, or the `X-Managed-User-Id` header) is refused with `403`.\nThe API key needs the `partner:write` and `content:write` scopes.", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Composition ID" } ], "responses": { "200": { "description": "The composition is filed under no managed user (`managedUserId` is `null`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ManagedUserLabelResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The call is made for one managed user (`MANAGED_USER_SCOPE_MISMATCH`), or the API key lacks the scopes.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The composition is not yours, or does not exist (`RESOURCE_COMPOSITION_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n const unfiled = await compositionsApi.removeCompositionManagedUser({\n id: 'composition_123'\n });\n console.log('Filed under:', unfiled.data.managedUserId); // null\n} catch (error) {\n console.error('Failed to take the label off:', error);\n}\n" } ] } }, "/compositions/{id}": { "get": { "operationId": "getCompositionById", "summary": "Get Composition", "description": "Retrieves a specific composition by its ID.\n\nThe answer carries `direct`, which says whether the widget the composition is made from is drawn straight\ninto your page (`true`) or inside a frame (`false`), or `null` while the widget has no published version.\nRead it before you go live: a widget drawn without a frame writes its entries from your own page, so the\npublic entry route looks at the website that page is on. While the composition's allowed list is empty (you\nhave not restricted the allowed websites), every website may write; once you list websites, only those may,\nbesides Widgetic's own sites, the visitor's own machine and your own platform. A widget in a frame writes from\nWidgetic's own frame and is accepted whatever the list says. The public JSON of the composition stays open to\nevery website.\n\nFor a composition a team shares (one filed under a project of an organization, or made in a Shopify store's\nworkspace) the answer also carries `lastEditedBy` and `lastEditedAt`: who made the latest change and when, so\nthat a teammate who opens it can be told \"Anna changed this at 14:32\". A composition that belongs to no\nworkspace (one from before workspaces) leaves both out, and so does an answer given to an editor session or to\na call made for one managed user: only a person is told who a teammate is.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Composition ID" }, { "in": "header", "name": "If-None-Match", "required": false, "schema": { "type": "string" }, "description": "When it contains the composition's current content version (as quoted integer, e.g. `\"3\"`), and nothing else on the row changed that the version does not cover, the answer is 304 with an ETag and no body. Express's weak body-hash validators never match a numeric content version." }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Composition retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionResponse" } } } }, "304": { "description": "The content version named in If-None-Match is still current", "headers": { "ETag": { "schema": { "type": "string" }, "description": "The content version the caller matched" } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n const composition = await compositionsApi.getCompositionById({\n id: 'composition_123' // The ID of the composition to retrieve\n });\n console.log('Composition:', composition);\n} catch (error) {\n if (error.response?.status === 404) {\n console.error('Composition not found');\n } else {\n console.error('Failed to fetch composition:', error);\n }\n}\n" } ] }, "put": { "operationId": "updateComposition", "summary": "Update Composition", "description": "Updates a specific composition.\n\nThe `Idempotency-Key` header is required (`400` without it). Send the same key when you retry.\n\nAn editor session (see `createManagedUserEditorSession`) can send only `name`, `content`, `design` and\n`embedSettings`, and only for a composition made for its managed user. A body that names any other field\nis refused with `403` and `EDITOR_SESSION_FIELD_NOT_ALLOWED`.\n\nSend `databaseSchema` to add tables to the composition: the tables that are missing are made, and\nthe ones that exist are left as they are. A `databaseSchema` that cannot be used is refused before anything\nis saved, with `400` and `INVALID_DATABASE_SCHEMA`. If the composition is saved but its tables cannot be made\njust now, the answer is still `200` and `meta.warnings` says so.\n\n**When several people edit the same composition.** A save that carries `content` can name the content version\nit started from in the `If-Match` header (the `contentVersion` of the composition you read, or the `ETag` of an\nearlier answer). If somebody saved the content since, nothing is overwritten: the save is refused with `412` and\n`CONTENT_VERSION_MISMATCH`, and `error.details.currentVersion` is the version to start again from. For a\ncomposition a team shares, `error.details` also says who got there first: `lastEditedBy`\n(`{ id, name }`, or `null` when nobody can be named) and `lastEditedAt`. An editor session, or a call made for\none managed user, is told the version only. A save without `If-Match` still goes through, and the other\nperson's change is replaced, as it always was.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Composition ID" }, { "in": "header", "name": "If-Match", "schema": { "type": "string" }, "description": "Optional content version from `contentVersion` or an `ETag` (`\"3\"`, `3`, or `*`). Read only when the body has `content`." }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateComposition" } } } }, "responses": { "200": { "description": "Composition updated successfully", "headers": { "ETag": { "schema": { "type": "string" }, "description": "Quoted content version for the next If-Match" } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionResponse" } } } }, "400": { "description": "Invalid input (including a `databaseSchema` that cannot be used, `INVALID_DATABASE_SCHEMA`, and an invalid If-Match)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Not allowed - an editor session named a field it may not write (`EDITOR_SESSION_FIELD_NOT_ALLOWED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "412": { "description": "The content changed since the version named in `If-Match` (`CONTENT_VERSION_MISMATCH`). The `ETag` header\nis the current version. `error.details.currentVersion` is the version to start again from; for a\ncomposition a team shares `error.details.lastEditedBy` and `error.details.lastEditedAt`\nsay who saved first and when (to a person only).\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The content version cannot be read just now (`CONTENT_VERSION_UNAVAILABLE`). Try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { randomUUID } from 'node:crypto';\nimport { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n const composition = await compositionsApi.updateComposition({\n id: 'composition_123',\n // The call needs an idempotency key: reuse the same key if you retry this call.\n idempotencyKey: randomUUID(),\n updateComposition: {\n name: 'Updated Composition',\n content: {\n // Updated content object\n },\n embedSettings: {\n width: '800',\n height: '600'\n }\n }\n });\n console.log('Updated composition:', composition.data);\n} catch (error) {\n if (error.response?.status === 404) {\n console.error('Composition not found');\n } else {\n console.error('Failed to update composition:', error);\n }\n}\n" } ] }, "delete": { "operationId": "deleteComposition", "summary": "Delete Composition", "description": "Deletes a specific composition, and the data it keeps (the tables it declared and what visitors left in them).", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The ID of the composition to delete" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "204": { "description": "Composition deleted successfully" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to delete this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst compositionsApi = new CompositionsApi(config);\n\ntry {\n await compositionsApi.deleteComposition({\n id: 'composition_123' // The ID of the composition to delete\n });\n console.log('Composition deleted successfully');\n} catch (error) {\n if (error.response?.status === 404) {\n console.error('Composition not found');\n } else if (error.response?.status === 403) {\n console.error('Not authorized to delete this composition');\n } else {\n console.error('Failed to delete composition:', error);\n }\n}\n" } ] } }, "/compositions/{id}/design": { "get": { "operationId": "getCompositionDesign", "summary": "Get Composition Design", "description": "Retrieves only the design field from a composition.", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "schema": { "type": "string", "format": "uuid" }, "required": true, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Design data retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionDesignResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/content": { "get": { "operationId": "getCompositionContent", "summary": "Get Current Content", "description": "Retrieves the current content of a composition", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "schema": { "type": "string", "format": "uuid" }, "required": true, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Current content retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionContentResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-resource-path": "compositions" }, "put": { "operationId": "setDynamicContent", "summary": "Set Dynamic Content", "description": "Updates the content of a composition dynamically with optional schema validation.\n\nAn editor session (see `createManagedUserEditorSession`) can send only `content`, `validate` and\n`partial`, and only for a composition made for its managed user. A body that names `version`, `source`\nor any other field is refused with `403` and `EDITOR_SESSION_FIELD_NOT_ALLOWED`.\n", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "in": "header", "name": "If-Match", "schema": { "type": "string" }, "description": "Optional content version from ETag (`\"3\"`, `3`, or `*`)" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "content": { "type": "object", "description": "Content data to set" }, "validate": { "type": "boolean", "description": "Whether to validate content against widget schema", "default": true }, "partial": { "type": "boolean", "description": "Whether to merge with existing content (true) or replace entirely (false)", "default": false }, "version": { "type": "string", "description": "Optional version identifier for the content" }, "source": { "type": "string", "description": "Source of the update for tracking purposes" } }, "required": [ "content" ], "example": { "content": { "title": "Dynamic Title", "items": [ { "image": "https://example.com/image1.jpg", "title": "Product 1" } ] }, "validate": true, "partial": true, "source": "ecommerce-api" } } } } }, "responses": { "200": { "description": "Content updated successfully", "headers": { "ETag": { "schema": { "type": "string" }, "description": "Quoted content version for the next If-Match" } }, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetDynamicContentResponse" }, "example": { "success": true, "data": { "success": true, "contentVersion": 4, "compositionUpdated": true, "realtimeUpdateSent": false } } } } }, "400": { "description": "Invalid content, validation failed, or invalid If-Match", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Not allowed - an editor session named a field it may not write (`EDITOR_SESSION_FIELD_NOT_ALLOWED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Content write conflict without If-Match (`CONTENT_WRITE_CONFLICT`): another save of the same composition got in\nbetween. For a composition a team shares `error.details` says who made the latest change\n(`lastEditedBy`, `lastEditedAt`), to a person only.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "412": { "description": "Content version mismatch (`CONTENT_VERSION_MISMATCH`). `error.details.currentVersion` is the version to start\nagain from. For a composition a team shares `error.details.lastEditedBy` (`{ id, name }`, or\n`null` when nobody can be named) and `error.details.lastEditedAt` say who saved first and when. An editor\nsession, or a call made for one managed user, is told the version only.\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Content version unavailable (`CONTENT_VERSION_UNAVAILABLE`) when If-Match was sent before migration", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/embed-settings": { "get": { "operationId": "getCompositionEmbedSettings", "summary": "Get Composition Embed Settings", "description": "Retrieves only the embedSettings field from a composition.", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "schema": { "type": "string", "format": "uuid" }, "required": true, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Embed settings retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionEmbedSettingsResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/preview": { "get": { "operationId": "getCompositionPreview", "summary": "Get Composition Preview", "description": "Returns the address of the page an editor shows the composition in: the page of the widget's published\nversion on the CDN, with the widget and version it is. Load it in a frame, then send the frame what to show\n(the content, design and embed settings you read from the composition, and every change the user makes) with\n`postMessage`: `{ type: 'widgetic:update', design }`, `{ type: 'widgetic:update', content }` or\n`{ type: 'widgetic:update', contentItems }`.\n\nThe version is the one embeds show, so the editor previews what a visitor gets. The address does not carry\nthe composition id: an embed uses the id to fetch the saved composition itself, while an editor sends the\ncurrent state (unsaved changes included).\n\nA widget that has never been published has no page to show: the answer is 409 `WIDGET_NOT_PUBLISHED`.\n", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Preview address retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionPreviewResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller cannot read this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found, or its widget is gone", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The composition's widget has never been published (`WIDGET_NOT_PUBLISHED`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/database/{table}": { "get": { "operationId": "getCompositionDatabaseRecords", "summary": "Get All Records From Composition Database Table", "description": "Retrieves all records from one of the composition's tables. Only the composition's own tables (made from its `databaseSchema` or from the tables its widget declares) can be reached; any other table name answers `404`.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string" }, "description": "Name of the database table" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Records retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/CompositionDatabaseRecord" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition or table not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createCompositionDatabaseRecord", "summary": "Create Record In Composition Database", "description": "Creates a new record in one of the composition's tables. Only the composition's own tables (made from its `databaseSchema` or from the tables its widget declares) can be reached; any other table name answers `404`.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string" }, "description": "Name of the database table" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object" } } } }, "responses": { "201": { "description": "Record created successfully", "content": { "application/json": { "schema": { "title": "CompositionDatabaseRecordResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/CompositionDatabaseRecord" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition or table not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/database/{table}/{recordId}": { "get": { "operationId": "getCompositionDatabaseRecord", "summary": "Get Record From Composition Database", "description": "Retrieves a specific record from one of the composition's tables. Only the composition's own tables (made from its `databaseSchema` or from the tables its widget declares) can be reached; any other table name answers `404`.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string" }, "description": "Name of the database table" }, { "in": "path", "name": "recordId", "required": true, "schema": { "type": "string" }, "description": "ID of the record to retrieve" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Record retrieved successfully", "content": { "application/json": { "schema": { "title": "CompositionDatabaseRecordResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/CompositionDatabaseRecord" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition, table, or record not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "updateCompositionDatabaseRecord", "summary": "Update Record In Composition Database", "description": "Updates a specific record in one of the composition's tables. Only the composition's own tables (made from its `databaseSchema` or from the tables its widget declares) can be reached; any other table name answers `404`.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string" }, "description": "Name of the database table" }, { "in": "path", "name": "recordId", "required": true, "schema": { "type": "string" }, "description": "ID of the record to update" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object" } } } }, "responses": { "200": { "description": "Record updated successfully", "content": { "application/json": { "schema": { "title": "CompositionDatabaseRecordResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/CompositionDatabaseRecord" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition, table, or record not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteCompositionDatabaseRecord", "summary": "Delete Record From Composition Database", "description": "Deletes a specific record from one of the composition's tables. Only the composition's own tables (made from its `databaseSchema` or from the tables its widget declares) can be reached; any other table name answers `404`.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string" }, "description": "Name of the database table" }, { "in": "path", "name": "recordId", "required": true, "schema": { "type": "string" }, "description": "ID of the record to delete" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Record deleted successfully", "content": { "application/json": { "schema": { "title": "CompositionDatabaseRecordResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/CompositionDatabaseRecord" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition, table, or record not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/entries": { "get": { "operationId": "describeCompositionEntries", "summary": "Describe What a Composition Keeps", "description": "Names the tables a composition's widget keeps entries in (the votes, ratings, answers or sign-ups its\nvisitors left), their columns, and how many entries each holds. Call it first to learn the table and\ncolumn names that `readCompositionEntries` takes.\n\nA widget that only shows content keeps nothing of its own: the answer is `hasData: false` with no tables,\nand that is not an error. A table that could not be counted has `rows: null`, which is not zero.\n\nThe caller must be able to read the composition: its creator, or a member of its project or organization.\nAn editor session cannot call this route.\n", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The tables the composition keeps entries in", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionEntriesDescriptionResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller cannot read this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/entries/{table}": { "get": { "operationId": "readCompositionEntries", "summary": "Read the Entries of a Composition's Table", "description": "Counts the entries visitors left in one table, tallies them per value of a column on request, and returns\nthe newest entries only when asked to. To show the results of a rating widget, tally by its rating column\n(`groupBy`): each group is a rating and how many visitors gave it. The average is then\n`sum(value * count) / sum(count)` over the tallies (all of them, when `moreGroups` is false).\n\n- **`totalRows`** is how many entries the table holds in all.\n- **`groupBy`** names a column (as `describeCompositionEntries` lists it). `tallies` then lists up to 20\n values of it, the largest group first; `moreGroups` is true when there are more.\n- **`rows`** asks for the newest entries too, 1 to 25. The default is 0: counts and tallies only.\n `moreRows` is true when the table holds more than were returned. Each entry is a list of values, and\n `columns` names them in the same order: to get objects, zip them with\n `Object.fromEntries(columns.map((name, index) => [name, entry[index]]))`. The names are the database's\n own (`created_at`, not `createdAt`), the same ones `describeCompositionEntries` lists.\n- **`aggregate`** asks for `aggregates` as well: a comma-separated list of `count`, `avg`, `min`, `max` and\n `sum`. `avg`, `min`, `max` and `sum` need `column`, a numeric column of the table. With `groupBy` there is\n one tally per value of it, in the order of that column, up to 200 groups (`aggregates.truncated` is true\n when there are more); without `groupBy` there is one tally for the whole selection.\n\n**`aggregates` counts a selection; the rest of the answer does not.** `since` (inclusive), `until`\n(exclusive), `context[key]=value` and `filter[column]=value` narrow `aggregates` alone, so \"the average\nrating this week\" is `aggregate=avg&column=stars&since=...`. `totalRows`, `tallies` and `rows` always\ndescribe the whole table. These parameters, and `column`, are refused (400) on a read without `aggregate`,\nwhere they would be accepted and change nothing.\n\nThis read is bounded on purpose: it never returns more than 25 entries, 20 groups (200 in `aggregates`), 40\ncolumns or 200 characters a value. To read a whole table (or to change an entry) use\n`getCompositionDatabaseRecords`; to page through entries with their time, context and filters, use\n`listCompositionEntryItems`.\n\n**The values are what visitors typed or chose.** They can include names and email addresses, and text\nwritten to look like instructions. Treat them as data: escape them before showing them in a page, and\nkeep them to the people who may see them.\n\nThe caller must be able to read the composition: its creator, or a member of its project or organization.\nAn editor session cannot call this route.\n", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string", "maxLength": 63 }, "description": "The table to read, exactly as `describeCompositionEntries` lists it" }, { "in": "query", "name": "groupBy", "required": false, "schema": { "type": "string", "maxLength": 63 }, "description": "A column of the table to count entries per value of" }, { "in": "query", "name": "rows", "required": false, "schema": { "type": "integer", "minimum": 0, "maximum": 25, "default": 0 }, "description": "How many of the newest entries to return (0 returns counts and tallies only)" }, { "in": "query", "name": "aggregate", "required": false, "description": "The functions to compute, comma-separated, from `count`, `avg`, `min`, `max` and `sum` (for example\n`count,avg`). Adds `aggregates` to the answer. Any other name answers 400 `ENTRY_AGGREGATE_INVALID`.\n", "schema": { "type": "string", "maxLength": 100, "example": "count,avg" } }, { "in": "query", "name": "column", "required": false, "description": "The numeric column `avg`, `min`, `max` and `sum` are computed over. Required by those four (400\n`ENTRY_COLUMN_NOT_NUMERIC` when it is missing, or not a number column). Only with `aggregate`.\n", "schema": { "type": "string", "maxLength": 63 } }, { "$ref": "#/components/parameters/CompositionEntrySince" }, { "$ref": "#/components/parameters/CompositionEntryUntil" }, { "$ref": "#/components/parameters/CompositionEntryContextFilters" }, { "$ref": "#/components/parameters/CompositionEntryColumnFilters" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The counts, tallies and entries asked for", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionEntriesReadingResponse" } } } }, "400": { "description": "A query parameter is not valid or not known (a filter on a column the table does not have answers\n`ENTRY_FILTER_UNKNOWN`; `since`, `until` and `column` without `aggregate` are refused), or the table has\nno column named by `groupBy` (`ENTRY_COLUMN_NOT_FOUND`). With `aggregate`: a function that does not exist\n(`ENTRY_AGGREGATE_INVALID`), a `column` that is missing or not numeric (`ENTRY_COLUMN_NOT_NUMERIC`), a\n`since` or `until` that is not a date and time (`INVALID_SINCE`, `INVALID_UNTIL`), or a time bound on a\ntable with no time column (`ENTRY_TABLE_HAS_NO_TIME`)\n", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller cannot read this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found, or it keeps no table with that name (`ENTRY_TABLE_NOT_FOUND`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/content/{list}/items": { "post": { "operationId": "createCompositionContentItem", "summary": "Add a content list item", "description": "Creates one item in a widget content list without replacing the whole list. Item field keys are widget data (camelCase or snake_case are kept as sent). Partners use this to keep galleries in sync.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "list", "required": true, "schema": { "type": "string" }, "description": "List name from the content schema (`contentItems`) or `items`" }, { "in": "header", "name": "If-Match", "schema": { "type": "string" }, "description": "Optional content version from ETag" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "properties": { "position": { "type": "integer", "minimum": 0 } } } } } }, "responses": { "201": { "description": "Item created", "content": { "application/json": { "schema": { "title": "ContentItemWriteResultResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/ContentItemWriteResult" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "Validation failed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "List or composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "Write conflict without If-Match. For a composition a team shares `error.details` says who made the latest change (`lastEditedBy`, `lastEditedAt`), to a person only.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "412": { "description": "Content version mismatch. `error.details.currentVersion` is the version to start again from; for a composition a team shares `error.details.lastEditedBy` and `error.details.lastEditedAt` say who saved first and when, to a person only.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "Item limit exceeded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Content version unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/content/{list}/items/{itemId}": { "patch": { "operationId": "patchCompositionContentItem", "summary": "Update a content list item", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "list", "required": true, "schema": { "type": "string" } }, { "in": "path", "name": "itemId", "required": true, "schema": { "type": "string" } }, { "in": "header", "name": "If-Match", "schema": { "type": "string" } }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true } } } }, "responses": { "200": { "description": "Item updated", "content": { "application/json": { "schema": { "title": "ContentItemWriteResultResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/ContentItemWriteResult" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "412": { "description": "Content version mismatch. `error.details.currentVersion` is the version to start again from; for a composition a team shares `error.details.lastEditedBy` and `error.details.lastEditedAt` say who saved first and when, to a person only.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteCompositionContentItem", "summary": "Delete a content list item", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "list", "required": true, "schema": { "type": "string" } }, { "in": "path", "name": "itemId", "required": true, "schema": { "type": "string" } }, { "in": "header", "name": "If-Match", "schema": { "type": "string" } }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Item deleted", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteCompositionContentItemResponse" } } } }, "412": { "description": "Content version mismatch. `error.details.currentVersion` is the version to start again from; for a composition a team shares `error.details.lastEditedBy` and `error.details.lastEditedAt` say who saved first and when, to a person only.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/data-source": { "put": { "operationId": "setCompositionDataSource", "summary": "Bind a public JSON data source for embed refresh", "description": "Stores an https URL the widget runtime may read on load and every `refreshSeconds`. The URL must name a public host (no loopback, link-local or metadata addresses). A composition has one binding: saving another replaces it. The answer is the binding as it was saved (`url`, `refreshSeconds`).", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "url", "refreshSeconds" ], "properties": { "url": { "type": "string", "maxLength": 2048 }, "refreshSeconds": { "type": "integer", "minimum": 10, "maximum": 86400 } } } } } }, "responses": { "200": { "description": "The data source as it was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionDataSourceResponse" } } } }, "400": { "description": "Invalid URL or refresh interval", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "get": { "operationId": "getCompositionDataSource", "summary": "Read the composition data source binding", "description": "The data source that is bound to the composition: `url` and `refreshSeconds`. The answer's `data` is `null` when none is bound, and also when what is stored does not pass the rule for a public https address (a binding written by another path, such as the general embed-settings update, is never shown to a page unless it passes the same checks as this route).", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The data source settings, or `null` when the composition has none", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionDataSourceResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteCompositionDataSource", "summary": "Remove the composition data source binding", "description": "Removes the binding. Asking again, or asking for a composition that had none, is not an error: the composition has no data source afterwards, and that is all `removed: true` says.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The composition has no data source now", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteCompositionDataSourceResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/content/validate": { "post": { "operationId": "validateCompositionContent", "summary": "Validate Content", "description": "Checks content against the composition's widget schema without saving it. Send what a content update (`PUT /compositions/{id}/content`) would store, `{ \"design\": {...}, \"content\": {...} }`, or the widget's values alone. Each value is checked by the kind of field the widget declares for it: text, a number within the limits of its slider, true or false, one of the choices of a dropdown, a color, a font, the address of an image, a date. The items of the widget's list are checked the same way, and their number against the limits of the list. A value that cannot be what the field holds, or a number outside its range, is an error and `valid` is false. Text longer than the field takes, a number or true/false sent as text, and a name the widget has no field for are warnings, and `valid` stays true. The design is not checked here. Nothing is saved and nothing in the body is changed.", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": true, "description": "The content to check, as a content update stores it: `{ \"design\": {...}, \"content\": {...} }`, or the widget's values alone." } } } }, "responses": { "200": { "description": "The check ran; `valid` says whether the content passed it.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidateCompositionContentResponse" } } } }, "400": { "description": "The body is not a JSON object.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/schema/content": { "get": { "operationId": "getCompositionContentSchema", "summary": "Get Content Schema", "description": "Retrieves the content schema for a composition based on its widget type", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Content schema retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionContentSchemaResponse" }, "example": { "success": true, "data": { "version": "1.0.0", "widgetType": "gallery", "content": { "properties": { "imageUrl": { "type": "string", "role": "media.url", "roleSource": "inferred" } } }, "contentItems": { "role": "list", "properties": { "title": { "type": "string", "role": "item.title", "roleSource": "inferred" } } } } } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/schema/design": { "get": { "operationId": "getCompositionDesignSchema", "summary": "Get Design Schema", "description": "Retrieves the design schema for a composition based on its widget type", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Design schema retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionDesignSchemaResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/schema/embed": { "get": { "operationId": "getCompositionEmbedSchema", "summary": "Get Embed Schema", "description": "Retrieves the definition of the composition's Embed tab: which settings exist, what each one holds, what it\ndefaults to, and when its control is shown. It is the third tab beside `schema/content` and `schema/design`,\nin the same format (`componentGroups` → `components` → `propertyGroups` → `properties`, each property with a\n`type`, a `defaultValue` and an `inputController`), so a client that draws those two tabs draws this one with\nthe same code.\n\nThe schema is the same for every composition (it is the one Widgetic's own Embed Editor draws). The\ncomposition id decides who may ask: the caller must be able to read the composition.\n\nReading and saving the values:\n- `GET /compositions/{id}/embed-settings` returns what the composition saved. A composition whose Embed tab\n was never saved has nothing to return; seed the form from `defaults`, which holds the `defaultValue` of\n every setting that declares one.\n- `PUT /compositions/{id}` with `embedSettings` saves them. The gateway stores `embedSettings` as given and\n does not check it against this schema; the schema is how a client knows what to put there.\n\nA property's `visibilityCondition` says when its control is shown: `condition` is a comparison of the\ncurrent values of the properties named in `dependsOn` (`useIframe === false`, `embedTarget === 'mixed' &&\nkeepDimensions === false`). While it is false the Embed Editor does not show the control.\n\nA colour picker with `showOpacityControls` saves its opacity next to the colour, under the key\n`_opacity` as a number from 0 to 1 (`overlayBackgroundColor` → `overlayBackgroundColor_opacity`).\nIts `defaultTransparency` is a percentage and the saved value a fraction (50 → 0.5).\n", "tags": [ "Compositions" ], "x-resource-path": "compositions", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the composition" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Embed schema retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionEmbedSchemaResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller cannot read this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/access": { "get": { "operationId": "checkCompositionAccess", "summary": "Check Composition Access", "description": "Checks if the authenticated user can access a specific composition based on workspace context and permissions.", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Composition ID" } ], "responses": { "200": { "description": "Access check completed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckCompositionAccessResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/batch": { "post": { "operationId": "getCompositionsBatch", "summary": "Get Compositions Batch", "description": "Retrieves multiple compositions by their IDs in a single request.\nThis endpoint includes domain validation for embed contexts and is used by the embed SDK.\n\nEach composition is checked on its own. If its owner listed the websites it may appear on (the\nworkspace's domain list, or the `allowedDomains` of a partner the owner administers) and the request\ncomes from another website (the `Origin` header, or the host of `Referer` when there is no `Origin`),\nthat composition is left out of `compositions` and reported in `errors` as\n`Domain access denied: `; the others are still returned. A request that names no website, and\nan owner who listed nothing, are not restricted, and a page on the visitor's own machine (`localhost`,\n`127.0.0.1` or `[::1]`, on any port) is always allowed. So is the website where a partner integrates\nWidgetic, with every subdomain of it (`platformDomain` in the answer of `GET /partners/mine`), for the\ncompositions of that partner: a partner's list never has to name it.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "compositionIds" ], "properties": { "compositionIds": { "type": "array", "items": { "type": "string", "format": "uuid" }, "description": "Array of composition IDs to retrieve", "maxItems": 50 } } } } } }, "responses": { "200": { "description": "Compositions retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionsBatchResponse" } } } }, "400": { "description": "Invalid request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Domain access denied", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/entries/{table}/items": { "get": { "operationId": "listCompositionEntryItems", "summary": "List composition entry items with paging and filters", "description": "Reads one widget table with cursor paging (time then id in byte order), optional since/until on the time column, and up to five context filters plus ten column filters. Rate limit 120 requests per minute. Each read batch uses a 5 s statement timeout.", "tags": [ "Compositions" ], "x-access-level": "user", "x-visibility": "public", "security": [ { "apiKeyAuth": [] } ], "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string", "maxLength": 63 } }, { "$ref": "#/components/parameters/CompositionEntryLimit" }, { "$ref": "#/components/parameters/CompositionEntryOrder" }, { "$ref": "#/components/parameters/CompositionEntrySince" }, { "$ref": "#/components/parameters/CompositionEntryUntil" }, { "$ref": "#/components/parameters/CompositionEntryCursor" }, { "$ref": "#/components/parameters/CompositionEntryContextFilters" }, { "$ref": "#/components/parameters/CompositionEntryColumnFilters" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "A page of entry items", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionEntryItemsPageSuccess" }, "example": { "success": true, "data": [ { "id": "11111111-1111-4111-8111-111111111111", "createdAt": "2026-10-01T00:00:00.000000Z", "values": { "starRating": 5 }, "context": { "site": "a" } } ], "meta": { "nextCursor": "eyJ2ZXJzaW9uIjoxLCJvcmRlciI6ImRlc2MiLCJ0aW1lIjoiMjAyNi0xMC0wMVQwMDowMDowMC4wMDAwMDBaIiwiaWQiOiIxMTExMTExMS0xMTExLTQxMTEtODExMS0xMTExMTExMTExMTExIn0", "total": 42 } } } } }, "400": { "description": "Invalid filters, cursor, since/until, or column (ENTRY_FILTER_INVALID, INVALID_CURSOR, ENTRY_COLUMN_NOT_FOUND, ENTRY_TABLE_HAS_NO_TIME)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Caller cannot read this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Unknown table (ENTRY_TABLE_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limit exceeded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteCompositionEntryItems", "summary": "Delete composition entry items by id or host context", "description": "Delete by comma-separated ids (1–100) or by context filters (not both). Rate limit 30 requests per minute.", "tags": [ "Compositions" ], "x-access-level": "user", "x-visibility": "public", "security": [ { "apiKeyAuth": [] } ], "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string", "maxLength": 63 } }, { "in": "query", "name": "ids", "schema": { "type": "string", "description": "Comma-separated entry ids (1–100)" } }, { "$ref": "#/components/parameters/CompositionEntryContextFilters" }, { "$ref": "#/components/parameters/CompositionEntryColumnFilters" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Deletion result", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompositionEntryDeleteSuccess" }, "example": { "success": true, "data": { "deleted": 3 } } } } }, "400": { "description": "Invalid selector or column (ENTRY_DELETE_SELECTOR_REQUIRED, ENTRY_DELETE_SELECTOR_INVALID, ENTRY_TABLE_HAS_NO_ID, ENTRY_COLUMN_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Caller cannot write this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Unknown table", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limit exceeded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/entries/{table}/export": { "get": { "operationId": "exportCompositionEntryItems", "summary": "Export composition entry items", "description": "Streams up to 50,000 matching rows in batches of 1,000. Tables without cursor paging export at most one batch; when more rows exist the response sets `X-Widgetic-Export-Truncated: true`. Rate limit 20 requests per minute.", "tags": [ "Compositions" ], "x-access-level": "user", "x-visibility": "public", "security": [ { "apiKeyAuth": [] } ], "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "path", "name": "table", "required": true, "schema": { "type": "string", "maxLength": 63 } }, { "in": "query", "name": "format", "schema": { "type": "string", "enum": [ "csv", "json" ], "default": "csv" } }, { "$ref": "#/components/parameters/CompositionEntryOrder" }, { "$ref": "#/components/parameters/CompositionEntrySince" }, { "$ref": "#/components/parameters/CompositionEntryUntil" }, { "$ref": "#/components/parameters/CompositionEntryContextFilters" }, { "$ref": "#/components/parameters/CompositionEntryColumnFilters" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Exported CSV or JSON stream", "headers": { "X-Widgetic-Export-Truncated": { "schema": { "type": "string", "enum": [ "true" ] } } }, "content": { "text/csv": { "schema": { "type": "string" } }, "application/json": { "schema": { "type": "object", "required": [ "success", "data", "meta" ], "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/CompositionEntryItem" } }, "meta": { "type": "object", "required": [ "total", "exported" ], "properties": { "total": { "type": "integer" }, "exported": { "type": "integer" } } } } } } } }, "400": { "description": "Invalid filters or parameters", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Caller cannot read this composition", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Unknown table", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Rate limit exceeded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/canvases": { "get": { "operationId": "getAllCanvases", "summary": "Get All Canvases", "description": "Retrieves all canvases with pagination support and filtering options.\n\nPass `managedUserId` (Widgetic's id for one of your managed users) or `managedUserExternalId` (your own\nidentifier for the user) to list only the canvases made for that managed user. Only a partner has managed\nusers, so this needs an active partner API key. The canvases of your other managed users, and your own, are\nleft out. A managed user that is not yours, or does not exist, is answered with 404 and\n`MANAGED_USER_NOT_FOUND`. Called with an editor session, the list is always the session's managed user's.\n", "tags": [ "Canvases" ], "x-resource-path": "canvases", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "page", "schema": { "type": "integer", "minimum": 1, "default": 1 }, "description": "Page number for pagination" }, { "in": "query", "name": "size", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 20 }, "description": "Number of items per page" }, { "in": "query", "name": "sort", "schema": { "type": "string", "default": "created_at:desc" }, "description": "Sort field and direction (e.g., \"created_at:desc\")" }, { "in": "query", "name": "createdAfter", "schema": { "type": "string", "format": "date-time" }, "description": "Filter canvases created after the specified date (ISO 8601 format)" }, { "in": "query", "name": "createdBefore", "schema": { "type": "string", "format": "date-time" }, "description": "Filter canvases created before the specified date (ISO 8601 format)" }, { "in": "query", "name": "updatedAfter", "schema": { "type": "string", "format": "date-time" }, "description": "Filter canvases updated after the specified date (ISO 8601 format)" }, { "in": "query", "name": "updatedBefore", "schema": { "type": "string", "format": "date-time" }, "description": "Filter canvases updated before the specified date (ISO 8601 format)" }, { "in": "query", "name": "managedUserId", "schema": { "type": "string", "format": "uuid" }, "description": "List only the canvases made for this managed user (Widgetic's id for the user). Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both." }, { "in": "query", "name": "managedUserExternalId", "schema": { "type": "string", "maxLength": 255 }, "description": "List only the canvases made for the managed user you registered with this `externalId` (your own identifier for the user). Partners only. Send this or `managedUserId`, not both." } ], "responses": { "200": { "description": "List of canvases retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAllCanvasesResponse" } } } }, "400": { "description": "A parameter is not valid (for example a `managedUserId` that is not a UUID, or both `managedUserId` and `managedUserExternalId`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user named by `managedUserId` or `managedUserExternalId` is not one of yours (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CanvasesApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst canvasesApi = new CanvasesApi(config);\n\ntry {\n const { data: list } = await canvasesApi.getAllCanvases({\n page: 1,\n size: 20\n });\n console.log(`Found ${list.total} canvases`);\n} catch (error) {\n console.error('Failed to fetch canvases:', error);\n}\n" } ] }, "post": { "operationId": "createCanvas", "summary": "Create Canvas", "description": "Creates a new canvas with the specified properties.\n\nTo make the canvas for one of your managed users, send `managedUserId` or `managedUserExternalId`. Only a\npartner has managed users, so this needs an active partner API key. The canvas stays in your account and is\nyours to edit; the tag lets you list one user's canvases with `getAllCanvases`. The managed user must be\nyours and active: one that is not yours, or does not exist, is answered with 404 and\n`MANAGED_USER_NOT_FOUND`, and one that is switched off with 409 and `MANAGED_USER_INACTIVE`. The tag is set\nhere and does not change afterwards. Called with an editor session, the canvas is always made for the\nsession's managed user.\n", "tags": [ "Canvases" ], "x-resource-path": "canvases", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateCanvasRequest" } } } }, "responses": { "201": { "description": "Canvas created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CanvasResponse" } } } }, "400": { "description": "Invalid input (for example a `managedUserId` that is not a UUID, or both `managedUserId` and `managedUserExternalId`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "The managed user named by `managedUserId` or `managedUserExternalId` is not one of yours (`MANAGED_USER_NOT_FOUND`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The managed user is switched off, so nothing new can be made for it (`MANAGED_USER_INACTIVE`).", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CanvasesApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst canvasesApi = new CanvasesApi(config);\n\ntry {\n const canvas = await canvasesApi.createCanvas({\n createCanvasRequest: {\n persistenceKey: \"canvas_xyz123\",\n canvasContent: { version: 1, elements: [], settings: {} }\n }\n });\n console.log('Created canvas:', canvas);\n} catch (error) {\n console.error('Failed to create canvas:', error);\n}\n" } ] } }, "/canvases/{id}": { "get": { "operationId": "getCanvas", "summary": "Get Canvas", "description": "Retrieves a specific canvas by ID.", "tags": [ "Canvases" ], "x-resource-path": "canvases", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the canvas" } ], "responses": { "200": { "description": "Canvas retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CanvasResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Canvas not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "updateCanvas", "summary": "Update Canvas", "description": "Updates an existing canvas with the specified properties.", "tags": [ "Canvases" ], "x-resource-path": "canvases", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the canvas to update" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateCanvasRequest" } } } }, "responses": { "200": { "description": "Canvas updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CanvasResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Canvas not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CanvasesApi } from '@widgetic/api-sdk-ts';\n\nconst config = new Configuration({\n apiKey: 'YOUR_API_KEY'\n});\n\nconst canvasesApi = new CanvasesApi(config);\n\ntry {\n const canvas = await canvasesApi.updateCanvas({\n id: \"123e4567-e89b-12d3-a456-426614174000\",\n updateCanvasRequest: {\n persistenceKey: \"updated_canvas_xyz123\",\n canvasContent: { version: 2, elements: [{\"id\": \"elem1\"}], settings: {\"theme\": \"dark\"} }\n }\n });\n console.log('Updated canvas:', canvas);\n} catch (error) {\n console.error('Failed to update canvas:', error);\n}\n" } ] }, "delete": { "operationId": "deleteCanvas", "summary": "Delete Canvas", "description": "Deletes a canvas together with its widget.\n\nCalled with an editor session, only a canvas whose widget was made for the session's managed user can be\ndeleted; one that holds somebody else's widget is refused with 409 and `CANVAS_HAS_OTHER_WIDGETS`, and\nnothing is deleted. Delete such a canvas with your API key.\n", "tags": [ "Canvases" ], "x-resource-path": "canvases", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "ID of the canvas" } ], "responses": { "200": { "description": "Canvas deleted successfully. `data` is the canvas as it was when it was removed.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CanvasResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Canvas not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The widget on the canvas could not be deleted (`WIDGET_DELETE_FAILED`), or an editor session tried to delete a canvas that holds somebody else's widget (`CANVAS_HAS_OTHER_WIDGETS`). The canvas is left intact.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/brand-kit": { "get": { "operationId": "getBrandKit", "summary": "The Brand Kit of the current workspace", "description": "The colors, fonts, icons, corner radius and style notes every widget made by this account is generated with. An account that never saved a kit gets Widgetic's default one (`isDefault` is true). A partner account's kit is the default for everything its keys create, and a key reads and changes the kit of the account it belongs to; there is no kit per managed user.", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" }, "description": "An organisation's kit; omit for the caller's current workspace." } ], "responses": { "200": { "description": "The kit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "putBrandKit", "summary": "Save Brand Kit tokens", "description": "Replaces the colors, fonts, text styles, spacing and notes of the kit with the ones sent, so text styles left out of the body are removed. To change one thing, use PATCH.", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PutBrandKitRequest" } } } }, "responses": { "200": { "description": "The saved kit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "400": { "description": "validation_error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member or not_allowed_to_edit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "brand_kit_version_conflict", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "patch": { "operationId": "patchBrandKit", "summary": "Change part of the Brand Kit", "description": "Changes only what is sent: the colors, a font role, the text styles, a spacing step, one corner radius (0 for square corners) or the style notes, and keeps the rest of the saved kit, text styles included. An account that never saved a kit starts from Widgetic's default one. The response lists what is worth fixing in `warnings`.", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PatchBrandKitRequest" } } } }, "responses": { "200": { "description": "The saved kit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "400": { "description": "validation_error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member or not_allowed_to_edit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "brand_kit_version_conflict", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteBrandKit", "summary": "Reset the Brand Kit to the default", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The default kit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member or not_allowed_to_edit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/brand-kit/fonts": { "post": { "operationId": "postBrandKitFont", "summary": "Upload a font file to the Brand Kit", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "required": [ "file", "family", "weight" ], "properties": { "file": { "type": "string", "format": "binary" }, "family": { "type": "string" }, "weight": { "type": "integer" }, "style": { "type": "string", "enum": [ "normal", "italic" ] } } } } } }, "responses": { "201": { "description": "The kit with the new font", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "400": { "description": "validation_error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member or not_allowed_to_edit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "font_variant_exists", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "413": { "description": "file_too_large", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "415": { "description": "unsupported_font_type", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "brand_kit_limit_reached", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/brand-kit/icons": { "post": { "operationId": "postBrandKitIcon", "summary": "Add a named SVG icon to the Brand Kit", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PostBrandKitIconRequest" } } } }, "responses": { "201": { "description": "The kit with the new icon", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "400": { "description": "validation_error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member or not_allowed_to_edit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "icon_name_taken", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "svg_rejected", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "brand_kit_limit_reached", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/brand-kit/assets/{assetId}": { "patch": { "operationId": "patchBrandKitAsset", "summary": "Rename an icon or relabel a font variant", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "assetId", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PatchBrandKitAssetRequest" } } } }, "responses": { "200": { "description": "The updated kit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "400": { "description": "validation_error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member or not_allowed_to_edit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "asset_not_found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "font_variant_exists or icon_name_taken", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteBrandKitAsset", "summary": "Remove a font or icon from the Brand Kit", "tags": [ "Brand Kit" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "assetId", "required": true, "schema": { "type": "string", "format": "uuid" } }, { "in": "query", "name": "organizationId", "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "The kit without the asset", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BrandKitViewResponse" } } } }, "401": { "description": "Not authenticated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "not_a_member or not_allowed_to_edit", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "asset_not_found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "brand_kit_unavailable", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/compositions/{id}/adapters/ai-answers/knowledge": { "get": { "operationId": "getAiAnswersKnowledge", "summary": "See the documents a widget's AI answers from", "description": "The `ai-answers` adapter lets a widget answer a visitor's question with text an AI model writes from documents the\nwidget's owner provides. This lists those documents, and how much room is left for more: `totals` carries the widget's\nlimits next to what it uses.\n\nThe list never contains what a document says, only which documents there are: their title, size and state. A\n`processing` document is not used to answer questions yet (or an add of it was interrupted: remove it and add it\nagain).\n\nAdd a document with `addAiAnswersKnowledgeDocument`; remove one with `removeAiAnswersKnowledgeDocument`.\n\nThe caller must be allowed to see the widget: its owner, a partner for a customer it manages, or a Widgetic\nadministrator. An API key needs the `content:read` scope.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The widget (composition) whose documents to list" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The documents of the widget and its totals", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AiAnswersKnowledge" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The widget id is not a valid id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The widget belongs to another account, or the API key lacks the `content:read` scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such widget", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The knowledge base cannot be read on this server right now (KNOWLEDGE_UNAVAILABLE)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst compositionsApi = new CompositionsApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: { documents, totals } } = await compositionsApi.getAiAnswersKnowledge({ id: compositionId });\nconsole.log(`${totals.documents} of ${totals.maxDocuments} documents`, documents.map((document) => document.title));\n" } ] } }, "/compositions/{id}/adapters/ai-answers/knowledge/documents": { "post": { "operationId": "addAiAnswersKnowledgeDocument", "summary": "Add a document for a widget's AI to answer from", "description": "Gives the widget's AI a document to answer visitors' questions from. Send the title and the plain text. The call\nreturns once the document is ready to be used, which takes a few seconds, longer for a long text.\n\n**How it is used.** The text is cleaned, cut into short passages and each passage is turned into numbers (an\nembedding) so the widget can find the passages nearest to a question. When a visitor asks, the nearest passages and\nthe question are shown to an AI model, which writes the answer from them and from nothing else; if the documents\nsay nothing about the question the visitor is told so, and the owner is not charged for that question. The titles of\nthe documents an answer used are shown to the visitor as its sources.\n\n**What leaves Widgetic.** The text of a document is sent to OpenAI to be embedded when it is added, and the\npassages used for a question are sent to the AI model that writes the answer. Say so in your privacy policy.\n\n**Treat every document as public.** An answer can quote or paraphrase anything a document says, to any visitor of\nthe widget. Do not add passwords, keys, personal data or anything that must stay private.\n\n**Limits.** A widget holds up to 20 documents, each up to 100000 characters, and up to 400000 characters in all\n(`getAiAnswersKnowledge` reports the current numbers). This call takes text. To add a text file or a picture of a\ndocument (a PDF too, once PDFs are read) without turning it into text yourself, use `addAiAnswersKnowledgeFile`. Adding a document costs no\ncredits. The same text cannot be added twice to one widget (409).\n\nThe caller must be allowed to change the widget. An API key needs the `content:write` scope. Adds are limited to ten\nin ten minutes per person. A partner's customer in an editor session is one person of its own: its adds are not\ncounted with the partner's other customers'.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The widget (composition) to add the document to" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddAiAnswersKnowledgeDocumentRequest" } } } }, "responses": { "201": { "description": "The document was added and is ready to be used", "content": { "application/json": { "schema": { "title": "AiAnswersKnowledgeDocumentResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AiAnswersKnowledgeDocument" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The widget id is not valid, the body is not exactly `title` and `text`, or the title or the text is missing or too long (KNOWLEDGE_TITLE_REQUIRED, KNOWLEDGE_TITLE_TOO_LONG, KNOWLEDGE_TEXT_REQUIRED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The widget belongs to another account, or the API key lacks the `content:write` scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such widget", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The same text is already in this widget, or the widget already holds the most documents it can (KNOWLEDGE_DUPLICATE_DOCUMENT, KNOWLEDGE_LIMIT_DOCUMENTS)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "413": { "description": "The text is longer than a document may be, or would take the widget past the most text it can hold in all (KNOWLEDGE_TEXT_TOO_LONG, KNOWLEDGE_LIMIT_TOTAL_TEXT). Nothing was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many documents added in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "502": { "description": "The document could not be processed or saved (KNOWLEDGE_NOT_COMPLETED). Nothing was saved: try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The knowledge base is not available right now, or the service is busy (KNOWLEDGE_UNAVAILABLE, KNOWLEDGE_BUSY). Nothing was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst compositionsApi = new CompositionsApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: document } = await compositionsApi.addAiAnswersKnowledgeDocument({\n id: compositionId,\n addAiAnswersKnowledgeDocumentRequest: {\n title: 'Shipping and returns',\n text: 'Orders ship within 2 business days. Returns are accepted for 30 days after delivery.',\n },\n});\nconsole.log(document.id, document.status);\n" } ] } }, "/compositions/{id}/adapters/ai-answers/knowledge/documents/file": { "post": { "operationId": "addAiAnswersKnowledgeFile", "summary": "Add a text file or a picture of a document (a PDF once PDFs are read) for a widget's AI to answer from", "description": "Gives the widget's AI a document made from a file. Send a `multipart/form-data` request with the file in the field\nnamed `file` and, if you like, a `title`. The file is turned into text and then added exactly as\n`addAiAnswersKnowledgeDocument` adds text: the same cleaning, the same limits, the same refusal of a copy of a\ndocument the widget already has. The call returns once the document is ready to be used, which takes a few seconds\n(a PDF is read first, so it takes longer).\n\n**PDFs are not read yet.** For now a PDF is refused with 415, in a sentence that says what to do instead: paste the\ntext, upload it as a text file, or upload its pages as pictures. What this description says about a PDF is what will\nhold from the day PDFs are read.\n\n**Which files.**\n- A **PDF** (not read yet, see above), up to 10 MB and 300 pages. Its text is read and its paragraphs are put back\n together. A PDF that is only pictures of pages (a scan) has no text to read: upload the pages as pictures instead.\n A PDF locked with a password is refused.\n- A **text file**: `.txt`, `.text`, `.md`, `.markdown` or `.csv`, in UTF-8, UTF-16 or Windows-1252.\n- A **picture of a document**: PNG, JPEG or WebP, up to 4 MB. The text in it is read with the same text recognition\n as the `ocr` adapter.\n- Word and other office files are not read yet: save the file as a PDF and upload that.\n\nWhat a file is comes from what is in it, not from its name or the type it is sent as. A file that is none of these is\nrefused with 415.\n\n**The title.** Left out, the name of the file (without its extension) is the title. Visitors see the title as the\nsource of an answer, so send one that means something to them.\n\n**The file is not kept.** Only its text, cut into passages, is kept, and `getAiAnswersKnowledge` never returns it.\n\n**What leaves Widgetic.** As for text, the words of the document are sent to OpenAI to be embedded when it is added,\nand the passages used for a question are sent to the AI model that writes the answer. A picture is also sent to the\ntext recognition service. A PDF is read on Widgetic's own servers and is not sent anywhere to be read. Say so in your\nprivacy policy.\n\n**Treat every document as public.** An answer can quote or paraphrase anything a document says, to any visitor of\nthe widget. Do not add passwords, keys, personal data or anything that must stay private.\n\n**Limits.** The widget's limits are those of `addAiAnswersKnowledgeDocument` (up to 20 documents, each up to 100000\ncharacters of text, and up to 400000 characters in all; `getAiAnswersKnowledge` reports the current numbers), and\nthe file is at most 10 MB. Adding a document costs no credits. The same text cannot be added twice to one widget\n(409).\n\nThe caller must be allowed to change the widget. An API key needs the `content:write` scope. Adds, from text or from\na file, share one limit of ten in ten minutes per person. A partner's customer in an editor session is one person\nof its own: its adds are not counted with the partner's other customers'.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The widget (composition) to add the document to" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "multipart/form-data": { "schema": { "type": "object", "required": [ "file" ], "additionalProperties": false, "properties": { "file": { "type": "string", "format": "binary", "description": "The file, which is a text file or a picture of a document (a PDF is not read yet). One file only" }, "title": { "type": "string", "maxLength": 120, "description": "What the document is called, on one line. Visitors see it as the source of an answer. Left out, the name of the file stands in for it", "example": "Shipping and returns" } } } } } }, "responses": { "201": { "description": "The document was added and is ready to be used", "content": { "application/json": { "schema": { "title": "AiAnswersKnowledgeDocumentResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AiAnswersKnowledgeDocument" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The widget id is not valid, no file was sent, more than one was, it was not in the field named `file`, the form could not be read, the form has a field other than `file` and `title`, or the title is too long (KNOWLEDGE_FILE_REQUIRED, KNOWLEDGE_TITLE_REQUIRED, KNOWLEDGE_TITLE_TOO_LONG, KNOWLEDGE_TEXT_REQUIRED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The widget belongs to another account, or the API key lacks the `content:write` scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such widget", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The same text is already in this widget, or the widget already holds the most documents it can (KNOWLEDGE_DUPLICATE_DOCUMENT, KNOWLEDGE_LIMIT_DOCUMENTS)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "413": { "description": "The file is larger than 10 MB, a PDF has more than 300 pages, a picture is larger than 4 MB, or the text of the file is longer than a document may be or would take the widget past the most text it can hold in all (KNOWLEDGE_FILE_TOO_LARGE, KNOWLEDGE_TEXT_TOO_LONG, KNOWLEDGE_LIMIT_TOTAL_TEXT). Nothing was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "415": { "description": "The file is not a text file or a PNG, JPEG or WebP picture, or it is a PDF or a Word or other office file, which are not read yet (KNOWLEDGE_FILE_TYPE_UNSUPPORTED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The file is of a kind that is read but this one cannot be: a PDF that is damaged, locked with a password or too slow to read, or a PDF or a picture with no text in it (KNOWLEDGE_FILE_UNREADABLE, KNOWLEDGE_FILE_NO_TEXT)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many documents added in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "502": { "description": "The document could not be processed or saved (KNOWLEDGE_NOT_COMPLETED). Nothing was saved: try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The knowledge base is not available right now, or the service is busy (KNOWLEDGE_UNAVAILABLE, KNOWLEDGE_BUSY). Nothing was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { openAsBlob } from 'node:fs';\nimport { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst compositionsApi = new CompositionsApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: document } = await compositionsApi.addAiAnswersKnowledgeFile({\n id: compositionId,\n file: await openAsBlob('shipping-and-returns.pdf'),\n title: 'Shipping and returns',\n});\nconsole.log(document.id, document.status);\n" } ] } }, "/compositions/{id}/adapters/ai-answers/knowledge/documents/{documentId}": { "delete": { "operationId": "removeAiAnswersKnowledgeDocument", "summary": "Remove a document from a widget's knowledge base", "description": "Removes one document and its passages: the widget's AI stops answering from it at once. Take the `documentId` from\n`getAiAnswersKnowledge`.\n\nThe caller must be allowed to change the widget. An API key needs the `content:write` scope.\n", "tags": [ "Compositions" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The widget (composition) the document is in" }, { "in": "path", "name": "documentId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The document to remove" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The document was removed", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AiAnswersKnowledgeRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A path value is not a valid id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The widget belongs to another account, or the API key lacks the `content:write` scope", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such widget, or no such document in it (KNOWLEDGE_DOCUMENT_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "The knowledge base is not available right now (KNOWLEDGE_UNAVAILABLE). Nothing was changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, CompositionsApi } from '@widgetic/api-sdk-ts';\n\nconst compositionsApi = new CompositionsApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nawait compositionsApi.removeAiAnswersKnowledgeDocument({ id: compositionId, documentId });\n" } ] } }, "/users/{userId}/adapter-connections": { "get": { "operationId": "getUserAdapterConnections", "summary": "See which adapter keys an account has connected", "description": "Widget adapters are capabilities a widget can use, and some of them act through a service the owner has an\naccount with: an adapter that sends email needs the owner's email provider key, one that sends texts needs the\nowner's SMS provider key. This lists every key an adapter takes from an owner and whether this account has\nconnected it, so a settings page can show what is missing.\n\nAn empty list means no adapter takes a key from an owner at the moment. The list never contains a key: only\nwhether one is connected and when it was last set.\n\nConnect a key with `setUserAdapterConnection`; take it away with `removeUserAdapterConnection`. The widgets of\ncustomers a partner manages use the partner's keys instead (`getPartnerAdapterConnections`).\n\nThe caller must be the account itself (an API key of that account works, with the `account:read` scope), or a\nWidgetic administrator.\n", "tags": [ "Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The account whose adapter keys to list. For your own, your own user id" } ], "responses": { "200": { "description": "Every key an adapter takes from an owner, connected or not", "content": { "application/json": { "schema": { "title": "AdapterConnectionListResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/AdapterConnection" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The account id is not a valid id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The keys belong to another account", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be read on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, UsersApi } from '@widgetic/api-sdk-ts';\n\nconst usersApi = new UsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: connections } = await usersApi.getUserAdapterConnections({ userId });\nconst missing = connections.filter((connection) => !connection.connected);\nconsole.log(missing.map((connection) => connection.label));\n" } ] } }, "/users/{userId}/adapter-connections/{adapterId}/{credentialKey}": { "put": { "operationId": "setUserAdapterConnection", "summary": "Connect an adapter key to an account", "description": "Gives an adapter the key it needs to act through a service you have an account with, for the widgets you made.\nTake the `adapterId` and `credentialKey` from `getUserAdapterConnections`. Saving a key that is already\nconnected replaces it.\n\n**What Widgetic does with it.** The key is stored encrypted, bound to this account, this adapter and this\ncredential, so that a stored value cannot be moved to another. It is never returned, never logged and never\nshown to a visitor of a widget. A server of Widgetic opens it for the one call a widget makes through the\nadapter, uses it to call the provider on your behalf, and discards it. To cut that off, remove the key here, or\nrevoke it with the provider.\n\n**What is checked.** That the adapter exists and takes this credential, that an owner may keep it (some are\nfor a partner only) and that the text is one line of at most 2048 characters. Whether the provider accepts\nthe key is not checked here: it shows the first time a widget uses it, and the widget tells its owner.\n\n**An address that has to be confirmed.** Some credentials are not a key but the email address Widgetic sends a\nwidget's messages to (`confirmation: email_code` in `getUserAdapterConnections`). Saving one checks that it is one\nemail address and emails a six-digit code to it; the answer says `awaitingConfirmation: true`, and nothing is sent\nto the address until the code is given back with `confirmUserAdapterConnection`. Saving the same address again\nbefore it is confirmed emails a new code (not sooner than a minute after the last); saving the address that is\nalready confirmed changes nothing. If the code cannot be emailed, nothing is saved.\n\nA widget whose adapter has no key connected, or whose address is not confirmed yet, is not charged and does not\nrun that adapter: its visitors are told the feature is unavailable, and the owner is told once a day what to do.\n\nThis needs an API key with full access. The caller must be the account itself or a Widgetic administrator. A\nretry is harmless: saving the same key twice only refreshes when it was set.\n", "tags": [ "Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The account that keeps the key. For your own, your own user id" }, { "in": "path", "name": "adapterId", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The adapter the key is for" }, { "in": "path", "name": "credentialKey", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The key's name within the adapter" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetAdapterConnectionRequest" } } } }, "responses": { "200": { "description": "The key was saved", "content": { "application/json": { "schema": { "title": "AdapterConnectionResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AdapterConnection" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A path value or the body is malformed. The body takes exactly one field, `credential`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The key belongs to another account, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such adapter, the adapter has no such credential, an owner may not keep it, or the account does not exist (ADAPTER_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_FOR_THIS_ACCOUNT, HOLDER_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The credential is not one line of text of at most 2048 characters (CREDENTIAL_VALUE_INVALID), is not one email address where one is needed (CREDENTIAL_ADDRESS_INVALID), or the email provider refused the address a code was to be emailed to (CONFIRMATION_ADDRESS_REFUSED). Nothing was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time (try again after the Retry-After seconds), or too many codes were emailed to that address or for that account (CONFIRMATION_TOO_SOON, CONFIRMATION_LIMIT_REACHED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be saved on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE), or the code could not be emailed (CONFIRMATION_NOT_SENT). Nothing was changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, UsersApi } from '@widgetic/api-sdk-ts';\n\nconst usersApi = new UsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: connection } = await usersApi.setUserAdapterConnection({\n userId,\n adapterId: 'email',\n credentialKey: 'resendApiKey',\n setAdapterConnectionRequest: { credential: 'YOUR_PROVIDER_KEY' },\n});\nconsole.log(connection.connected, connection.updatedAt);\n\n// An address a widget's messages are emailed to: a code is emailed to it, and it is used once the code is given back.\nconst { data: address } = await usersApi.setUserAdapterConnection({\n userId,\n adapterId: 'email',\n credentialKey: 'recipient',\n setAdapterConnectionRequest: { credential: 'owner@example.com' },\n});\nconsole.log(address.awaitingConfirmation);\n" } ] }, "delete": { "operationId": "removeUserAdapterConnection", "summary": "Remove an adapter key from an account", "description": "Removes a key an adapter was given. The adapter stops working for the widgets that need it: their visitors are\ntold the feature is unavailable. Nothing else of the widgets changes, and connecting a key again brings them\nback.\n\nRemoving a key that is not connected answers 200 with `removed: false`: the state asked for is the state it is\nin. A key of an adapter that has since been retired from the catalog can still be removed.\n\nThis needs an API key with full access. The caller must be the account itself or a Widgetic administrator.\n", "tags": [ "Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The account that keeps the key. For your own, your own user id" }, { "in": "path", "name": "adapterId", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The adapter the key is for" }, { "in": "path", "name": "credentialKey", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The key's name within the adapter" } ], "responses": { "200": { "description": "The key is not connected any more", "content": { "application/json": { "schema": { "title": "AdapterConnectionRemovalResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AdapterConnectionRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A path value is malformed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The key belongs to another account, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be changed on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE). Nothing was changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, UsersApi } from '@widgetic/api-sdk-ts';\n\nconst usersApi = new UsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: { removed } } = await usersApi.removeUserAdapterConnection({\n userId,\n adapterId: 'email',\n credentialKey: 'resendApiKey',\n});\n" } ] } }, "/users/{userId}/adapter-connections/{adapterId}/{credentialKey}/confirm": { "post": { "operationId": "confirmUserAdapterConnection", "summary": "Confirm an adapter address with the code that was emailed to it", "description": "Some credentials are an email address Widgetic sends a widget's messages to (`confirmation: email_code` in\n`getUserAdapterConnections`). Saving one with `setUserAdapterConnection` emails a six-digit code to it; this gives\nthe code back. Only then is the address used: until it is confirmed, the widgets that need it are not charged and\ntheir visitors are told the feature is unavailable.\n\nThe code works for 30 minutes and for five wrong tries. After that, save the address again and a new code is\nemailed (not sooner than a minute after the last one). A code that is not made of digits is refused without\ncounting as a try.\n\nConfirming an address that is already confirmed answers 200 with the same state, so a retry of a request that\nwent through is harmless. Saving a different address, or the same one before it was confirmed, starts again.\n\nThis needs an API key with full access. The caller must be the account itself or a Widgetic administrator.\n", "tags": [ "Users" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "userId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The account that keeps the address. For your own, your own user id" }, { "in": "path", "name": "adapterId", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The adapter the address is for" }, { "in": "path", "name": "credentialKey", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The credential's name within the adapter" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfirmAdapterConnectionRequest" } } } }, "responses": { "200": { "description": "The address is confirmed (or was already)", "content": { "application/json": { "schema": { "title": "AdapterConnectionResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AdapterConnection" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A path value or the body is malformed. The body takes exactly one field, `code`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The address belongs to another account, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such adapter or credential, an owner may not keep it, the credential needs no confirmation, or nothing is connected under that name (ADAPTER_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_FOR_THIS_ACCOUNT, CONFIRMATION_NOT_NEEDED, CREDENTIAL_NOT_CONNECTED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "No code is waiting for the address (CONFIRMATION_NO_CODE_WAITING), or another attempt is being checked, or the address was saved again while this one was checked (CONFIRMATION_BUSY). Save the address again, or retry", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The code is not made of digits (CONFIRMATION_CODE_INVALID), is not the one emailed (CONFIRMATION_CODE_WRONG; it counts as a try) or is too old (CONFIRMATION_CODE_EXPIRED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time (try again after the Retry-After seconds), or five wrong codes were given and the code is dead (CONFIRMATION_TOO_MANY_ATTEMPTS): save the address again for a new one", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be changed on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE). Nothing was changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, UsersApi } from '@widgetic/api-sdk-ts';\n\nconst usersApi = new UsersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// After setUserAdapterConnection emailed a code to the address:\nconst { data: connection } = await usersApi.confirmUserAdapterConnection({\n userId,\n adapterId: 'email',\n credentialKey: 'recipient',\n confirmAdapterConnectionRequest: { code: '123456' },\n});\nconsole.log(connection.awaitingConfirmation, connection.confirmedAt);\n" } ] } }, "/partners/{partnerId}/adapter-connections": { "get": { "operationId": "getPartnerAdapterConnections", "summary": "See which adapter keys a partner has connected", "description": "Widget adapters are capabilities a widget can use, and some of them act through a service the account that\nmade the widget has with a provider: an adapter that sends email needs an email provider key, one that sends\ntexts needs an SMS provider key. For the widgets of the customers a partner manages, those keys are the\npartner's. This lists every key an adapter takes from a partner and whether the partner has connected it.\n\nAn empty list means no adapter takes a key from a partner at the moment. The list never contains a key: only\nwhether one is connected and when it was last set.\n\nConnect a key with `setPartnerAdapterConnection`; take it away with `removePartnerAdapterConnection`. A managed\ncustomer never holds a key: the widgets of a managed customer use the partner's, and never the keys the person\nwho administers the partner has connected to their own account.\n\nThe caller must be the person who administers the partner (an API key of that account works, with the\n`partner:read` scope), or a Widgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner whose adapter keys to list" } ], "responses": { "200": { "description": "Every key an adapter takes from a partner, connected or not", "content": { "application/json": { "schema": { "title": "AdapterConnectionListResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/AdapterConnection" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "The partner id is not a valid id", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many requests. Wait a minute.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be read on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: connections } = await partnersApi.getPartnerAdapterConnections({ partnerId });\nconst missing = connections.filter((connection) => !connection.connected);\nconsole.log(missing.map((connection) => connection.label));\n" } ] } }, "/partners/{partnerId}/adapter-connections/{adapterId}/{credentialKey}": { "put": { "operationId": "setPartnerAdapterConnection", "summary": "Connect an adapter key to a partner", "description": "Gives an adapter the key it needs to act through a service the partner has an account with, for the widgets of\nthe customers the partner manages. Take the `adapterId` and `credentialKey` from\n`getPartnerAdapterConnections`. Saving a key that is already connected replaces it.\n\n**What Widgetic does with it.** The key is stored encrypted, bound to this partner, this adapter and this\ncredential, so that a stored value cannot be moved to another. It is never returned, never logged and never\nshown to a visitor of a widget or to your customers. A server of Widgetic opens it for the one call a widget\nmakes through the adapter, uses it to call the provider on the partner's behalf, and discards it. To cut that\noff, remove the key here, or revoke it with the provider.\n\n**What is checked.** That the adapter exists and takes this credential, that a partner may keep it (some are\nfor an owner only) and that the text is one line of at most 2048 characters. Whether the provider accepts the\nkey is not checked here: it shows the first time a widget uses it.\n\n**An address that has to be confirmed.** Some credentials are not a key but the email address Widgetic sends a\nwidget's messages to (`confirmation: email_code` in `getPartnerAdapterConnections`). Saving one checks that it is\none email address and emails a six-digit code to it; the answer says `awaitingConfirmation: true`, and nothing is\nsent to the address until the code is given back with `confirmPartnerAdapterConnection`. Saving the same address\nagain before it is confirmed emails a new code (not sooner than a minute after the last); saving the address that\nis already confirmed changes nothing. If the code cannot be emailed, nothing is saved.\n\nA widget whose adapter has no key connected, or whose address is not confirmed yet, is not charged and does not\nrun that adapter: its visitors are told the feature is unavailable, and the partner is told once a day what to do.\n\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator. A retry is harmless: saving the same key twice only refreshes when it was set.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner that keeps the key" }, { "in": "path", "name": "adapterId", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The adapter the key is for" }, { "in": "path", "name": "credentialKey", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The key's name within the adapter" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetAdapterConnectionRequest" } } } }, "responses": { "200": { "description": "The key was saved", "content": { "application/json": { "schema": { "title": "AdapterConnectionResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AdapterConnection" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A path value or the body is malformed. The body takes exactly one field, `credential`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such adapter, the adapter has no such credential, a partner may not keep it, or the partner does not exist (ADAPTER_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_FOR_THIS_ACCOUNT, HOLDER_NOT_FOUND)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The credential is not one line of text of at most 2048 characters (CREDENTIAL_VALUE_INVALID), is not one email address where one is needed (CREDENTIAL_ADDRESS_INVALID), or the email provider refused the address a code was to be emailed to (CONFIRMATION_ADDRESS_REFUSED). Nothing was saved", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time (try again after the Retry-After seconds), or too many codes were emailed to that address or for that account (CONFIRMATION_TOO_SOON, CONFIRMATION_LIMIT_REACHED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be saved on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE), or the code could not be emailed (CONFIRMATION_NOT_SENT). Nothing was changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: connection } = await partnersApi.setPartnerAdapterConnection({\n partnerId,\n adapterId: 'email',\n credentialKey: 'resendApiKey',\n setAdapterConnectionRequest: { credential: 'YOUR_PROVIDER_KEY' },\n});\nconsole.log(connection.connected, connection.updatedAt);\n\n// An address a widget's messages are emailed to: a code is emailed to it, and it is used once the code is given back.\nconst { data: address } = await partnersApi.setPartnerAdapterConnection({\n partnerId,\n adapterId: 'email',\n credentialKey: 'recipient',\n setAdapterConnectionRequest: { credential: 'owner@example.com' },\n});\nconsole.log(address.awaitingConfirmation);\n" } ] }, "delete": { "operationId": "removePartnerAdapterConnection", "summary": "Remove an adapter key from a partner", "description": "Removes a key an adapter was given. The adapter stops working for the widgets of the partner's customers that\nneed it: their visitors are told the feature is unavailable. Nothing else of the widgets changes, and connecting\na key again brings them back.\n\nRemoving a key that is not connected answers 200 with `removed: false`: the state asked for is the state it is\nin. A key of an adapter that has since been retired from the catalog can still be removed.\n\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner that keeps the key" }, { "in": "path", "name": "adapterId", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The adapter the key is for" }, { "in": "path", "name": "credentialKey", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The key's name within the adapter" } ], "responses": { "200": { "description": "The key is not connected any more", "content": { "application/json": { "schema": { "title": "AdapterConnectionRemovalResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AdapterConnectionRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A path value is malformed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time. Try again after the Retry-After seconds.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be changed on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE). Nothing was changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\nconst { data: { removed } } = await partnersApi.removePartnerAdapterConnection({\n partnerId,\n adapterId: 'email',\n credentialKey: 'resendApiKey',\n});\n" } ] } }, "/partners/{partnerId}/adapter-connections/{adapterId}/{credentialKey}/confirm": { "post": { "operationId": "confirmPartnerAdapterConnection", "summary": "Confirm a partner's adapter address with the code that was emailed to it", "description": "Some credentials are an email address Widgetic sends a widget's messages to (`confirmation: email_code` in\n`getPartnerAdapterConnections`). Saving one with `setPartnerAdapterConnection` emails a six-digit code to it; this\ngives the code back. Only then is the address used: until it is confirmed, the widgets of the partner's customers\nthat need it are not charged and their visitors are told the feature is unavailable.\n\nThe code works for 30 minutes and for five wrong tries. After that, save the address again and a new code is\nemailed (not sooner than a minute after the last one). A code that is not made of digits is refused without\ncounting as a try.\n\nConfirming an address that is already confirmed answers 200 with the same state, so a retry of a request that\nwent through is harmless. Saving a different address, or the same one before it was confirmed, starts again.\n\nThis needs an API key with full access. The caller must be the person who administers the partner, or a\nWidgetic administrator.\n", "tags": [ "Partners" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "partner", "x-visibility": "public", "parameters": [ { "in": "path", "name": "partnerId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "The partner that keeps the address" }, { "in": "path", "name": "adapterId", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The adapter the address is for" }, { "in": "path", "name": "credentialKey", "required": true, "schema": { "type": "string", "maxLength": 40 }, "description": "The credential's name within the adapter" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfirmAdapterConnectionRequest" } } } }, "responses": { "200": { "description": "The address is confirmed (or was already)", "content": { "application/json": { "schema": { "title": "AdapterConnectionResponse", "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/AdapterConnection" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "400": { "description": "A path value or the body is malformed. The body takes exactly one field, `code`", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "The API key is missing or invalid", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "The caller does not administer this partner, or the API key has not full access", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "There is no such adapter or credential, a partner may not keep it, the credential needs no confirmation, or nothing is connected under that name (ADAPTER_NOT_FOUND, CREDENTIAL_NOT_FOUND, CREDENTIAL_NOT_FOR_THIS_ACCOUNT, CONFIRMATION_NOT_NEEDED, CREDENTIAL_NOT_CONNECTED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "No code is waiting for the address (CONFIRMATION_NO_CODE_WAITING), or another attempt is being checked, or the address was saved again while this one was checked (CONFIRMATION_BUSY). Save the address again, or retry", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The code is not made of digits (CONFIRMATION_CODE_INVALID), is not the one emailed (CONFIRMATION_CODE_WRONG; it counts as a try) or is too old (CONFIRMATION_CODE_EXPIRED)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "429": { "description": "Too many changes in a short time (try again after the Retry-After seconds), or five wrong codes were given and the code is dead (CONFIRMATION_TOO_MANY_ATTEMPTS): save the address again for a new one", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Adapter keys cannot be changed on this server right now (ADAPTER_CONNECTIONS_UNAVAILABLE). Nothing was changed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } }, "x-code-samples": [ { "lang": "TypeScript", "label": "TypeScript SDK", "source": "import { Configuration, PartnersApi } from '@widgetic/api-sdk-ts';\n\nconst partnersApi = new PartnersApi(new Configuration({ apiKey: 'YOUR_API_KEY' }));\n\n// After setPartnerAdapterConnection emailed a code to the address:\nconst { data: connection } = await partnersApi.confirmPartnerAdapterConnection({\n partnerId,\n adapterId: 'email',\n credentialKey: 'recipient',\n confirmAdapterConnectionRequest: { code: '123456' },\n});\nconsole.log(connection.awaitingConfirmation, connection.confirmedAt);\n" } ] } }, "/translations/supported-languages": { "get": { "tags": [ "Translations" ], "operationId": "getSupportedLanguages", "summary": "Get supported languages", "description": "Get all the languages a translation experiment can be made in. The list is the same for everybody, so the call needs\nno key and takes no customer header.\n\nThe languages are at `data.data.languages`, one entry for each language code, and the ones that are chosen by default\nat `data.data.preselected`.\n", "x-access-level": "user", "x-visibility": "public", "responses": { "200": { "description": "List of supported languages", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetSupportedLanguagesAnswerResponse" } } }, "x-response-envelope": "nested" }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/translations/language-presets": { "get": { "tags": [ "Translations" ], "operationId": "getLanguagePresets", "summary": "Get language presets for quick selection", "description": "Get the predefined groups of languages (EU, APAC, and so on) that can be chosen in one go. The list is the same for\neverybody, so the call needs no key and takes no customer header.\n\nThe groups are at `data.data.presets`.\n", "x-access-level": "user", "x-visibility": "public", "responses": { "200": { "description": "Language presets retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetLanguagePresetsAnswerResponse" } } }, "x-response-envelope": "nested" }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/translations/{id}": { "get": { "tags": [ "Translations" ], "operationId": "getTranslation", "summary": "Get a specific translation experiment", "description": "Get details of a specific translation experiment. The translation is found by its id, in the workspace it belongs to: you must be a member of that workspace (and, with an API key, the key must belong to it), otherwise the answer is 404.\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it reaches only that customer's translations: one of another customer, or one made for your own account, answers 404 as if it did not exist.\nThe translation is at `data.data`.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" }, "description": "Translation experiment ID" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Translation experiment details", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TranslationAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such translation in a workspace the key belongs to. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a translation of another customer, and for one made for your own account: the same answer as for a translation that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "tags": [ "Translations" ], "operationId": "deleteTranslation", "summary": "Delete a translation experiment", "description": "Delete a translation experiment and all its variants. The translation is found by its id, in the workspace it belongs to: you must be a member of that workspace (and, with an API key, the key must belong to it), otherwise the answer is 404.\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it reaches only that customer's translations: one of another customer, or one made for your own account, answers 404 as if it did not exist.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" }, "description": "Translation experiment ID" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TranslationRevisionRequest" } } } }, "responses": { "200": { "description": "Translation experiment deleted successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteTranslationResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such translation in a workspace the key belongs to. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a translation of another customer, and for one made for your own account: the same answer as for a translation that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The translation changed since `revision` (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`). `details.currentRevision` is the revision to start again from. Read it again and try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/translations/{id}/languages": { "post": { "tags": [ "Translations" ], "operationId": "addLanguagesToTranslation", "summary": "Add new languages to translation experiment", "description": "Add new languages to an existing translation experiment and start translation. The translation is found by its id, in the workspace it belongs to: you must be a member of that workspace (and, with an API key, the key must belong to it), otherwise the answer is 404.\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it reaches only that customer's translations: one of another customer, or one made for your own account, answers 404 as if it did not exist. The copies for the new languages are filed under the same customer, so a customer that is switched off cannot add any (`409` `MANAGED_USER_INACTIVE`).\nThe translation is at `data.data`, and `data.message` says what was done.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" }, "description": "Translation experiment ID" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "languages" ], "properties": { "languages": { "type": "array", "items": { "type": "string" }, "example": [ "es", "fr" ] }, "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." } } } } } }, "responses": { "200": { "description": "Languages added successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddLanguagesToTranslationAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such translation in a workspace the key belongs to. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a translation of another customer, and for one made for your own account: the same answer as for a translation that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The translation changed since `revision` (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`). `details.currentRevision` is the revision to start again from. Read it again and try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/translations/{id}/languages/{languageCode}": { "delete": { "tags": [ "Translations" ], "operationId": "removeLanguageFromTranslation", "summary": "Remove a language from translation experiment", "description": "Remove a specific language from a translation experiment. The translation is found by its id, in the workspace it belongs to: you must be a member of that workspace (and, with an API key, the key must belong to it), otherwise the answer is 404.\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it reaches only that customer's translations: one of another customer, or one made for your own account, answers 404 as if it did not exist.\nThe translation is at `data.data`, and `data.message` says what was done.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" }, "description": "Translation experiment ID" }, { "in": "path", "name": "languageCode", "required": true, "schema": { "type": "string" }, "description": "Language code to remove (e.g., 'es', 'fr')" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TranslationRevisionRequest" } } } }, "responses": { "200": { "description": "Language removed successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RemoveLanguageFromTranslationAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such translation in a workspace the key belongs to. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a translation of another customer, and for one made for your own account: the same answer as for a translation that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The translation changed since `revision` (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`). `details.currentRevision` is the revision to start again from. Read it again and try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/translations/{id}/retranslate": { "post": { "tags": [ "Translations" ], "operationId": "retranslateExperiment", "summary": "Retranslate language variants", "description": "Redo translations for existing language variants. The translation is found by its id, in the workspace it belongs to: you must be a member of that workspace (and, with an API key, the key must belong to it), otherwise the answer is 404.\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it reaches only that customer's translations: one of another customer, or one made for your own account, answers 404 as if it did not exist.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" }, "description": "Translation experiment ID" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "languages": { "type": "array", "items": { "type": "string" }, "description": "Specific languages to retranslate (optional)", "example": [ "es", "fr" ] }, "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." } } } } } }, "responses": { "200": { "description": "Retranslation started successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/RetranslateExperimentResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such translation in a workspace the key belongs to. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a translation of another customer, and for one made for your own account: the same answer as for a translation that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The translation changed since `revision` (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`). `details.currentRevision` is the revision to start again from. Read it again and try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/translations/{id}/status": { "put": { "tags": [ "Translations" ], "operationId": "updateTranslationStatus", "summary": "Update translation experiment status", "description": "Update the status of a translation experiment (active, paused, draft, completed). The translation is found by its id, in the workspace it belongs to: you must be a member of that workspace (and, with an API key, the key must belong to it), otherwise the answer is 404.\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it reaches only that customer's translations: one of another customer, or one made for your own account, answers 404 as if it did not exist.\nThe translation is at `data.data`, and `data.message` says what was done.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" }, "description": "Translation experiment ID" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "status" ], "properties": { "status": { "type": "string", "enum": [ "draft", "active", "paused", "completed" ], "description": "New status for the translation experiment", "example": "active" }, "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." } } } } } }, "responses": { "200": { "description": "Status updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateTranslationStatusAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such translation in a workspace the key belongs to. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a translation of another customer, and for one made for your own account: the same answer as for a translation that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The translation changed since `revision` (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`). `details.currentRevision` is the revision to start again from. Read it again and try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/translations/{id}/analytics": { "get": { "tags": [ "Translations" ], "operationId": "getTranslationAnalytics", "summary": "Get analytics for translation experiment", "description": "Get comparative analytics across all language variants in a translation experiment. The translation is found by its id, in the workspace it belongs to: you must be a member of that workspace (and, with an API key, the key must belong to it), otherwise the answer is 404.\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it reaches only that customer's translations: one of another customer, or one made for your own account, answers 404 as if it did not exist.\nThe figures are at `data.data`.", "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "id", "required": true, "schema": { "type": "string" }, "description": "Translation experiment ID" }, { "in": "query", "name": "period", "schema": { "type": "string", "enum": [ "7d", "30d", "90d", "all_time" ], "default": "30d" }, "description": "Time period for analytics" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Translation experiment analytics", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetTranslationAnalyticsAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such translation in a workspace the key belongs to. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a translation of another customer, and for one made for your own account: the same answer as for a translation that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/organizations/{orgId}/api-keys": { "get": { "operationId": "getOrganizationApiKeys", "summary": "Get Organization API Keys", "description": "Retrieve all API keys for a specific organization (workspace): name, the first characters of the key, when it\nwas made, when it expires, when it was last used, whether it is switched on and what it is limited to\n(`scopes` and `preset`). The secret of a key is never part of the list.\nOnly accessible by organization owners and admins with MANAGE_API_KEYS permission.\n\nA partner's home workspace lists the partner's keys, which start with `wgt_prt_`; every other workspace lists\nkeys that start with `wdg_org_`.\n", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "orgId", "in": "path", "required": true, "description": "Organization ID", "schema": { "type": "string", "format": "uuid" } } ], "responses": { "200": { "description": "Organization API keys retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/OrganizationApiKey" } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to view organization API keys", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createOrganizationApiKey", "summary": "Create Organization API Key", "description": "Create a new API key for a specific organization (workspace) and return its secret in `key`. That is the only\ntime the secret is shown: Widgetic keeps a hash, so a key that was not stored cannot be recovered, only\nreplaced. Only accessible by organization owners and admins with MANAGE_API_KEYS permission.\n\nOnly a person signed in on widgetic.com can make a key: a request made with an API key or an SDK token\nis refused with 403, so a leaked key cannot be used to make a second one that survives its revocation.\n\nAn `Idempotency-Key` header is required (8 to 50 characters: letters, digits, `-` and `_`). A retry with the\nsame header and the same body returns the same answer instead of making a second key, and the same header\nwith a different body is refused with 422.\n\nThe key acts as the workspace and works in that workspace only. A workspace on its free trial or without a\nplan cannot make one (a workspace on a paid plan can have keys, with no limit on how many; a partner's home\nneeds no plan).\n\n**The workspace decides which kind of key it is given, and the request has no field for it.** The key of a\npartner's home workspace is the partner's key and starts with `wgt_prt_`: it acts with the partner role, so it\nopens the partner routes (managed users, presets, editor sessions, `GET /partners/mine`) and is held to the\npartner's standing (a partner that is paused or behind on a payment may pay and read, and nothing else). The\n`partner:read` and `partner:write` scopes are for those keys; in any other workspace the partner routes refuse\nthe key whatever its scopes say. Every other workspace's key starts with `wdg_org_`. A partner has one\nworkspace and one kind of key: a partner's account makes no key of its own, and Widgetic never makes or sends\na key for a partner. The owner makes each one here, one per integration, with the scopes that integration\nneeds.\n\nA key can be limited to what it needs. Send a `preset` (`read_only`, `content` or `full_access`) or a list\nof `scopes`, never both. Send neither for a key that can do everything the workspace's owner can, as every\nkey made before scopes existed. A limited key is refused with 403 and the code `API_KEY_SCOPE_MISSING` on\nanything outside its scopes, so a key held by a build server or by a script can be given only the part of\nthe API it uses. The scopes of a key are fixed when it is made: to widen one, make a new key and delete the\nold one. A limited key cannot make, change or delete keys, open the MCP endpoint, exchange tokens or reach\nthe administration routes. The list of scopes is in the `ApiKeyScope` schema.\n", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "orgId", "in": "path", "required": true, "description": "Organization ID", "schema": { "type": "string", "format": "uuid" } }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "description": "Name for the API key", "example": "Production API Key" }, "expiresAt": { "type": "string", "format": "date-time", "description": "Optional expiration date, as a date and time in the future with a zone", "example": "2027-01-31T00:00:00Z" }, "preset": { "type": "string", "enum": [ "read_only", "content", "full_access" ], "description": "A ready-made list of scopes. `read_only` looks at everything the workspace holds and changes nothing. `content` builds and manages widgets and compositions and runs the AI, and touches no billing, no people and no partners. `full_access` is the same as sending neither `preset` nor `scopes`. Send either `preset` or `scopes`, not both", "example": "content" }, "scopes": { "type": "array", "minItems": 1, "items": { "$ref": "#/components/schemas/ApiKeyScope" }, "description": "What the key may do, when a preset is not enough. Naming a write scope includes its read scope, and a list that holds every scope is a key with full access. Send either `scopes` or `preset`, not both", "example": [ "content:read", "generate" ] } } } } } }, "responses": { "201": { "description": "Organization API key created successfully. The secret is in `key`, and is not shown again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreatedOrganizationApiKeyResponse" } } } }, "400": { "description": "The name, the expiry or the scopes are not valid (an unknown scope, an empty list, or both a preset and scopes), or the Idempotency-Key header is missing or malformed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to create organization API keys, or the request was made with an API key or an SDK token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "503": { "description": "Whether the workspace is a partner's home could not be read right now, so no key was made (the kind of the key depends on it). Try again in a moment", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/organizations/{orgId}/api-keys/{keyId}": { "put": { "operationId": "updateOrganizationApiKey", "summary": "Update Organization API Key", "description": "Update an organization API key (name, active status). The secret, the expiry and the scopes of a key cannot be\nchanged: to widen a key, make a new one. Only a key with full access can make this request: a key limited to\nsome scopes is refused with 403 and the code `API_KEY_SCOPE_MISSING`.\nOnly accessible by organization owners and admins with MANAGE_API_KEYS permission.\n\nRenaming and switching off can be done with an API key. Switching a key on needs a person signed in on\nwidgetic.com: a request that asks for it with an API key or an SDK token is refused with 403.\n", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "orgId", "in": "path", "required": true, "description": "Organization ID", "schema": { "type": "string", "format": "uuid" } }, { "name": "keyId", "in": "path", "required": true, "description": "API key ID", "schema": { "type": "string" } } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "name": { "type": "string", "description": "New name for the API key" }, "isActive": { "type": "boolean", "description": "Active status" } } } } } }, "responses": { "200": { "description": "Organization API key updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrganizationApiKeyResponse" } } } }, "400": { "description": "Invalid request data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to update organization API keys, or the request switches a key on and was made with an API key or an SDK token", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization or API key not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteOrganizationApiKey", "summary": "Delete Organization API Key", "description": "Delete an organization API key permanently. The key stops working at once on the server that took the request and\nwithin a minute on the others, and cannot be brought back: make a new one instead. To stop a key without losing\nit, switch it off with `updateOrganizationApiKey`.\nOnly accessible by organization owners and admins with MANAGE_API_KEYS permission.\n", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "orgId", "in": "path", "required": true, "description": "Organization ID", "schema": { "type": "string", "format": "uuid" } }, { "name": "keyId", "in": "path", "required": true, "description": "API key ID", "schema": { "type": "string" } } ], "responses": { "200": { "description": "Organization API key deleted successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteOrganizationApiKeyResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not authorized to delete organization API keys", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization or API key not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/organizations/{orgId}/api-keys/{keyId}/logs": { "get": { "operationId": "getOrganizationApiKeyUsageLogs", "summary": "Get Organization API Key Usage Logs", "description": "Retrieves usage logs for a specific organization API key with detailed information about each API call. Use it to see whether a key is still in use before deleting it, or to see what a key that should not be in use has been doing", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "orgId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Organization ID" }, { "in": "path", "name": "keyId", "required": true, "schema": { "type": "string" }, "description": "ID of the API key to get logs for" }, { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 500, "default": 500 }, "description": "Maximum number of log entries to return" } ], "responses": { "200": { "description": "Usage logs retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOrganizationApiKeyUsageLogsResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - User does not have permission to manage API keys", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization or API key not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/organizations/{orgId}/translations": { "get": { "operationId": "listOrganizationTranslations", "summary": "List Organization Translations", "description": "Get all translation experiments for the organization.\n\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it lists that customer's\ntranslations and no others. Called without one, it lists every translation of the workspace, and in a partner's own\nworkspace each translation says whose it is (`managedUserId`, `managedUserExternalId`).\n", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "orgId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Organization ID" }, { "in": "query", "name": "status", "schema": { "type": "string", "enum": [ "draft", "active", "paused", "completed" ] }, "description": "Filter by translation status" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "List of organization translations", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TranslationListResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, or the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization not found. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createOrganizationTranslation", "summary": "Create Organization Translation", "description": "Create a new translation experiment in the organization.\n\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), the translation is filed under that\ncustomer (`managedUserId` in the answer), the original composition has to be one of that customer's, and the\ncomposition made for each language is filed under the customer too: an original composition of another customer, or\none of your own account, answers 404 as if it did not exist. A customer may hold only so many translations\n(`details.limit` says how many), and a customer that is switched off cannot be given a new one. The customer comes\nfrom the header and nowhere else: a `managedUserId` in the body is not read.\n", "tags": [ "Organizations" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "in": "path", "name": "orgId", "required": true, "schema": { "type": "string", "format": "uuid" }, "description": "Organization ID" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateWorkspaceTranslationRequest" } } } }, "responses": { "201": { "description": "Translation created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TranslationWithMessageResponse" } } } }, "400": { "description": "Invalid request data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - Not a member of this organization, or the plan does not include translations (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Organization not found (for a call made for one managed user, also a workspace that is not your partner workspace), or, for a call made for one managed user, an original composition that is not that customer's", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The call is made for a managed user that is switched off (`MANAGED_USER_INACTIVE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The customer already holds as many translations as it may (`BUSINESS_OPERATION_INVALID`; `details.reason` is `too_many_translations` and `details.limit` is the number)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/metrics/available": { "get": { "operationId": "getAvailableMetrics", "summary": "Get Available Success Metrics", "description": "Lists the goals an A/B test can measure, from the one registry the API validates against: how each goal is\ncounted (`automatic`: the embed SDK recognises it by itself; `widget-event`: the widget has to report it),\nwhether a version can name the one element of its widget that counts (`supportsElementTarget`), and whether the\ngoal can be chosen at all (`available`, with the reason when it cannot). A test is created with one of the\navailable goals as its `primaryMetric`; the embed SDK counts that goal only.\n\nThe list is the same for everybody, so the call needs no key and takes no customer header. The goals are at\n`data.data`.\n", "tags": [ "A/B Testing" ], "x-access-level": "user", "x-visibility": "public", "responses": { "200": { "description": "Available metrics retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetAvailableMetricsAnswerResponse" } } }, "x-response-envelope": "nested" }, "500": { "description": "Internal server error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests": { "get": { "operationId": "listWorkspaceABTests", "summary": "List AB Tests in Workspace", "description": "Retrieves all AB tests in the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\n\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), it lists that customer's tests\nand no others. Called without one, it lists every test of the workspace, and in a partner's own workspace each\ntest says whose it is (`managedUserId`, `managedUserExternalId`).\n\nThe tests are at `data.data`, and `data.meta` says how many there are.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "status", "in": "query", "schema": { "type": "string", "enum": [ "draft", "running", "paused", "completed", "graduated" ] }, "description": "Filter tests by status", "example": "running" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "AB tests retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestListAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Workspace not found. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "post": { "operationId": "createWorkspaceABTest", "summary": "Create AB Test in Workspace", "description": "Creates a new AB test in the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\n\nCalled for one managed user (`X-Managed-User-Id` or `X-Managed-User-External-Id`), the test is filed under that\ncustomer (`managedUserId` in the answer) and every version has to be a composition of that customer: a composition\nof another customer, or one that is yours, answers 404 as if it did not exist. A customer may hold only so many\ntests (`details.limit` says how many), and a customer that is switched off cannot be given a new one. The\ncustomer comes from the header and nowhere else: a `managedUserId` in the body is not read.\n\nA test is always made as a draft, and no visitor sees it until it is started with\n`POST /workspaces/{workspaceId}/ab-tests/{testId}/start`.\n\nThe test is at `data.data`.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateABTestRequest" } } } }, "responses": { "201": { "description": "AB test created successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestAnswerResponse" } } }, "x-response-envelope": "nested" }, "400": { "description": "Invalid input data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Workspace not found (for a call made for one managed user, also a workspace that is not your partner workspace), or, for a call made for one managed user, a composition that is not that customer's", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The call is made for a managed user that is switched off (`MANAGED_USER_INACTIVE`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "422": { "description": "The customer already holds as many A/B tests as it may (`BUSINESS_OPERATION_INVALID`; `details.reason` is `too_many_ab_tests` and `details.limit` is the number)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}": { "get": { "operationId": "getWorkspaceABTest", "summary": "Get AB Test from Workspace", "description": "Retrieves a specific AB test from the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "AB test retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "put": { "operationId": "updateWorkspaceABTest", "summary": "Update AB Test in Workspace", "description": "Updates an AB test in the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\n\nA `status` in the body moves the test, and only along the moves a test can make: a draft starts, a running or\npaused test can be paused, resumed or ended, and a test that has ended (completed or graduated) stays ended.\nNaming the state the test is already in changes nothing, so a retry is safe.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateABTestRequest" } } } }, "responses": { "200": { "description": "AB test updated successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestAnswerResponse" } } }, "x-response-envelope": "nested" }, "400": { "description": "Invalid input data, or a change of state the test cannot make from where it is (an ended test stays ended, a draft starts before anything else, and a graduation needs a winner)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The draft changed since `revision` (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`), or the test changed state (`details.reason` is `status_changed`). When the revision changed, `details.currentRevision` is the revision to start again from. Read it again and try again.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } }, "delete": { "operationId": "deleteWorkspaceABTest", "summary": "Delete AB Test from Workspace", "description": "Deletes an AB test from the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestRevisionRequest" } } } }, "responses": { "200": { "description": "AB test deleted successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DeleteWorkspaceABTestResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The test changed since the `revision` that was sent (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`, and `details.currentRevision` is the revision to start again from). Read it again and try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}/start": { "post": { "operationId": "startWorkspaceABTest", "summary": "Start AB Test in Workspace", "description": "Starts an AB test in the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestRevisionRequest" } } } }, "responses": { "200": { "description": "AB test started successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestAnswerResponse" } } }, "x-response-envelope": "nested" }, "400": { "description": "Invalid test state for starting. Only a draft or a paused test can be started", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The test changed state while it was being started (`details.reason` is `status_changed`), or it changed since the `revision` that was sent (`details.reason` is `revision_changed`). Read it again and try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}/pause": { "post": { "operationId": "pauseWorkspaceABTest", "summary": "Pause AB Test in Workspace", "description": "Pauses an AB test in the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestRevisionRequest" } } } }, "responses": { "200": { "description": "AB test paused successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ABTestAnswerResponse" } } }, "x-response-envelope": "nested" }, "400": { "description": "Invalid test state for pausing. Only a running test can be paused", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The test changed state while it was being paused (`details.reason` is `status_changed`), or it changed since the `revision` that was sent (`details.reason` is `revision_changed`). Read it again and try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}/stop": { "post": { "operationId": "stopWorkspaceABTest", "summary": "Stop AB Test in Workspace", "description": "Manually stops a running AB test in the specified workspace, optionally specifying a winning variant.\nUse the id of the workspace (its organization UUID) as workspaceId.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": false, "content": { "application/json": { "schema": { "type": "object", "properties": { "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." }, "winningVariantId": { "type": "string", "format": "uuid", "description": "ID of the winning variant (optional). Leave it out to stop the test with no winner.", "example": "789e0123-e89b-12d3-a456-426614174002" } } } } } }, "responses": { "200": { "description": "AB test stopped successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/StopWorkspaceABTestAnswerResponse" } } }, "x-response-envelope": "nested" }, "400": { "description": "The winner is not one of the test's versions, or the test cannot be stopped from where it is (a draft has not started, and a test that has ended stays as it ended)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The test changed state while it was being stopped (`details.reason` is `status_changed`), or it changed since the `revision` that was sent (`details.reason` is `revision_changed`). Read it again and try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}/auto-stop-check": { "get": { "operationId": "checkWorkspaceABTestAutoStop", "summary": "Check Auto-Stop Status in Workspace", "description": "Checks if an AB test in the specified workspace should automatically stop based on duration, significance, or graduation criteria.\nUse the id of the workspace (its organization UUID) as workspaceId.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "Auto-stop status retrieved successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CheckWorkspaceABTestAutoStopAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}/duration": { "put": { "operationId": "setWorkspaceABTestDuration", "summary": "Set AB Test Duration in Workspace", "description": "Sets the duration for an AB test in the specified workspace, automatically calculating the end date.\nUse the id of the workspace (its organization UUID) as workspaceId.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "durationDays" ], "properties": { "durationDays": { "type": "integer", "minimum": 1, "maximum": 365, "description": "Duration of the test in days", "example": 30 }, "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." } } } } } }, "responses": { "200": { "description": "Test duration set successfully", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SetWorkspaceABTestDurationAnswerResponse" } } }, "x-response-envelope": "nested" }, "400": { "description": "Invalid duration value", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "409": { "description": "The test changed since the `revision` that was sent (BUSINESS_STATE_CONFLICT; `details.reason` is `revision_changed`, and `details.currentRevision` is the revision to start again from). Read it again and try again", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/validate-goal-tracking": { "post": { "operationId": "validateWorkspaceGoalTracking", "summary": "Validate Goal Tracking in Workspace", "description": "Validates goal tracking capabilities for compositions in the specified workspace.\nUse the id of the workspace (its organization UUID) as workspaceId.\nCalled for one managed user, every composition named has to be that customer's.\nThe result is at `data.data`.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "$ref": "#/components/parameters/IdempotencyKeyRequired" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": [ "variants", "successMetrics" ], "properties": { "variants": { "type": "array", "minItems": 1, "description": "Array of variants to validate", "items": { "type": "object", "required": [ "compositionId", "name" ], "properties": { "compositionId": { "type": "string", "format": "uuid", "description": "ID of the composition", "example": "456e7890-e89b-12d3-a456-426614174003" }, "name": { "type": "string", "description": "Name of the variant", "example": "Control" } } } }, "successMetrics": { "type": "array", "minItems": 1, "description": "Success metrics to validate tracking for", "items": { "type": "string" }, "example": [ "clicks", "conversions" ] } } } } } }, "responses": { "200": { "description": "Goal tracking validation completed", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ValidateWorkspaceGoalTrackingAnswerResponse" } } }, "x-response-envelope": "nested" }, "400": { "description": "Invalid request data", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "For a call made for one managed user (`X-Managed-User-Id`), a workspace that is not your partner workspace, or a composition that is not that customer's", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/compositions/{id}/ab-goal-targets": { "get": { "operationId": "getCompositionABGoalTargets", "summary": "List the Elements of a Composition That Can Be an A/B Test Goal", "description": "Lists the clickable, submittable and playable elements of the composition's published widget, each with a label a\nperson recognises and a selector to store as a version's `goalTarget`. The elements the widget declared for its\ngoals come first, then elements marked `data-widgetic-goal`: they are the dependable choice.\n\nAlso says which goals the widget can be measured on (`goals`), decided when the version was generated.\n\nThe rest of the list is read from the page the widget is served as, so elements the widget builds while it runs may\nbe missing (`complete` is always false); a selector can be typed instead. `note` says why a list is empty or short.\nThe elements are at `data.data`.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "id", "in": "path", "required": true, "description": "ID of the composition whose widget is read", "schema": { "type": "string", "format": "uuid" }, "example": "456e7890-e89b-12d3-a456-426614174003" }, { "name": "metric", "in": "query", "required": false, "description": "Only the elements that can serve this goal (clicks, submissions or plays)", "schema": { "type": "string" }, "example": "clicks" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "The elements of the widget that can be a goal", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetCompositionABGoalTargetsAnswerResponse" } } }, "x-response-envelope": "nested" }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key may not read this composition, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "Composition not found. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a composition of another customer, and for one of your own account", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}/statistics": { "get": { "operationId": "getWorkspaceABTestStatistics", "summary": "Get AB Test Statistics from Workspace", "description": "Returns what an AB test has gathered so far: impressions and conversions overall and for each version,\nthe statistics that compare each version with the control, and the API's advice on what to do next.\nUse the id of the workspace (its organization UUID) as workspaceId.\nThe answer is sent once inside the usual `{ success, data }` envelope (unlike most AB test routes, which\nwrap their data a second time).\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "AB test statistics retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/ABTestStatistics" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } }, "/workspaces/{workspaceId}/ab-tests/{testId}/diagnosis": { "get": { "operationId": "getWorkspaceABTestDiagnosis", "summary": "Get AB Test AI Review from Workspace", "description": "Returns an AI review of the test: what its versions change, which of the usual levers that is\n(urgency, social proof, clarity, pricing, friction, or only looks), and whether the challenger is safe to promote.\nIt calls another service, so it is slower than the other reads: ask for it only when it is wanted.\nA test with fewer than two versions gets a fixed answer that says so.\nUse the id of the workspace (its organization UUID) as workspaceId.\nThe answer is sent once inside the usual `{ success, data }` envelope.\n", "tags": [ "A/B Testing" ], "security": [ { "apiKeyAuth": [] } ], "x-access-level": "user", "x-visibility": "public", "parameters": [ { "name": "workspaceId", "in": "path", "required": true, "description": "The id of the workspace (its organization UUID)", "schema": { "type": "string" }, "example": "789e0123-e89b-12d3-a456-426614174002" }, { "name": "testId", "in": "path", "required": true, "description": "AB test ID", "schema": { "type": "string", "format": "uuid" }, "example": "123e4567-e89b-12d3-a456-426614174000" }, { "$ref": "#/components/parameters/ManagedUserScopeId" }, { "$ref": "#/components/parameters/ManagedUserScopeExternalId" } ], "responses": { "200": { "description": "AB test review retrieved successfully", "content": { "application/json": { "schema": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/ABTestDiagnosis" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "required": [ "success", "data" ] } } } }, "401": { "description": "Unauthorized", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "403": { "description": "Forbidden - The key does not belong to this workspace, or the plan does not include A/B testing (`AUTHZ_PLAN_RESTRICTION`)", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } }, "404": { "description": "No such A/B test in this workspace. For a call made for one managed user (`X-Managed-User-Id`) it is also the answer for a workspace that is not your partner workspace, and for a test of another customer or of your own account: the same answer as for a test that does not exist, so the call cannot be used to find out what another customer has", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } } } } } } }, "components": { "schemas": { "PublicWorkflow": { "type": "object", "description": "What a visitor's browser reads for a workflow. `status` is `live` with the published version, or `paused`\nwith nothing else: the embed then shows only its first composition.\n", "required": [ "workflowId", "status" ], "properties": { "workflowId": { "type": "string", "format": "uuid" }, "status": { "type": "string", "enum": [ "live", "paused" ] }, "versionId": { "type": "string", "format": "uuid", "description": "The published version this answer is for. A visitor who starts on it finishes on it." }, "versionNumber": { "type": "integer" }, "publishedAt": { "type": "string", "format": "date-time" }, "startCompositionId": { "type": "string", "format": "uuid", "description": "The composition a new visitor starts on, so the page can show it while the graph is still being read." }, "timezone": { "type": "string", "description": "The zone date and time triggers are read in." }, "graph": { "$ref": "#/components/schemas/WorkflowGraph" }, "translations": { "type": "object", "description": "The languages the compositions of the graph can be shown in, by composition id: only the compositions that\nhave an active translation with a language besides their own, so the field is absent when none has. The\nbrowser shows the copy in the visitor's language in place of the composition, at the first step and at every\nmove, with the rules `` follows (the visitor's language, then its language family, then\nthe language the composition was written in). It is read when the answer is made, not when the version was\npublished, so a language added to a translation reaches visitors without a new publish. Ids, counts and the\nvisitor's place keep naming the composition of the graph, never its copy.\n", "additionalProperties": { "$ref": "#/components/schemas/PublicWorkflowTranslation" } }, "eventToken": { "type": "string", "description": "What lets the browser report counts for this version, valid for 24 hours. Absent when this server cannot\nsign one, and the browser then reports nothing.\n" } }, "example": { "workflowId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "status": "Example status", "versionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "versionNumber": 42, "publishedAt": "2026-01-15T09:30:00.000Z", "startCompositionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "timezone": "Example timezone", "graph": null, "translations": {}, "eventToken": "Example eventToken" } }, "PublicWorkflowTranslation": { "type": "object", "description": "One composition of a published workflow and the copies of it in other languages.", "required": [ "rootLanguage", "compositions" ], "properties": { "rootLanguage": { "type": "string", "example": "en", "description": "The language the composition was written in. A visitor whose language matches nothing else is shown the composition itself." }, "compositions": { "type": "object", "description": "Language code (lower case) to the composition that shows it. The root language is listed too, and is the composition itself.", "additionalProperties": { "type": "string", "format": "uuid" }, "example": { "en": "7b1d5c3e-6f0a-4c52-9d3a-0a1b2c3d4e5f", "fr": "2f6c8a90-1b3d-4e7f-8a9b-c0d1e2f3a4b5" } } }, "example": { "rootLanguage": "en", "compositions": { "en": "7b1d5c3e-6f0a-4c52-9d3a-0a1b2c3d4e5f", "fr": "2f6c8a90-1b3d-4e7f-8a9b-c0d1e2f3a4b5" } } }, "PublicWorkflowEventsRequest": { "type": "object", "description": "One report from a visitor's browser: counts (`events`), the heights steps settled at (`heights`), or both. A report\nwith neither is refused.\n", "required": [ "versionId", "token" ], "properties": { "versionId": { "type": "string", "format": "uuid" }, "token": { "type": "string", "description": "The `eventToken` of the workflow, read for the same version." }, "events": { "type": "array", "maxItems": 100, "description": "The counts of what visitors did. At least one of `events` and `heights` is needed.", "items": { "type": "object", "required": [ "k", "id" ], "properties": { "k": { "type": "string", "enum": [ "n", "e", "f" ], "description": "`n` a visitor reached a block, `e` a visitor took a connection, `f` moving a visitor on failed." }, "id": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$", "description": "The block or connection counted." }, "c": { "type": "integer", "minimum": 1, "maximum": 50, "description": "How many times (1 when not given)." }, "r": { "type": "string", "enum": [ "t", "e", "b", "o" ], "description": "Only on an `f` event: why moving the visitor on failed. `t` the composition did not appear in time,\n`e` the widget in it reported an error, `b` the composition could not be built, `o` another reason (a\nstep was already on its way, or the page was going away). Left out by an embed that does not say why;\na letter this server does not know is read as left out, and the failure is still counted. On an `n` or\nan `e` event it is ignored. Never a message: one letter, so that nothing a visitor typed can ride on it.\n" } } } }, "heights": { "type": "array", "maxItems": 10, "description": "How tall steps of this version settled in the visitor's browser, so that the embed code of the workflow can\nstart its box at the height visitors saw instead of a guess. The Embed SDK sends one for a visitor who has no\nremembered height for the step. The gateway keeps the latest few for each composition (the median is what the\ncode gets); a composition that this version does not show is left out. At least one of `events` and `heights`\nis needed.\n", "items": { "type": "object", "required": [ "compositionId", "height" ], "properties": { "compositionId": { "type": "string", "format": "uuid", "description": "The composition the step shows." }, "height": { "type": "integer", "minimum": 1, "maximum": 100000, "description": "The height the step settled at, in pixels. One under 100 is not kept, one over 2000 is kept as 2000." } } } } }, "example": { "versionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "token": "Example token", "events": [], "heights": [] } }, "PublicWorkflowEventsAccepted": { "type": "object", "required": [ "recorded" ], "properties": { "recorded": { "type": "boolean", "description": "False when nothing was counted or kept (the workflow is not live any more, or the ids are not in that version)." }, "counters": { "type": "integer", "description": "How many counters were raised (0 for a report of heights alone)." }, "reason": { "type": "string", "description": "Why nothing was counted or kept, when `recorded` is false." } }, "example": { "recorded": true, "counters": 42, "reason": "Example reason" } }, "PublicEmbedFailure": { "type": "object", "required": [ "success", "message", "error", "code" ], "description": "What a public embed route answers when it refuses or fails. It is the standard error answer of the API (`success`, `message`, `error`), and the short `code` (with `details` and `correlationId` when the route has them) is also at the top level, because a page that embeds a composition branches on it there. `error.code` is the same word in the codes of the rest of the API where those have it: `NOT_FOUND` is `RESOURCE_NOT_FOUND`, `RATE_LIMITED` is `RATE_LIMIT_EXCEEDED`, and the others (`DOMAIN_NOT_ALLOWED`, `UNPUBLISHED`, `SUSPENDED`, the codes of the entry route) are the same in both places.", "properties": { "success": { "type": "boolean", "enum": [ false ] }, "message": { "type": "string", "description": "What happened, for a person." }, "code": { "type": "string", "description": "The short code a page branches on: `DOMAIN_NOT_ALLOWED`, `UNPUBLISHED`, `SUSPENDED`, `NOT_FOUND`, `RATE_LIMITED`, and for the entry route the codes listed with its answers.", "example": "NOT_FOUND" }, "details": { "type": "object", "additionalProperties": true, "description": "What tells the cases of one code apart, such as `reason` of `DOMAIN_NOT_ALLOWED`.", "properties": { "reason": { "type": "string", "description": "For `DOMAIN_NOT_ALLOWED`, why the website was refused.", "enum": [ "domain_not_allowed", "opaque_origin" ] }, "hasDomainsConfigured": { "type": "boolean", "description": "For `DOMAIN_NOT_ALLOWED`, always true (an owner who listed nothing is never refused)." } } }, "correlationId": { "type": "string", "description": "The id of the request, for the routes that carry it." }, "error": { "type": "object", "required": [ "code", "message", "timestamp" ], "properties": { "code": { "type": "string", "example": "RESOURCE_NOT_FOUND" }, "message": { "type": "string" }, "details": { "type": "object", "additionalProperties": true }, "correlationId": { "type": "string" }, "retryAfter": { "type": "integer", "description": "Seconds to wait before asking again, for a rate-limit refusal." }, "timestamp": { "type": "string", "format": "date-time" } } } }, "example": { "success": true, "message": "Example message", "code": "NOT_FOUND", "details": {}, "correlationId": "Example correlationId", "error": {} } }, "PublicAdapterCallRequest": { "type": "object", "required": [ "requestId" ], "additionalProperties": false, "properties": { "requestId": { "type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{7,63}$", "description": "Names this attempt: 8 to 64 characters, letters, digits, `_` and `-`, the first a letter or a digit (a UUID fits). A module makes a new one for each action of the visitor. An operation that costs credits is charged once for each `requestId`, so a repeat of one that was charged and not given back is refused (409 `REQUEST_ALREADY_USED`) and does no work." }, "version": { "type": "integer", "minimum": 1, "maximum": 1000, "description": "The version of the adapter the widget's code was built against (the `vN` of its import). When it is left out, the newest version the widget's live manifest lists." }, "input": { "type": "object", "additionalProperties": true, "description": "What the operation is asked to do. Each operation says what it accepts and answers 400, 413 or 422 with a code of its own for what it cannot use. Defaults to an empty object." }, "context": { "type": "object", "nullable": true, "additionalProperties": true, "description": "The host context the embedding page gave the widget, as the entry route takes it (see the description of `createPublicCompositionEntry`, with its **Signed context**). It is not authenticated unless the partner signs it. At most 4096 bytes of JSON, the two signature keys included." }, "captchaToken": { "type": "string", "nullable": true, "maxLength": 4096, "description": "The visitor's CAPTCHA token, for an operation that asks for one (the answer `CAPTCHA_REQUIRED` says so)." } }, "example": { "requestId": "Example requestId", "version": 42, "input": {}, "context": {}, "captchaToken": "Example captchaToken" } }, "PublicAdapterCallResult": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "required": [ "output" ], "properties": { "output": { "type": "object", "additionalProperties": true, "description": "What the operation answered, exactly as it wrote it: its field names are NOT rewritten to camelCase on the way out. At most 256 KiB of JSON. Each operation documents its own fields." } } } }, "example": { "success": true, "data": {} } }, "PublicAdapterCallError": { "type": "object", "required": [ "success", "error", "code" ], "properties": { "success": { "type": "boolean", "example": false }, "error": { "type": "string", "description": "A sentence a visitor may read. It never says why a feature is unavailable: not that its owner is out of credits, not what a balance is, not which limit was reached beyond the word `RATE_LIMITED` or `WIDGET_LIMIT_REACHED`. (On a 429 the standard rate-limit envelope is sent instead: `error` is then an object, and `code` beside it is the flat code.)" }, "code": { "type": "string", "description": "What a module switches on. The codes of the gateway itself are `ADAPTER_BODY_INVALID`, `CAPTCHA_REQUIRED`, `ADAPTER_NOT_AVAILABLE`, `REQUEST_ALREADY_USED`, `RATE_LIMITED`, `WIDGET_LIMIT_REACHED`, `ADAPTER_FAILED`, `ADAPTER_UNAVAILABLE` and `ADAPTER_TIMEOUT`, with `ORIGIN_NOT_ALLOWED`, `PAYLOAD_TOO_LARGE`, `UNSUPPORTED_MEDIA_TYPE`, `CONTEXT_SIGNATURE_REQUIRED`, `CONTEXT_SIGNATURE_INVALID`, `CONTEXT_SIGNATURE_EXPIRED`, `CONTEXT_SIGNATURE_UNAVAILABLE` and the codes of the serving gate (`NOT_FOUND`, `UNPUBLISHED`, `SUSPENDED`) it shares with the other public embed routes. An operation may add codes of its own (capital letters and `_`) for an input it refused." }, "correlationId": { "type": "string", "description": "Quote it when asking for help with a call." } }, "example": { "success": false, "error": "Example error", "code": "Example code", "correlationId": "Example correlationId" } }, "PublicAdapterFileBytes": { "type": "string", "format": "binary", "description": "The bytes of the file as they are: no encoding and no form around them." }, "PublicAdapterFileResult": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "required": [ "file" ], "properties": { "file": { "type": "object", "required": [ "url", "name", "size", "type", "width", "height" ], "properties": { "url": { "type": "string", "format": "uri", "maxLength": 2048, "description": "Where the stored file is. Always an https address." }, "name": { "type": "string", "description": "The name it is stored under. It is not the name the visitor gave, which is only kept as far as it is plain text." }, "size": { "type": "integer", "description": "Its size in bytes." }, "type": { "type": "string", "description": "Its media type, as proved from its bytes." }, "width": { "type": "integer", "nullable": true, "description": "The width in pixels of a picture, otherwise null." }, "height": { "type": "integer", "nullable": true, "description": "The height in pixels of a picture, otherwise null." } } } } } }, "example": { "success": true, "data": {} } }, "WorkflowStatus": { "type": "string", "enum": [ "draft", "live", "paused", "archived" ], "description": "`draft`: never published. `live`: visitors get the live version. `paused`: embeds show only their first\ncomposition (the live version is kept). `archived`: out of the default list, kept. A workflow can be deleted\nin any of the four states, with its versions and counts.\n" }, "WorkflowNodePosition": { "type": "object", "description": "Where a block sits on the editor's canvas. Embeds never read it.", "required": [ "x", "y" ], "properties": { "x": { "type": "number" }, "y": { "type": "number" } }, "example": { "x": 42, "y": 42 } }, "WorkflowFieldReference": { "type": "object", "description": "A value a rule reads: a column the visitor filled in (`input`) or a value that came with a page event\n(`event`). The type is saved with the reference so the graph can be evaluated without the widget's schema.\n", "required": [ "kind", "name", "type" ], "properties": { "kind": { "type": "string", "enum": [ "input", "event" ] }, "name": { "type": "string" }, "type": { "type": "string", "enum": [ "text", "number", "boolean" ] } }, "example": { "kind": "Example kind", "name": "Example name", "type": "Example type" } }, "WorkflowConditionTest": { "type": "object", "description": "One comparison of a rule - a field, an operator and (for most operators) a value to compare with.", "required": [ "field", "operator" ], "properties": { "field": { "$ref": "#/components/schemas/WorkflowFieldReference" }, "operator": { "type": "string", "enum": [ "is", "isNot", "contains", "doesNotContain", "startsWith", "endsWith", "greaterThan", "atLeast", "lessThan", "atMost", "isEmpty", "isNotEmpty" ], "description": "Text fields take is, isNot, contains, doesNotContain, startsWith, endsWith, isEmpty and isNotEmpty.\nNumber fields take is, isNot, greaterThan, atLeast, lessThan, atMost, isEmpty and isNotEmpty.\nYes/no fields take is and isNot.\n" }, "value": { "description": "What the field is compared with; not used by isEmpty and isNotEmpty. A text for a text field, a number for\na number field, true or false for a yes/no field.\n", "nullable": true } }, "example": { "field": null, "operator": "Example operator", "value": null } }, "WorkflowConditionCase": { "type": "object", "description": "One rule of a condition block, and one path out of it. Rules are read in order and the first that matches wins;\nthe block's Default output is taken when none does.\n", "required": [ "id", "match", "tests" ], "properties": { "id": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$", "description": "The output port of the rule. `default` is reserved for the Default output." }, "label": { "type": "string" }, "match": { "type": "string", "enum": [ "all", "any" ], "description": "`all` - every comparison must hold; `any` - one is enough." }, "tests": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowConditionTest" } } }, "example": { "id": "Example id", "label": "Example label", "match": "Example match", "tests": [ "Example WorkflowConditionTest" ] } }, "WorkflowSchedule": { "type": "object", "description": "When a Scheduled trigger fires - a wait counted from reaching the step, or a fixed moment.", "required": [ "mode" ], "properties": { "mode": { "type": "string", "enum": [ "after", "at" ] }, "amount": { "type": "number", "description": "How long to wait (mode `after`)." }, "unit": { "type": "string", "enum": [ "seconds", "minutes", "hours", "days", "weeks" ], "description": "The unit of `amount` (mode `after`)." }, "at": { "type": "string", "format": "date-time", "description": "The moment to fire at, as an ISO time in UTC (mode `at`)." } }, "example": { "mode": "Example mode", "amount": 42, "unit": "Example unit", "at": "2026-01-15T09:30:00.000Z" } }, "WorkflowTrigger": { "type": "object", "description": "What a trigger block waits for. `input`: a row the visitor adds to a table of the composition (`table`).\n`action`: an action the widget reports (`actionId`). `pageEvent`: an event the page sends (`name`, and the\n`values` it promises to carry). `scheduled`: a wait or a date (`schedule`).\n", "required": [ "kind" ], "properties": { "kind": { "type": "string", "enum": [ "input", "action", "pageEvent", "scheduled" ] }, "table": { "type": "string" }, "actionId": { "type": "string" }, "name": { "type": "string" }, "values": { "type": "array", "items": { "type": "object", "required": [ "name", "type" ], "properties": { "name": { "type": "string" }, "type": { "type": "string", "enum": [ "text", "number", "boolean" ] } } } }, "schedule": { "$ref": "#/components/schemas/WorkflowSchedule" } }, "example": { "kind": "Example kind", "table": "Example table", "actionId": "Example actionId", "name": "Example name", "values": [], "schedule": null } }, "WorkflowNode": { "type": "object", "description": "A block. A `composition` block shows one composition (exactly one block of a workflow has `startsHere`);\na `trigger` block waits for one thing to happen while the composition before it is shown; a `condition`\nblock chooses the next step from what the trigger before it carried. At most 25 blocks.\n", "required": [ "id", "type" ], "properties": { "id": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" }, "type": { "type": "string", "enum": [ "composition", "trigger", "condition" ] }, "position": { "$ref": "#/components/schemas/WorkflowNodePosition" }, "compositionId": { "type": "string", "format": "uuid", "description": "The composition a `composition` block shows." }, "startsHere": { "type": "boolean", "description": "Set on the one composition block a visitor starts at." }, "trigger": { "$ref": "#/components/schemas/WorkflowTrigger" }, "cases": { "type": "array", "description": "The rules of a `condition` block, in the order they are read.", "items": { "$ref": "#/components/schemas/WorkflowConditionCase" } } }, "example": { "id": "Example id", "type": "Example type", "position": null, "compositionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "startsHere": true, "trigger": null, "cases": [ "Example WorkflowConditionCase" ] } }, "WorkflowEdge": { "type": "object", "description": "A connection from an output port of one block to the input of another. Connections run forward only.", "required": [ "id", "source", "sourcePort", "target" ], "properties": { "id": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,64}$" }, "source": { "type": "string" }, "sourcePort": { "type": "string", "description": "`out` for compositions and triggers; a rule's id, or `default`, for conditions." }, "target": { "type": "string" } }, "example": { "id": "Example id", "source": "Example source", "sourcePort": "Example sourcePort", "target": "Example target" } }, "WorkflowGraph": { "type": "object", "description": "A whole workflow, as the editor saves it and the gateway publishes it.", "required": [ "schemaVersion", "nodes", "edges" ], "properties": { "schemaVersion": { "type": "integer", "enum": [ 1 ] }, "nodes": { "type": "array", "maxItems": 100, "items": { "$ref": "#/components/schemas/WorkflowNode" } }, "edges": { "type": "array", "maxItems": 300, "items": { "$ref": "#/components/schemas/WorkflowEdge" } } }, "example": { "schemaVersion": 42, "nodes": [ "Example WorkflowNode" ], "edges": [ "Example WorkflowEdge" ] } }, "WorkflowIssue": { "type": "object", "description": "Something the check found in a workflow. An `error` stops it being published; a `warning` does not. The block\n(`nodeId`), connection (`edgeId`) or rule (`caseId`) it belongs to is named so the editor can highlight it.\n", "required": [ "code", "severity" ], "properties": { "code": { "type": "string", "example": "trigger_no_target" }, "severity": { "type": "string", "enum": [ "error", "warning" ] }, "nodeId": { "type": "string" }, "edgeId": { "type": "string" }, "caseId": { "type": "string" }, "detail": { "type": "string", "description": "A short machine-readable detail such as a column or a table name. Never a sentence." } }, "example": { "code": "trigger_no_target", "severity": "Example severity", "nodeId": "Example nodeId", "edgeId": "Example edgeId", "caseId": "Example caseId", "detail": "Example detail" } }, "WorkflowVersion": { "type": "object", "description": "One published version of a workflow. Versions never change once published.", "required": [ "id", "versionNumber", "publishedAt", "timezone", "isLive" ], "properties": { "id": { "type": "string", "format": "uuid" }, "versionNumber": { "type": "integer", "minimum": 1 }, "publishedAt": { "type": "string", "format": "date-time" }, "publishedBy": { "type": "object", "nullable": true, "description": "Who published it; null once that account is gone, and always null for an editor session (it works for one customer of a partner, who is not told the name of the partner's person).", "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string", "nullable": true } } }, "timezone": { "type": "string", "example": "Europe/Bucharest" }, "isLive": { "type": "boolean", "description": "Whether this is the version visitors who are new to the workflow get." } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "versionNumber": 42, "publishedAt": "2026-01-15T09:30:00.000Z", "publishedBy": {}, "timezone": "Europe/Bucharest", "isLive": true } }, "WorkflowVersionDetail": { "allOf": [ { "$ref": "#/components/schemas/WorkflowVersion" }, { "type": "object", "required": [ "startNodeId", "graph" ], "properties": { "startNodeId": { "type": "string" }, "graph": { "$ref": "#/components/schemas/WorkflowGraph" } } } ] }, "Workflow": { "type": "object", "description": "A workflow as the list shows it (without its graph).", "required": [ "id", "name", "status", "revision", "unpublishedChanges", "compositionIds", "blockCount", "timezone", "runsCount", "createdAt", "updatedAt" ], "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string", "maxLength": 120 }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The customer of a partner (a managed user) this workflow was made for, or null when it is its workspace's own.\nA customer's editor session lists and opens only the workflows filed under that customer; the partner's own\naccount sees every customer's and tells them apart by this. It is set when the workflow is made and never\nchanges.\n" }, "managedUserExternalId": { "type": "string", "nullable": true, "description": "Your own id for that customer (the `externalId` you registered it with), so a workflow can be matched to your own\nrecords without a second call. Only in the list of a partner's own workspace (`listWorkflows`); null for a workflow\nthat is the workspace's own, and not part of the answer for one workflow.\n" }, "status": { "$ref": "#/components/schemas/WorkflowStatus" }, "revision": { "type": "integer", "minimum": 1, "description": "Rises by one with every save. A save, a publish, a discard and a restore each name the revision they started from." }, "unpublishedChanges": { "type": "boolean", "description": "Whether the draft differs from the live version." }, "compositionIds": { "type": "array", "items": { "type": "string", "format": "uuid" } }, "blockCount": { "type": "integer" }, "timezone": { "type": "string", "description": "The zone date and time triggers are read in (stored as UTC)." }, "runsCount": { "type": "integer", "description": "Visitors who started the workflow, over its whole life." }, "liveVersionId": { "type": "string", "format": "uuid", "nullable": true }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "firstPublishedAt": { "type": "string", "format": "date-time", "nullable": true }, "lastPublishedAt": { "type": "string", "format": "date-time", "nullable": true }, "pausedAt": { "type": "string", "format": "date-time", "nullable": true }, "archivedAt": { "type": "string", "format": "date-time", "nullable": true } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Example name", "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managedUserExternalId": "Example managedUserExternalId", "status": null, "revision": 42, "unpublishedChanges": true, "compositionIds": [], "blockCount": 42, "timezone": "Example timezone", "runsCount": 42, "liveVersionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z", "firstPublishedAt": "2026-01-15T09:30:00.000Z", "lastPublishedAt": "2026-01-15T09:30:00.000Z", "pausedAt": "2026-01-15T09:30:00.000Z", "archivedAt": "2026-01-15T09:30:00.000Z" } }, "WorkflowDetail": { "allOf": [ { "$ref": "#/components/schemas/Workflow" }, { "type": "object", "required": [ "graph", "everPublished" ], "properties": { "graph": { "$ref": "#/components/schemas/WorkflowGraph" }, "liveVersion": { "allOf": [ { "$ref": "#/components/schemas/WorkflowVersion" } ], "nullable": true, "description": "The version visitors get, without its graph; null before the first publish." }, "everPublished": { "type": "boolean", "description": "Whether it was ever published (it then has versions and counts, and visitors may have run it)." }, "lastEditedBy": { "type": "object", "nullable": true, "description": "Who made the latest change to a workflow of a team workspace, so that a teammate who\nopens it can be told \"Anna changed this at 14:32\". `null` when nobody can be named (a change made before\nthis was recorded). Left out for a workflow made for one of your managed users, and whenever it cannot be read just\nnow. A save that someone else got ahead of says it in `details` of its 409.\n", "properties": { "id": { "type": "string", "format": "uuid", "description": "The account that made the latest change" }, "name": { "type": "string", "nullable": true, "maxLength": 120, "description": "The name on that account, or `null` when it has none or it could not be read just then. Never an email address." } } }, "lastEditedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When that latest change was made. Present whenever `lastEditedBy` is." } } } ] }, "WorkflowList": { "type": "object", "required": [ "items", "total", "limit", "offset" ], "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/Workflow" } }, "total": { "type": "integer" }, "limit": { "type": "integer" }, "offset": { "type": "integer" } }, "example": { "items": [ "Example Workflow" ], "total": 42, "limit": 42, "offset": 42 } }, "WorkflowVersionList": { "type": "object", "required": [ "items" ], "properties": { "items": { "type": "array", "description": "Newest first.", "items": { "$ref": "#/components/schemas/WorkflowVersion" } } }, "example": { "items": [ "Example WorkflowVersion" ] } }, "WorkflowPublishResult": { "type": "object", "required": [ "workflow", "version", "warnings" ], "properties": { "workflow": { "$ref": "#/components/schemas/WorkflowDetail" }, "version": { "$ref": "#/components/schemas/WorkflowVersion" }, "warnings": { "type": "array", "description": "Advice that does not stop publishing, such as a block nothing leads to.", "items": { "$ref": "#/components/schemas/WorkflowIssue" } } }, "example": { "workflow": null, "version": null, "warnings": [ "Example WorkflowIssue" ] } }, "WorkflowCounter": { "type": "object", "required": [ "id", "total" ], "properties": { "id": { "type": "string", "description": "The block or connection counted." }, "total": { "type": "integer" } }, "example": { "id": "Example id", "total": 42 } }, "WorkflowStats": { "type": "object", "description": "What visitors did in a range of days. Only counts: how many reached a block, took a connection, or failed to be\nmoved on. No visitor and no value a visitor typed is ever stored.\n", "required": [ "workflowId", "from", "to", "nodes", "edges", "failed" ], "properties": { "workflowId": { "type": "string", "format": "uuid" }, "versionId": { "type": "string", "format": "uuid", "nullable": true, "description": "The version counted, or null when all versions are." }, "from": { "type": "string", "description": "First UTC day counted (YYYY-MM-DD)." }, "to": { "type": "string", "description": "Last UTC day counted (YYYY-MM-DD)." }, "started": { "type": "integer", "nullable": true, "description": "Visitors who started the workflow in the range; null when all versions are counted." }, "nodes": { "type": "array", "description": "Visitors who reached each block.", "items": { "$ref": "#/components/schemas/WorkflowCounter" } }, "edges": { "type": "array", "description": "Visitors who took each connection.", "items": { "$ref": "#/components/schemas/WorkflowCounter" } }, "failed": { "type": "array", "description": "Times moving on to a block failed and the visitor stayed, whatever the reason: every failure is counted here,\nincluding the ones whose browser did not say why. A try is counted, not a visitor: a step is tried once more\nafter 30 seconds, so one visitor can count twice.\n", "items": { "$ref": "#/components/schemas/WorkflowCounter" } }, "failedReasons": { "type": "array", "description": "Why those failed, where the visitor's browser said why: one entry for each block and reason that has a count. The\nreasons of a block add up to at most its `failed` total, never more: a failure reported by an embed that does not\nsay why (an older one) is in `failed` and in none of these, so a block whose reasons add up to less has some of\nunknown reason. Empty when no failure in the range had a reason. Sent by gateways that keep reasons; a client\nthat reads a gateway without them treats a missing list as empty.\n", "items": { "$ref": "#/components/schemas/WorkflowFailureReasonCounter" } } }, "example": { "workflowId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "versionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "from": "Example from", "to": "Example to", "started": 42, "nodes": [ "Example WorkflowCounter" ], "edges": [ "Example WorkflowCounter" ], "failed": [ "Example WorkflowCounter" ], "failedReasons": [ "Example WorkflowFailureReasonCounter" ] } }, "WorkflowFailureReason": { "type": "string", "enum": [ "timeout", "widget_error", "build", "other" ], "description": "Why a composition could not be shown to a visitor. `timeout`: it did not appear in time (the embed waits eight\nseconds). `widget_error`: the widget in it reported an error. `build`: the embed could not build it at all. `other`:\nanother step was already on its way, or the page was going away. A closed list: never a message and never a code a\nwidget chose.\n" }, "WorkflowFailureReasonCounter": { "type": "object", "required": [ "id", "reason", "total" ], "properties": { "id": { "type": "string", "description": "The block (a composition) that could not be shown." }, "reason": { "$ref": "#/components/schemas/WorkflowFailureReason" }, "total": { "type": "integer", "description": "How many tries failed for this reason." } }, "example": { "id": "Example id", "reason": null, "total": 42 } }, "WorkflowCompositionField": { "type": "object", "required": [ "table", "column", "label", "type" ], "properties": { "table": { "type": "string" }, "column": { "type": "string" }, "label": { "type": "string" }, "type": { "type": "string", "enum": [ "text", "number", "boolean" ] } }, "example": { "table": "Example table", "column": "Example column", "label": "Example label", "type": "Example type" } }, "WorkflowCompositionAction": { "type": "object", "required": [ "id", "metric", "label" ], "properties": { "id": { "type": "string", "description": "What the trigger stores to say which action it waits for. It is the goal, and the element when the goal\nnames one (clicks, or clicks@.buy-now).\n" }, "metric": { "type": "string", "description": "The goal's metric (clicks, submissions or plays)." }, "label": { "type": "string" }, "selector": { "type": "string", "nullable": true, "description": "The element the goal is about, when it names one." } }, "example": { "id": "Example id", "metric": "Example metric", "label": "Example label", "selector": "Example selector" } }, "WorkflowCompositionOption": { "type": "object", "description": "One composition a workflow can show, and what it can feed into a workflow. `inputs` is enabled only when the\ncomposition declares at least one table a visitor's entries can be written to; `actions` only when its\npublished widget version declares at least one goal. When one is not enabled, `reason` says why.\n", "required": [ "id", "name", "published", "allowedWebsites", "inputs", "actions" ], "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "thumbnailUrl": { "type": "string", "nullable": true }, "published": { "type": "boolean", "description": "Whether the composition can be shown at all (its widget has a published version)." }, "allowedWebsites": { "type": "array", "description": "The websites the composition may be embedded on; empty means anywhere.", "items": { "type": "string" } }, "inputs": { "type": "object", "required": [ "enabled", "tables", "fields" ], "properties": { "enabled": { "type": "boolean" }, "reason": { "type": "string", "nullable": true, "description": "Why Input added is not available. widget_keeps_no_data means the composition declares no table a\nvisitor's entries are written to; widget_not_published means the widget has no published version.\n", "enum": [ "widget_keeps_no_data", "widget_not_published" ] }, "tables": { "type": "array", "description": "Every table a visitor's entries are written to, including one with no field a rule may read.", "items": { "type": "string" } }, "fields": { "type": "array", "description": "The columns of those tables a rule may read. Not offered are id and created_at, columns that are not\ntext, a number or yes/no, and columns whose name says they hold a person's private details (an email,\na phone number), because a value a rule reads is handed to the visitor's page.\n", "items": { "$ref": "#/components/schemas/WorkflowCompositionField" } } } }, "actions": { "type": "object", "required": [ "enabled", "items" ], "properties": { "enabled": { "type": "boolean" }, "reason": { "type": "string", "nullable": true, "description": "Why Action in the widget is not available. widget_reports_no_actions means the published widget\ndeclares no goals; widget_not_published means the widget has no published version.\n", "enum": [ "widget_reports_no_actions", "widget_not_published" ] }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowCompositionAction" } } } } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Example name", "thumbnailUrl": "Example thumbnailUrl", "published": true, "allowedWebsites": [], "inputs": {}, "actions": {} } }, "WorkflowCompositionOptions": { "type": "object", "required": [ "items", "total", "limit", "offset" ], "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/WorkflowCompositionOption" } }, "total": { "type": "integer" }, "limit": { "type": "integer" }, "offset": { "type": "integer" } }, "example": { "items": [ "Example WorkflowCompositionOption" ], "total": 42, "limit": 42, "offset": 42 } }, "WorkflowRemoved": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "example": true } }, "example": { "removed": true } }, "WorkflowPresetWidget": { "type": "object", "description": "A widget a starting point shows.", "required": [ "name", "thumbnailUrl" ], "properties": { "name": { "type": "string" }, "thumbnailUrl": { "type": "string", "nullable": true } }, "example": { "name": "Example name", "thumbnailUrl": "Example thumbnailUrl" } }, "WorkflowPresetChoice": { "type": "object", "description": "A place to start a new workflow: a published workflow that Widgetic offers (or, for one of a partner's customers,\nthat the partner offers). Starting from it gives you your own copy of every widget it chains, a composition of\nyour own on each copy, and a draft workflow wired like it.\n", "required": [ "key", "title", "description", "blockCount", "widgets" ], "properties": { "key": { "type": "string", "description": "What `createWorkspaceWorkflowFromPreset` takes to say which starting point.", "example": "welcome-then-offer" }, "title": { "type": "string", "description": "The title the offerer gave it, or the name of the workflow it is made from." }, "description": { "type": "string", "nullable": true }, "blockCount": { "type": "integer", "description": "How many blocks it has (compositions, triggers and conditions)." }, "widgets": { "type": "array", "description": "The widgets it shows, once each, in the order they first appear.", "items": { "$ref": "#/components/schemas/WorkflowPresetWidget" } } }, "example": { "key": "welcome-then-offer", "title": "Example title", "description": "Example description", "blockCount": 42, "widgets": [ "Example WorkflowPresetWidget" ] } }, "WorkflowPresetChoices": { "type": "object", "required": [ "items" ], "properties": { "items": { "type": "array", "description": "The starting points, in the order the offerer set (smallest position first, then by key).", "items": { "$ref": "#/components/schemas/WorkflowPresetChoice" } } }, "example": { "items": [ "Example WorkflowPresetChoice" ] } }, "OfferedWorkflowPresetWidget": { "type": "object", "description": "A widget an offered starting point shows.", "required": [ "id", "name", "thumbnailUrl" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "Your own widget." }, "name": { "type": "string" }, "thumbnailUrl": { "type": "string", "nullable": true } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Example name", "thumbnailUrl": "Example thumbnailUrl" } }, "OfferedWorkflowPreset": { "type": "object", "description": "A workflow you offer as a place to start, and what became of it. People start from it with their own copy of every\nwidget it chains, a composition of their own on each copy, and a draft workflow wired like its live version.\n", "required": [ "key", "workflowId", "title", "description", "position", "available", "unavailableReason", "workflowName", "blockCount", "widgets", "createdAt", "updatedAt" ], "properties": { "key": { "type": "string", "description": "The name your code and the picker use for the starting point.", "example": "welcome-then-offer" }, "workflowId": { "type": "string", "format": "uuid", "description": "The workflow it is made from. What people get is its live version as it is when they start." }, "title": { "type": "string", "nullable": true, "description": "What the picker shows. Null means show the workflow's name." }, "description": { "type": "string", "nullable": true }, "position": { "type": "integer", "description": "The list is ordered by this, smallest first, then by key." }, "available": { "type": "boolean", "description": "Whether people can start from it now. A starting point that is not available is not shown to anyone, and says why." }, "unavailableReason": { "type": "string", "nullable": true, "enum": [ "workflow_missing", "workflow_not_own", "workflow_archived", "workflow_not_published", "workflow_empty", "composition_not_own", "too_many_widgets", "widget_not_preset" ], "description": "Why it is not available. `workflow_missing`: the workflow was deleted. `workflow_not_own`: it is no longer a\nworkflow of your own. `workflow_archived`: unarchive it. `workflow_not_published`: it has no live version.\n`workflow_empty`: it shows no composition. `composition_not_own`: a block shows a composition made for a\ncustomer or a team. `too_many_widgets`: it chains more than 10 widgets. `widget_not_preset`: a widget it\nchains is no longer offered as a preset.\n" }, "workflowName": { "type": "string", "nullable": true, "description": "The workflow's name. Null when the workflow is gone." }, "blockCount": { "type": "integer", "nullable": true, "description": "How many blocks its live version has. Null when it is not available." }, "widgets": { "type": "array", "description": "The widgets it chains, once each, in the order they first appear. Empty when it is not available.", "items": { "$ref": "#/components/schemas/OfferedWorkflowPresetWidget" } }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "example": { "key": "welcome-then-offer", "workflowId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "title": "Example title", "description": "Example description", "position": 42, "available": true, "unavailableReason": "Example unavailableReason", "workflowName": "Example workflowName", "blockCount": 42, "widgets": [ "Example OfferedWorkflowPresetWidget" ], "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z" } }, "OfferedWorkflowPresetList": { "type": "object", "required": [ "items" ], "properties": { "items": { "type": "array", "items": { "$ref": "#/components/schemas/OfferedWorkflowPreset" } } }, "example": { "items": [ "Example OfferedWorkflowPreset" ] } }, "OfferWorkflowPresetRequest": { "type": "object", "additionalProperties": false, "required": [ "workflowId" ], "properties": { "workflowId": { "type": "string", "format": "uuid", "description": "One of your own published workflows." }, "title": { "type": "string", "nullable": true, "minLength": 1, "maxLength": 120, "description": "What the picker shows. Leave it out to show the workflow's name." }, "description": { "type": "string", "nullable": true, "maxLength": 500 }, "position": { "type": "integer", "minimum": 0, "maximum": 10000, "default": 0, "description": "Where it sits in the list. Smallest first; the same position is ordered by key." } }, "example": { "workflowId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "title": "Example title", "description": "Example description", "position": 42 } }, "WorkflowPresetRemoval": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "description": "False when nothing was offered under that key." } }, "example": { "removed": true } }, "ApiKeyScope": { "type": "string", "enum": [ "content:read", "content:write", "generate", "partner:read", "partner:write", "billing:read", "billing:write", "account:read", "account:write" ], "description": "One thing an API key may be allowed to do. A key made with a list of scopes does only what the list\nnames; a key made without one has full access, and does everything its owner can.\n\n- `content:read` reads widgets, compositions, canvases, projects, folders, uploads, translations and the\n analytics of your content.\n- `content:write` creates, changes, publishes and deletes the same. It includes `content:read`.\n- `generate` runs the AI that builds widgets and compositions, and follows or cancels what it is doing.\n This spends credits.\n- `partner:read` reads managed users, what they spent, presets, the contract and the storage destination.\n- `partner:write` creates, changes and deletes managed users and presets. It includes `partner:read`.\n- `billing:read` reads credits, usage, invoices, subscriptions and payment methods.\n- `billing:write` buys credits, pays invoices and changes a subscription or a payment method. It\n includes `billing:read`.\n- `account:read` reads the profile, organizations and members, allowed domains, notices and the names\n of API keys.\n- `account:write` changes the profile, organizations and members, allowed domains and integrations. It\n includes `account:read`.\n\nStarting an editor session for a managed user needs `partner:write`, `content:write` and `generate`\ntogether. Making, changing and deleting keys, exchanging tokens, signing in and the administration\nroutes need full access: a limited key cannot make itself a bigger one.\n\nA request outside the scopes of the key is refused with 403 and the code `API_KEY_SCOPE_MISSING`.\n`error.details.missingScopes` names what a new key needs, and `error.details.fullAccessRequired` is true\nwhen no list of scopes would have been enough. The scopes of a key cannot be changed once it is made." }, "Upload": { "type": "object", "description": "A file stored for the account that uploaded it.", "required": [ "id", "url", "mime_type", "file_name", "file_size", "storage_key", "context_type", "source" ], "properties": { "id": { "type": "string", "format": "uuid" }, "url": { "type": "string", "format": "uri", "description": "The public address of the stored file" }, "mime_type": { "type": "string", "description": "The type of the stored file. A HEIC or HEIF photo is stored as `image/jpeg`.", "example": "image/png" }, "file_name": { "type": "string" }, "file_size": { "type": "integer", "description": "Size of the stored file, in bytes" }, "width": { "type": "integer", "nullable": true, "description": "Width in pixels, for images" }, "height": { "type": "integer", "nullable": true, "description": "Height in pixels, for images" }, "storage_key": { "type": "string", "description": "Where the file sits in its storage bucket" }, "context_type": { "type": "string", "enum": [ "widget-codegen", "browser-ic", "content-property" ], "description": "What the file was uploaded for. Media for widget content is `content-property`." }, "source": { "type": "string", "enum": [ "chat-upload", "chat-screenshot", "browser-ic-screenshot", "preview-screenshot", "file-browser-upload", "widget-visitor-upload" ], "description": "Which part of the product, or which client, uploaded the file. `widget-visitor-upload` is a file a visitor sent through a widget's upload adapter; it cannot be asked for when uploading." }, "widget_id": { "type": "string", "format": "uuid", "nullable": true }, "conversation_id": { "type": "string", "format": "uuid", "nullable": true }, "managed_user_id": { "type": "string", "format": "uuid", "nullable": true, "description": "The managed user the file was uploaded for, or null when it is the account's own. List one managed user's files with the `managed_user_id` or `managed_user_external_id` query parameter of `listUploads`." }, "managed_user_external_id": { "type": "string", "nullable": true, "description": "Your own id for that managed user (the `externalId` you registered it with). Only in the list of a partner's own workspace (`listUploads`); null for the account's own files." }, "purpose": { "type": "string", "nullable": true, "enum": [ "canvas", "chat", "field" ], "description": "Where in the product the partner uses the file, or null when unknown" }, "library_folder_path": { "type": "string", "nullable": true, "description": "The Media Library folder the file belongs to when it is part of the brand kit (for example `Brand kit/Fonts/Inter` or `Brand kit/Logos`), or null for every other file" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "url": "Example url", "mime_type": "image/png", "file_name": "Example file_name", "file_size": 42, "width": 42, "height": 42, "storage_key": "Example storage_key", "context_type": "Example context_type", "source": "Example source", "widget_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "conversation_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managed_user_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managed_user_external_id": "Example managed_user_external_id", "purpose": "Example purpose", "library_folder_path": "Example library_folder_path" } }, "UploadLimits": { "type": "object", "description": "What the upload endpoints accept. Read it rather than hard-coding the numbers.", "properties": { "multipart_max_bytes": { "type": "integer", "description": "The largest file `uploadFile` takes in one request, in bytes. The same for every account." }, "multipart_mime_types": { "type": "array", "items": { "type": "string" }, "description": "The file types `uploadFile` takes for media (`content-property` uploads)" }, "tus_enabled": { "type": "boolean", "description": "Whether resumable uploads are switched on. They need a signed-in session; an API key uses `uploadFile`." }, "tus_max_bytes": { "type": "integer", "description": "The largest file a resumable upload takes, in bytes (250 MB by default). The same for every account, whatever its plan. A file over `multipart_max_bytes` goes through a resumable upload." }, "tus_chunk_size_bytes": { "type": "integer", "description": "The chunk size resumable uploads are tuned for, in bytes. A client may send smaller or larger chunks." }, "tus_mime_types": { "type": "array", "items": { "type": "string" } } }, "example": { "multipart_max_bytes": 42, "multipart_mime_types": [], "tus_enabled": true, "tus_max_bytes": 42, "tus_chunk_size_bytes": 42, "tus_mime_types": [] } }, "MyPartner": { "type": "object", "description": "A partner as the person who administers it reads it: which partner it is, what standing it is in, and why it is paused when it is. The webhook address, its secret and the billing settings have their own routes and are not part of it.\n", "required": [ "id", "name", "status", "allowedDomains", "platformDomain", "suspendedAt", "suspensionReason", "partnership" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "The id every other partner route asks for (`/partners/{partnerId}/...`)" }, "name": { "type": "string" }, "status": { "type": "string", "enum": [ "active", "inactive", "suspended" ], "description": "`active` while the partner is in force. `inactive` until Widgetic activates it (and after a deactivation). `suspended` while it is paused, which is done by hand and comes back when Widgetic resumes it.\n" }, "contactEmail": { "type": "string", "nullable": true }, "allowedDomains": { "type": "array", "items": { "type": "string" }, "description": "The domains Widgetic added to the embeds of this partner's customers. The domains the person added themselves are on the domains route of the account.\n" }, "platformDomain": { "type": "string", "nullable": true, "example": "acme.com", "description": "The website where the partner integrates Widgetic, as a bare name. It and every subdomain of it (`app.acme.com`, `learn.eu.acme.com`) can always show the partner's widgets, the ones its customers make through it included, and send entries to them, whatever `allowedDomains` and the account's own domain list say, so a list can never lock the partner's own website out. It is not an entry of `allowedDomains`, and it does not turn an empty list into a restriction: a partner that lists nothing stays unrestricted for every website. Widgetic sets it when the partner is set up; contact Widgetic to change it. `null` when none has been set.\n" }, "suspendedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the partner was paused; null unless it is paused now" }, "suspensionReason": { "type": "string", "nullable": true, "description": "The reason given when the partner was paused, as the partner is told it; null unless it is paused now" }, "partnership": { "$ref": "#/components/schemas/MyPartnership" }, "createdAt": { "type": "string", "format": "date-time", "nullable": true } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Example name", "status": "Example status", "contactEmail": "Example contactEmail", "allowedDomains": [], "platformDomain": "acme.com", "suspendedAt": "2026-01-15T09:30:00.000Z", "suspensionReason": "Example suspensionReason", "partnership": null, "createdAt": "2026-01-15T09:30:00.000Z" } }, "MyPartners": { "type": "object", "required": [ "standing", "overdueSince", "partners" ], "properties": { "standing": { "type": "string", "enum": [ "not_a_partner", "inactive", "active", "suspended", "payment_arrears", "winding_down", "closed" ], "description": "The standing of the account as a whole, the word every gate reads: `not_a_partner` when the account administers no partner; otherwise `active` when any of its partners is in force, else `payment_arrears` when the partners that are active each have a contract invoice that is past its due date and unpaid, else `suspended` when any is paused, else `inactive`. `payment_arrears` is not set by anybody: it stops the same things a pause stops (billing, invoices, credits and the other routes a partner needs to pay stay open) and ends by itself the moment the invoice is paid. `winding_down` and `closed` are not set by anybody either: they follow the end date of the partnership. While it winds down the account can read and export its data and nothing can be created or changed (403 `PARTNER_WINDING_DOWN`); once it is closed everything is refused (403 `PARTNER_CLOSED`) except the invoices and billing of the owner signed in on widgetic.com.\n" }, "overdueSince": { "type": "string", "format": "date-time", "nullable": true, "description": "When the oldest overdue contract invoice was due; null unless `standing` is `payment_arrears`. Pay the invoices in the list of `GET /invoices/partner/{partnerId}` that are past their due date to end it.\n" }, "partners": { "type": "array", "items": { "$ref": "#/components/schemas/MyPartner" }, "description": "The partners the account administers (nearly always one), the oldest first" } }, "example": { "standing": "Example standing", "overdueSince": "2026-01-15T09:30:00.000Z", "partners": [ "Example MyPartner" ] } }, "RequestExtraCredits": { "type": "object", "required": [ "usd" ], "properties": { "usd": { "type": "number", "minimum": 10, "maximum": 100000, "description": "The dollars to spend on credits, to the cent: at least 10, at most 100000 in one request. The invoice is for the most whole credits that money buys at the list price of a credit, so it is never for more than this, and can be a few cents under it.\n", "example": 250 } }, "example": { "usd": 250 } }, "PartnerExtraCreditsInvoice": { "type": "object", "description": "The invoice for extra credits that was issued, and what paying it adds.", "required": [ "invoiceId", "number", "hostedInvoiceUrl", "pdfUrl", "credits", "creditPriceUsd", "amountUsd", "taxUsd", "totalUsd", "currency", "dueDate", "dueDays" ], "properties": { "invoiceId": { "type": "string", "description": "Stripe's id for the invoice." }, "number": { "type": "string", "nullable": true, "description": "The number printed on the invoice, once Stripe has numbered it." }, "hostedInvoiceUrl": { "type": "string", "format": "uri", "nullable": true, "description": "The page where the invoice is viewed and paid." }, "pdfUrl": { "type": "string", "format": "uri", "nullable": true, "description": "A PDF of the invoice." }, "credits": { "type": "integer", "description": "The credits paying the invoice adds, once and for good. They do not expire." }, "creditPriceUsd": { "type": "number", "description": "What one credit costs, in dollars. It is the list price, not the price of the contract." }, "amountUsd": { "type": "number", "description": "The price of those credits, in dollars, before tax. Never more than `usd` of the request." }, "taxUsd": { "type": "number", "description": "The tax added to the invoice, in dollars (0 when there is none)." }, "totalUsd": { "type": "number", "description": "What is paid, in dollars. The price plus the tax." }, "currency": { "type": "string", "description": "The currency of the invoice, in upper case (USD)." }, "dueDate": { "type": "string", "format": "date-time", "nullable": true, "description": "When payment is due, as printed on the invoice." }, "dueDays": { "type": "integer", "description": "How many days there are to pay." } }, "example": { "invoiceId": "Example invoiceId", "number": "Example number", "hostedInvoiceUrl": "Example hostedInvoiceUrl", "pdfUrl": "Example pdfUrl", "credits": 42, "creditPriceUsd": 42, "amountUsd": 42, "taxUsd": 42, "totalUsd": 42, "currency": "Example currency", "dueDate": "2026-01-15T09:30:00.000Z", "dueDays": 42 } }, "PartnerBillingOverview": { "type": "object", "required": [ "partner", "operationalCredits", "billingIntegration" ], "description": "The partner's credits, contract terms and billing status in one answer.", "properties": { "partner": { "type": "object", "required": [ "id", "name", "isActive", "tier" ], "properties": { "id": { "type": "string", "format": "uuid" }, "name": { "type": "string" }, "isActive": { "type": "boolean" }, "tier": { "type": "string", "enum": [ "partner", "standard" ], "description": "`partner` once a contract has been recorded for the partner" } } }, "operationalCredits": { "type": "object", "required": [ "balance", "reservedBalance", "availableBalance", "recentTransactions" ], "properties": { "balance": { "type": "number", "description": "Credits the account holds" }, "reservedBalance": { "type": "number", "description": "Credits committed to an operation that is still running. Not spendable." }, "availableBalance": { "type": "number", "description": "What a new operation can use (`balance` minus `reservedBalance`, never below 0)" }, "recentTransactions": { "type": "array", "description": "The ten newest ledger entries, newest first", "items": { "$ref": "#/components/schemas/AccountCreditTransaction" } } }, "description": "The partner's credits: what the partner's workspace holds in the account that pays for the partner (its administrator's), and the newest entries of that workspace's ledger. A partner with no administrator reads 0 and an empty list.\n" }, "partnerCustomization": { "nullable": true, "description": "The partner's contract; null while none has been recorded", "allOf": [ { "$ref": "#/components/schemas/PartnerCustomization" } ] }, "billingIntegration": { "type": "object", "required": [ "hasPartnerPlan", "usesCustomPricing", "billingCycle", "contractActive" ], "properties": { "hasPartnerPlan": { "type": "boolean" }, "usesCustomPricing": { "type": "boolean", "description": "True when a price was agreed on the contract" }, "billingCycle": { "type": "string", "enum": [ "monthly", "quarterly", "annual" ] }, "contractActive": { "type": "boolean" } } } }, "example": { "partner": {}, "operationalCredits": {}, "partnerCustomization": null, "billingIntegration": {} } }, "PartnerContract": { "type": "object", "description": "The commercial terms agreed with a partner. Prices are in dollars. Internal negotiation notes and the staff members who edited the record are not part of it.\n", "properties": { "id": { "type": "string", "format": "uuid" }, "partnerId": { "type": "string", "format": "uuid" }, "customPrice": { "type": "number", "nullable": true, "description": "The agreed price per `billingCycle`; null when the standard price applies" }, "customCredits": { "type": "integer", "nullable": true, "description": "Credits received each billing period (`billingCycle`); null when the standard allowance applies" }, "creditPriceUsd": { "type": "number", "nullable": true, "description": "The agreed price of one credit, in dollars; null when the list price applies" }, "effectiveCreditPriceUsd": { "type": "number", "description": "What one credit costs you, in dollars. The agreed price, or the list price when none was agreed" }, "periodTotalUsd": { "type": "number", "nullable": true, "description": "What one billing period costs, in dollars before tax, `customCredits` times `effectiveCreditPriceUsd`. Null while no credits were agreed" }, "additionalFeatures": { "type": "array", "items": { "type": "string" }, "description": "Features included beyond the standard partner plan" }, "billingCycle": { "type": "string", "enum": [ "monthly", "quarterly", "annual" ] }, "minimumCommitmentMonths": { "type": "integer" }, "supportSla": { "type": "string", "example": "99.9%" }, "contractStartDate": { "type": "string", "format": "date", "nullable": true }, "contractEndDate": { "type": "string", "format": "date", "nullable": true, "description": "Null when the contract runs until it is ended" }, "isActiveContract": { "type": "boolean", "description": "True while the contract is in force, that is when it is open-ended or today falls between its start and end" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "customPrice": 42, "customCredits": 42, "creditPriceUsd": 42, "effectiveCreditPriceUsd": 42, "periodTotalUsd": 42, "additionalFeatures": [], "billingCycle": "Example billingCycle", "minimumCommitmentMonths": 42, "supportSla": "99.9%", "contractStartDate": "Example contractStartDate", "contractEndDate": "Example contractEndDate", "isActiveContract": true, "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z" } }, "PartnerStorageDestination": { "type": "object", "description": "The bucket a partner keeps the files its account uploads in: a bucket on an S3-compatible service that the partner owns. The secret access key is never returned.\n", "required": [ "partnerId", "endpoint", "region", "bucket", "keyPrefix", "publicBaseUrl", "forcePathStyle", "accessKeyHint", "verifiedAt", "updatedAt" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "endpoint": { "type": "string", "description": "The HTTPS address of the S3-compatible service, scheme and host only", "example": "https://abc123.r2.cloudflarestorage.com" }, "region": { "type": "string", "example": "auto" }, "bucket": { "type": "string", "example": "acme-widget-media" }, "keyPrefix": { "type": "string", "description": "The folder inside the bucket every file is written under. Empty, or folders each followed by a slash.", "example": "widgetic/" }, "publicBaseUrl": { "type": "string", "description": "Where the stored files are served from. A file's url is this address, a slash and the file's key.", "example": "https://media.example.com" }, "forcePathStyle": { "type": "boolean", "description": "Whether the bucket name goes in the path of a request (true) or in the host name (false)" }, "accessKeyHint": { "type": "string", "description": "The last four characters of the access key id, to tell which key is set. Not enough to use it.", "example": "4F2A" }, "verifiedAt": { "type": "string", "format": "date-time", "description": "When the destination last passed the check" }, "lastVerificationError": { "type": "string", "nullable": true, "description": "Why the most recent re-check failed. Null while the last check passed." }, "lastVerificationFailedAt": { "type": "string", "format": "date-time", "nullable": true }, "updatedAt": { "type": "string", "format": "date-time" } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "endpoint": "https://abc123.r2.cloudflarestorage.com", "region": "auto", "bucket": "acme-widget-media", "keyPrefix": "widgetic/", "publicBaseUrl": "https://media.example.com", "forcePathStyle": true, "accessKeyHint": "4F2A", "verifiedAt": "2026-01-15T09:30:00.000Z", "lastVerificationError": "Example lastVerificationError", "lastVerificationFailedAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z" } }, "SetPartnerStorageDestinationRequest": { "type": "object", "description": "The bucket to keep the partner's files in, and the key that may write to it. The field names are camelCase, like every answer of the API; the snake_case spelling (`keyPrefix`) is read too.\n", "additionalProperties": false, "required": [ "endpoint", "region", "bucket", "publicBaseUrl", "accessKeyId", "secretAccessKey" ], "properties": { "endpoint": { "type": "string", "description": "The HTTPS address of the S3-compatible service, scheme and host only (no path, port or credentials). It must be a host name, not an IP address, and must resolve to the public internet.\n", "example": "https://abc123.r2.cloudflarestorage.com" }, "region": { "type": "string", "description": "The region the service signs requests for. Use auto where the service says so (such as Cloudflare R2).", "example": "auto" }, "bucket": { "type": "string", "example": "acme-widget-media" }, "keyPrefix": { "type": "string", "default": "", "description": "A folder inside the bucket to write every file under, for example widgetic/uploads. Folders are made of letters, digits, dots, hyphens and underscores. Leave it out to write at the root of the bucket.\n", "example": "widgetic/" }, "publicBaseUrl": { "type": "string", "description": "Where the stored files are served from: the bucket's public address, or a CDN in front of it. The address of a file is this value, a slash and the file's key in the bucket, which starts with the key prefix. A path is allowed (https://media.example.com/files/acme-widget-media).\n", "example": "https://media.example.com" }, "forcePathStyle": { "type": "boolean", "default": true, "description": "Put the bucket name in the path of a request. Every S3-compatible service supports this; set it to false only for a service that needs the bucket name in the host name.\n" }, "accessKeyId": { "type": "string", "description": "The id of an access key that may put objects into the bucket" }, "secretAccessKey": { "type": "string", "format": "password", "writeOnly": true, "description": "The secret of that access key. It is stored encrypted and is never returned." } }, "example": { "endpoint": "https://abc123.r2.cloudflarestorage.com", "region": "auto", "bucket": "acme-widget-media", "keyPrefix": "widgetic/", "publicBaseUrl": "https://media.example.com", "forcePathStyle": true, "accessKeyId": "Example accessKeyId", "secretAccessKey": "Example secretAccessKey" } }, "PartnerStorageRemoval": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "description": "False when the partner had no storage destination to remove" } }, "example": { "removed": true } }, "PartnerPreset": { "type": "object", "description": "A widget the partner offers its managed users as a starting point, under a key the partner's code names. It belongs to the partner's account, so every managed user of the partner sees the same list.\n", "required": [ "key", "widgetId", "title", "description", "position", "widgetName", "thumbnailUrl", "createdAt", "updatedAt" ], "properties": { "key": { "type": "string", "description": "The name the partner's code uses for the preset", "example": "rating" }, "widgetId": { "type": "string", "format": "uuid", "description": "The partner's widget. Use it to make a composition (`createComposition` with this `widgetId`)." }, "title": { "type": "string", "nullable": true, "description": "What the partner's picker shows. Null means show `widgetName`.", "example": "Star rating" }, "description": { "type": "string", "nullable": true }, "position": { "type": "integer", "description": "The list is ordered by this, smallest first, then by key" }, "widgetName": { "type": "string", "description": "The widget's own name" }, "thumbnailUrl": { "type": "string", "nullable": true, "description": "The widget's thumbnail, when it has one" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } }, "example": { "key": "rating", "widgetId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "title": "Star rating", "description": "Example description", "position": 42, "widgetName": "Example widgetName", "thumbnailUrl": "Example thumbnailUrl", "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z" } }, "SetPartnerPresetRequest": { "type": "object", "additionalProperties": false, "required": [ "widgetId" ], "properties": { "widgetId": { "type": "string", "format": "uuid", "description": "One of the partner's own widgets. A widget is a preset under at most one key." }, "title": { "type": "string", "nullable": true, "minLength": 1, "maxLength": 120, "description": "What your picker shows. Leave it out to show the widget's own name." }, "description": { "type": "string", "nullable": true, "maxLength": 500 }, "position": { "type": "integer", "minimum": 0, "maximum": 10000, "default": 0, "description": "Where the preset sits in the list. Smallest first; presets with the same position are ordered by key." } }, "example": { "widgetId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "title": "Example title", "description": "Example description", "position": 42 } }, "PartnerPresetRemoval": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "description": "False when there was no preset under that key" } }, "example": { "removed": true } }, "PartnerReportPage": { "type": "object", "description": "Which part of a list the answer holds.", "required": [ "limit", "offset", "hasMore" ], "properties": { "limit": { "type": "integer", "description": "How many rows the page can hold at most" }, "offset": { "type": "integer", "description": "How many rows were skipped before this page" }, "hasMore": { "type": "boolean", "description": "True when more rows follow this page. Ask again with `offset` raised by `limit`." } }, "example": { "limit": 42, "offset": 42, "hasMore": true } }, "PartnerReportPeriod": { "type": "object", "description": "The stretch of time a report covers.", "required": [ "from", "to" ], "properties": { "from": { "type": "string", "format": "date-time", "description": "Start of the period, included" }, "to": { "type": "string", "format": "date-time", "description": "End of the period, not included" } }, "example": { "from": "2026-01-15T09:30:00.000Z", "to": "2026-01-15T09:30:00.000Z" } }, "PartnerStorageUsageTotals": { "type": "object", "description": "What a group of files weigh, and how much of it is kept where.", "required": [ "fileCount", "totalBytes", "widgeticStorageBytes", "partnerStorageBytes" ], "properties": { "fileCount": { "type": "integer", "format": "int64" }, "totalBytes": { "type": "integer", "format": "int64", "description": "The size of all the files together, in bytes" }, "widgeticStorageBytes": { "type": "integer", "format": "int64", "description": "The part of `totalBytes` that is kept in Widgetic's storage" }, "partnerStorageBytes": { "type": "integer", "format": "int64", "description": "The part of `totalBytes` that is kept in your own storage destination" } }, "example": { "fileCount": 42, "totalBytes": 42, "widgeticStorageBytes": 42, "partnerStorageBytes": 42 } }, "PartnerStorageUsageOfManagedUser": { "type": "object", "description": "The files filed under one managed user. The row with a null `managedUserId` is the files that are not filed under any: your own, and the ones uploaded without naming a managed user.\n", "required": [ "managedUserId", "externalId", "name", "isActive", "fileCount", "totalBytes", "widgeticStorageBytes", "partnerStorageBytes", "lastUploadAt" ], "properties": { "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "Widgetic's id for the managed user. Null for the files that are not filed under one." }, "externalId": { "type": "string", "nullable": true, "description": "Your own identifier for the managed user" }, "name": { "type": "string", "nullable": true }, "isActive": { "type": "boolean", "nullable": true, "description": "False when the managed user is switched off" }, "fileCount": { "type": "integer", "format": "int64" }, "totalBytes": { "type": "integer", "format": "int64" }, "widgeticStorageBytes": { "type": "integer", "format": "int64" }, "partnerStorageBytes": { "type": "integer", "format": "int64" }, "lastUploadAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the newest of these files was stored" } }, "example": { "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "externalId": "Example externalId", "name": "Example name", "isActive": true, "fileCount": 42, "totalBytes": 42, "widgeticStorageBytes": 42, "partnerStorageBytes": 42, "lastUploadAt": "2026-01-15T09:30:00.000Z" } }, "PartnerStorageUsage": { "type": "object", "description": "What a partner's customers store. `totals` is every file kept for the partner's account; `managedUsers` splits it by the managed user each file is filed under, the heaviest first.\n", "required": [ "partnerId", "totals", "managedUsers", "page" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "totals": { "$ref": "#/components/schemas/PartnerStorageUsageTotals" }, "managedUsers": { "type": "array", "items": { "$ref": "#/components/schemas/PartnerStorageUsageOfManagedUser" } }, "page": { "$ref": "#/components/schemas/PartnerReportPage" } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "totals": null, "managedUsers": [ "Example PartnerStorageUsageOfManagedUser" ], "page": null } }, "PartnerAnalyticsSummary": { "type": "object", "description": "What was done with the partner's published widgets in a period.", "required": [ "partnerId", "period", "managedUserId", "views", "interactions", "visitors", "compositionsViewed", "managedUsersViewed" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "period": { "$ref": "#/components/schemas/PartnerReportPeriod" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The managed user the report is narrowed to. Null for the whole account." }, "views": { "type": "integer", "format": "int64", "description": "How many times a composition was shown to a visitor" }, "interactions": { "type": "integer", "format": "int64", "description": "How many times a visitor did something with a composition" }, "visitors": { "type": "integer", "format": "int64", "description": "How many different visitors viewed. A visitor is a browsing session; an event that carries no session is counted for the signed-in user instead. An event that carries neither is a view and no visitor.\n" }, "compositionsViewed": { "type": "integer", "format": "int64", "description": "How many different compositions were viewed" }, "managedUsersViewed": { "type": "integer", "format": "int64", "description": "How many different managed users had a composition viewed" } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "period": null, "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "views": 42, "interactions": 42, "visitors": 42, "compositionsViewed": 42, "managedUsersViewed": 42 } }, "PartnerAnalyticsOfManagedUser": { "type": "object", "description": "What one managed user's widgets and compositions did in a period.", "required": [ "managedUserId", "externalId", "name", "isActive", "widgetsMade", "compositionsMade", "views", "interactions", "visitors", "lastEventAt" ], "properties": { "managedUserId": { "type": "string", "format": "uuid" }, "externalId": { "type": "string", "nullable": true, "description": "Your own identifier for the managed user" }, "name": { "type": "string", "nullable": true }, "isActive": { "type": "boolean", "nullable": true }, "widgetsMade": { "type": "integer", "format": "int64", "description": "How many widgets are filed under the managed user (all time, not only in the period)" }, "compositionsMade": { "type": "integer", "format": "int64", "description": "How many compositions are filed under the managed user (all time, not only in the period)" }, "views": { "type": "integer", "format": "int64" }, "interactions": { "type": "integer", "format": "int64" }, "visitors": { "type": "integer", "format": "int64" }, "lastEventAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the newest counted view or interaction happened. Null when there was none in the period." } }, "example": { "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "externalId": "Example externalId", "name": "Example name", "isActive": true, "widgetsMade": 42, "compositionsMade": 42, "views": 42, "interactions": 42, "visitors": 42, "lastEventAt": "2026-01-15T09:30:00.000Z" } }, "PartnerAnalyticsByManagedUser": { "type": "object", "description": "What each of the partner's managed users did in a period. Every managed user of the partner is listed, also one whose widgets were not viewed, the most viewed first.\n", "required": [ "partnerId", "period", "managedUsers", "page" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "period": { "$ref": "#/components/schemas/PartnerReportPeriod" }, "managedUsers": { "type": "array", "items": { "$ref": "#/components/schemas/PartnerAnalyticsOfManagedUser" } }, "page": { "$ref": "#/components/schemas/PartnerReportPage" } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "period": null, "managedUsers": [ "Example PartnerAnalyticsOfManagedUser" ], "page": null } }, "PartnerAnalyticsOfWidget": { "type": "object", "description": "What one widget's compositions did in a period.", "required": [ "widgetId", "widgetName", "views", "interactions", "visitors", "compositionsViewed" ], "properties": { "widgetId": { "type": "string", "format": "uuid" }, "widgetName": { "type": "string", "nullable": true, "description": "Null when the widget has been deleted since" }, "views": { "type": "integer", "format": "int64" }, "interactions": { "type": "integer", "format": "int64" }, "visitors": { "type": "integer", "format": "int64" }, "compositionsViewed": { "type": "integer", "format": "int64", "description": "How many different compositions of the widget were viewed" } }, "example": { "widgetId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "widgetName": "Example widgetName", "views": 42, "interactions": 42, "visitors": 42, "compositionsViewed": 42 } }, "PartnerAnalyticsTopWidgets": { "type": "object", "description": "The widgets whose compositions were viewed the most in a period, the most viewed first.", "required": [ "partnerId", "period", "managedUserId", "widgets" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "period": { "$ref": "#/components/schemas/PartnerReportPeriod" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The managed user the report is narrowed to. Null for the whole account." }, "widgets": { "type": "array", "items": { "$ref": "#/components/schemas/PartnerAnalyticsOfWidget" } } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "period": null, "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "widgets": [ "Example PartnerAnalyticsOfWidget" ] } }, "PartnerAnalyticsOfDay": { "type": "object", "description": "What was done on one day (UTC).", "required": [ "date", "views", "interactions", "visitors" ], "properties": { "date": { "type": "string", "format": "date" }, "views": { "type": "integer", "format": "int64" }, "interactions": { "type": "integer", "format": "int64" }, "visitors": { "type": "integer", "format": "int64" } }, "example": { "date": "Example date", "views": 42, "interactions": 42, "visitors": 42 } }, "PartnerAnalyticsTimeline": { "type": "object", "description": "What was done on each day of a period.", "required": [ "partnerId", "period", "managedUserId", "days" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "period": { "$ref": "#/components/schemas/PartnerReportPeriod" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The managed user the report is narrowed to. Null for the whole account." }, "days": { "type": "array", "description": "One entry for every day of the period, oldest first. A day nothing happened on is all zeros.", "items": { "$ref": "#/components/schemas/PartnerAnalyticsOfDay" } } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "period": null, "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "days": [ "Example PartnerAnalyticsOfDay" ] } }, "PartnerNotificationEventType": { "type": "string", "description": "What happened. The event types you can be told about.", "enum": [ "invoice.issued", "invoice.due_soon", "invoice.overdue", "invoice.paid", "invoice.failed", "credits.low", "credits.managed_user_cap_reached", "partner.activated", "partner.paused", "partner.resumed", "storage.check_failed", "composition.created", "composition.updated", "widget.published", "upload.created", "entry.created", "workflow.created", "workflow.published", "workflow.state_changed", "workflow.deleted", "partner.ending" ] }, "PartnerNotification": { "type": "object", "description": "One thing that happened to your partner account. The same object is what your webhook receives as `data` of a call (beside `id`, `type`, `createdAt` and `partnerId`), and what the list in your dashboard shows.", "required": [ "id", "type", "title", "body", "tone", "data", "createdAt" ], "properties": { "id": { "type": "string", "format": "uuid" }, "type": { "$ref": "#/components/schemas/PartnerNotificationEventType" }, "title": { "type": "string", "description": "One line that says what happened" }, "body": { "type": "string", "description": "A few sentences that say what happened and what to do about it" }, "tone": { "type": "string", "enum": [ "info", "success", "warning", "error" ], "description": "How serious it is" }, "data": { "type": "object", "additionalProperties": true, "description": "The facts of the event, named in camelCase. An invoice event carries `invoiceNumber`, `subtotal`, `taxAmount`, `total`, `currency`, `dueDate`, `hostedInvoiceUrl` (the page where it is paid) and `purpose` (`contract`, or `extra_credits` for credits you bought on top of the contract: an unpaid invoice for extra credits never stops the account, the credits are just not added until it is paid); a payment adds `paidAt`, a failed payment `reason`, a reminder `daysUntilDue` or `daysOverdue`. A credits event carries `band` (`low` or `empty`), `balance` and `threshold`. `credits.managed_user_cap_reached` (one of your managed users used its monthly credits and a request was refused) goes to your webhook only when subscribed, once per managed user each month, and carries `managedUserId`, `externalId`, `monthlyCredits`, `creditsUsed`, `resetsAt` and `reachedAt`. A standing event carries `status`, `previousStatus` and `reason`; `partner.paused` with `status: payment_arrears` means that an overdue invoice stopped the account (nobody paused it, and `reason` names the invoice), and `partner.resumed` with `previousStatus: payment_arrears` means that its payment ended that. A storage event carries `reason` and `checkedAt`. Content events (`composition.created`, `composition.updated`, `widget.published`, `upload.created`, `entry.created`, `workflow.created`, `workflow.published`, `workflow.state_changed`, `workflow.deleted`) go to your webhook only when subscribed; they do not appear in the dashboard list. `composition.created` carries `compositionId`, `widgetId`, `name`, `managedUserId`, `externalId` and `createdAt`; `composition.updated` carries `compositionId`, `widgetId`, `name`, `managedUserId`, `externalId`, `contentVersion` and `savedAt`, and is sent for the first save of a composition in each five minutes (read the composition for its current state); `widget.published` carries `widgetId`, `name`, `managedUserId`, `externalId`, `version` and `publishedAt`; `upload.created` carries `uploadId`, `name`, `mimeType`, `sizeBytes`, `address`, `managedUserId`, `externalId`, `purpose` and `createdAt`; `entry.created` carries `compositionId`, `table`, `entryId`, `createdAt` and `context` (the host attribution of the embedding page, or null), and none of the values the visitor entered: read those with the entries routes. The four workflow events are about the workflows your managed users make (only a workflow made for a managed user is told; one your own people made is not). `workflow.created` carries `workflowId`, `name`, `managedUserId`, `externalId`, `createdAt` and `presetKey` (the key you gave the starting point the workflow was started from with `setPartnerWorkflowPreset`, or null when it was drawn new or copied), and is sent for a copy of a workflow and for a start from a starting point too; `workflow.published` carries `workflowId`, `name`, `managedUserId`, `externalId`, `versionId`, `versionNumber` (1 for the first publication) and `publishedAt`; `workflow.state_changed` carries `workflowId`, `name`, `managedUserId`, `externalId`, `action` (`pause`, `resume`, `archive` or `unarchive`), `previousStatus` and `status` (each `draft`, `live`, `paused` or `archived`) and `changedAt`; `workflow.deleted` carries `workflowId`, `name`, `managedUserId`, `externalId`, `previousStatus` (the state it was in when it was deleted: `draft`, `live`, `paused` or `archived`) and `deletedAt`, and means that the workflow with its versions and counts is gone (the compositions it chained are not touched). Read the workflow for what it holds now (a deleted one is not found). `partner.ending` tells that the partnership has an end date and where it is on the way to it: it carries `phase` (`ending` while the end date is ahead, `winding_down` for the read-only days after it, `closed` once those are over), `endsOn` and `windDownEndsOn` (dates, `YYYY-MM-DD`) and `daysLeft` (the days to `endsOn` while ending, to `windDownEndsOn` while winding down, null once closed). It is sent when the date is set or changed, at 60, 30, 7 and 1 days before it, when the wind-down starts and ends, and when the account closes, and `partnership` of `getMyPartners` says the same at any time. Ignore an event type you do not know: more may be added. `sendPartnerNotificationTestEvent` sends a sample of every one of them." }, "createdAt": { "type": "string", "format": "date-time" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "type": null, "title": "Example title", "body": "Example body", "tone": "Example tone", "data": {}, "createdAt": "2026-01-15T09:30:00.000Z" } }, "PartnerNotificationPage": { "type": "object", "description": "A page of notifications, the newest first.", "required": [ "notifications", "nextBefore" ], "properties": { "notifications": { "type": "array", "items": { "$ref": "#/components/schemas/PartnerNotification" } }, "nextBefore": { "type": "string", "format": "date-time", "nullable": true, "description": "Send as `before` to get the next, older page. Null when there is none." } }, "example": { "notifications": [ "Example PartnerNotification" ], "nextBefore": "2026-01-15T09:30:00.000Z" } }, "PartnerNotificationDelivery": { "type": "object", "description": "One send of one notification, to one email address or to your webhook. It stays `pending` while it is being tried again, and ends `delivered`, `failed` (given up on) or `cancelled` (nobody wanted it any more, for example because the webhook was switched off).", "required": [ "deliveryId", "notificationId", "eventType", "title", "channel", "target", "status", "attemptCount", "nextAttemptAt", "lastAttemptAt", "deliveredAt", "lastStatusCode", "lastError", "createdAt", "replayOfDeliveryId" ], "properties": { "deliveryId": { "type": "string", "format": "uuid" }, "notificationId": { "type": "string", "format": "uuid" }, "eventType": { "type": "string", "nullable": true, "description": "What the notification was about. Null when the notification has been removed." }, "title": { "type": "string", "nullable": true }, "channel": { "type": "string", "enum": [ "email", "webhook" ] }, "target": { "type": "string", "description": "The email address, or the host of your webhook (never the whole address, which may hold a token)" }, "status": { "type": "string", "enum": [ "pending", "delivered", "failed", "cancelled" ] }, "attemptCount": { "type": "integer" }, "nextAttemptAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the next attempt is made. Null once the delivery has ended." }, "lastAttemptAt": { "type": "string", "format": "date-time", "nullable": true }, "deliveredAt": { "type": "string", "format": "date-time", "nullable": true }, "lastStatusCode": { "type": "integer", "nullable": true, "description": "The HTTP status your webhook answered with at the last attempt, when it answered" }, "lastError": { "type": "string", "nullable": true, "description": "Why the last attempt failed, in a few words. Never what your endpoint replied." }, "createdAt": { "type": "string", "format": "date-time" }, "replayOfDeliveryId": { "type": "string", "format": "uuid", "nullable": true, "description": "When this row is a manual replay, the earlier delivery it sent again" } }, "example": { "deliveryId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "notificationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "eventType": "Example eventType", "title": "Example title", "channel": "Example channel", "target": "Example target", "status": "Example status", "attemptCount": 42, "nextAttemptAt": "2026-01-15T09:30:00.000Z", "lastAttemptAt": "2026-01-15T09:30:00.000Z", "deliveredAt": "2026-01-15T09:30:00.000Z", "lastStatusCode": 42, "lastError": "Example lastError", "createdAt": "2026-01-15T09:30:00.000Z", "replayOfDeliveryId": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } }, "PartnerNotificationDeliveryLog": { "type": "object", "description": "How the notifications reached their addresses, the newest first.", "required": [ "deliveries" ], "properties": { "deliveries": { "type": "array", "items": { "$ref": "#/components/schemas/PartnerNotificationDelivery" } } }, "example": { "deliveries": [ "Example PartnerNotificationDelivery" ] } }, "PartnerNotificationEvent": { "type": "object", "description": "One kind of event you can be told about.", "required": [ "type", "group", "label", "description", "alwaysEmailed", "delivery" ], "properties": { "type": { "$ref": "#/components/schemas/PartnerNotificationEventType" }, "group": { "type": "string", "enum": [ "payments", "credits", "account", "storage", "content" ] }, "label": { "type": "string" }, "description": { "type": "string", "description": "One sentence that says when it happens" }, "alwaysEmailed": { "type": "boolean", "description": "True for money and standing: you are emailed whatever you chose, and can narrow only what your own system receives." }, "delivery": { "type": "string", "enum": [ "all", "webhook" ], "description": "`all`: email (when chosen), dashboard inbox and webhook. `webhook`: signed call only — no email and not listed in the dashboard inbox." } }, "example": { "type": null, "group": "Example group", "label": "Example label", "description": "Example description", "alwaysEmailed": true, "delivery": "Example delivery" } }, "PartnerNotificationDefaultRecipients": { "type": "object", "description": "Who gets the emails while you have given no addresses of your own.", "required": [ "payments", "other" ], "properties": { "payments": { "type": "array", "description": "For the invoice events, the billing emails of your billing profile, or your contact email when there are none", "items": { "type": "string" } }, "other": { "type": "array", "description": "For every other event, your contact email", "items": { "type": "string" } } }, "example": { "payments": [], "other": [] } }, "PartnerNotificationSettings": { "type": "object", "description": "Where your notifications go. The secret that signs your webhook is never part of it.", "required": [ "partnerId", "emailRecipients", "defaultEmailRecipients", "emailEvents", "webhookUrl", "webhookEvents", "webhookSecretSet", "webhookSecretRotatedAt", "webhookSigningAvailable", "events" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "emailRecipients": { "type": "array", "description": "The addresses the emails go to. Empty means the defaults.", "items": { "type": "string" } }, "defaultEmailRecipients": { "$ref": "#/components/schemas/PartnerNotificationDefaultRecipients" }, "emailEvents": { "type": "array", "nullable": true, "description": "The events you want by email. Null means every event. The events marked `alwaysEmailed` are emailed whatever it says.", "items": { "$ref": "#/components/schemas/PartnerNotificationEventType" } }, "webhookUrl": { "type": "string", "nullable": true, "description": "Where Widgetic sends a signed call for each event. Null while the webhook is switched off." }, "webhookEvents": { "type": "array", "nullable": true, "description": "The events sent to your webhook. Null means every event.", "items": { "$ref": "#/components/schemas/PartnerNotificationEventType" } }, "webhookSecretSet": { "type": "boolean", "description": "Whether a signing secret exists. Calls are made only when it does." }, "webhookSecretRotatedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the current secret was made" }, "webhookSigningAvailable": { "type": "boolean", "description": "False when this server cannot sign webhooks, in which case a webhook cannot be set up yet" }, "events": { "type": "array", "description": "Every event there is, for a settings screen to list", "items": { "$ref": "#/components/schemas/PartnerNotificationEvent" } } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "emailRecipients": [], "defaultEmailRecipients": null, "emailEvents": [ "Example PartnerNotificationEventType" ], "webhookUrl": "Example webhookUrl", "webhookEvents": [ "Example PartnerNotificationEventType" ], "webhookSecretSet": true, "webhookSecretRotatedAt": "2026-01-15T09:30:00.000Z", "webhookSigningAvailable": true, "events": [ "Example PartnerNotificationEvent" ] } }, "UpdatePartnerNotificationSettingsRequest": { "type": "object", "description": "What to change. A key you leave out is left as it was.", "properties": { "emailRecipients": { "type": "array", "maxItems": 5, "description": "The addresses the emails go to, at most five. An empty list goes back to the defaults.", "items": { "type": "string" } }, "emailEvents": { "type": "array", "nullable": true, "description": "The events you want by email. Null for every event.", "items": { "$ref": "#/components/schemas/PartnerNotificationEventType" } }, "webhookEvents": { "type": "array", "nullable": true, "description": "The events to send to your webhook. Null for every event.", "items": { "$ref": "#/components/schemas/PartnerNotificationEventType" } }, "webhookUrl": { "type": "string", "nullable": true, "maxLength": 2000, "description": "Where to send the signed calls. It must be an https address on the standard port, on a public site, and it must not redirect. Null or an empty text switches the webhook off. Setting an address when you have no secret yet makes one." } }, "example": { "emailRecipients": [], "emailEvents": [ "Example PartnerNotificationEventType" ], "webhookEvents": [ "Example PartnerNotificationEventType" ], "webhookUrl": "Example webhookUrl" } }, "PartnerNotificationSettingsChange": { "type": "object", "description": "The settings after a change, and the new signing secret when one was made.", "required": [ "settings", "webhookSecret" ], "properties": { "settings": { "$ref": "#/components/schemas/PartnerNotificationSettings" }, "webhookSecret": { "type": "string", "nullable": true, "description": "The secret that signs your webhook, in the form your receiver is configured with (`whsec_...`). It is in this answer ONLY: keep it now, it cannot be read again. Null when the change made no secret." } }, "example": { "settings": null, "webhookSecret": "Example webhookSecret" } }, "PartnerNotificationTestEventRequest": { "type": "object", "description": "Which kind of event to send a sample of.", "required": [ "eventType" ], "properties": { "eventType": { "$ref": "#/components/schemas/PartnerNotificationEventType" } }, "example": { "eventType": null } }, "PartnerNotificationTestEventResult": { "type": "object", "description": "How a test call went. The call was made whether or not your receiver took it: read `delivered`.", "required": [ "delivered", "statusCode", "durationMs" ], "properties": { "delivered": { "type": "boolean", "description": "True when your receiver answered with a 2xx status." }, "statusCode": { "type": "integer", "nullable": true, "description": "The HTTP status your receiver answered with. Null when it did not answer (refused, unreachable or too slow)." }, "durationMs": { "type": "integer", "description": "How long the call took, in milliseconds. A call is given up after ten seconds." }, "error": { "type": "string", "description": "Why the call did not arrive, in a few words (`timeout`, `status 500`, `unreachable`, a redirect). Never what your receiver replied. Left out when it arrived." } }, "example": { "delivered": true, "statusCode": 42, "durationMs": 42, "error": "Example error" } }, "PartnerEntryContextSigning": { "type": "object", "description": "How the context of your embeds is signed. The secret that signs it is never part of this: it is shown once, when it is made.", "required": [ "partnerId", "required", "secretSet", "secretRotatedAt", "previousSecretValidUntil", "signingAvailable" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "required": { "type": "boolean", "description": "True: an entry whose context carries no valid signature is refused (403 `CONTEXT_SIGNATURE_REQUIRED`). False: an entry that carries a signature is checked, and one that carries none is accepted as before." }, "secretSet": { "type": "boolean", "description": "Whether you have a signing secret. Until you have, no signature is checked and none can be required." }, "secretRotatedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the current secret was made. Null while there is none." }, "previousSecretValidUntil": { "type": "string", "format": "date-time", "nullable": true, "description": "While you switch to a new secret, when the secret it replaced stops being accepted. Null when there is none to wait for." }, "signingAvailable": { "type": "boolean", "description": "False when this server cannot keep secrets, in which case none can be made yet." } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "required": true, "secretSet": true, "secretRotatedAt": "2026-01-15T09:30:00.000Z", "previousSecretValidUntil": "2026-01-15T09:30:00.000Z", "signingAvailable": true } }, "UpdatePartnerEntryContextSigningRequest": { "type": "object", "required": [ "required" ], "properties": { "required": { "type": "boolean", "description": "True to refuse every entry whose context carries no valid signature. False to check the signature of the entries that carry one and accept the others, as before." } }, "example": { "required": true } }, "PartnerEntryContextSecret": { "type": "object", "description": "A new signing secret, and how your signing stands now.", "required": [ "signing", "secret" ], "properties": { "signing": { "$ref": "#/components/schemas/PartnerEntryContextSigning" }, "secret": { "type": "string", "description": "The secret: `ctxsec_` followed by the base64 of 32 random bytes. It is shown here, once, and cannot be read again." } }, "example": { "signing": null, "secret": "Example secret" } }, "PartnerDataDatabase": { "type": "object", "description": "The Neon database your compositions keep what visitors leave in them (votes, ratings, answers, form submissions). The connection string and its password are never part of this: they are given once, when the database is set.", "required": [ "partnerId", "host", "databaseName", "roleName", "verifiedAt", "lastVerificationError", "lastVerificationFailedAt", "updatedAt" ], "properties": { "partnerId": { "type": "string", "format": "uuid" }, "host": { "type": "string", "description": "The Neon host of the database, as it appears in its connection string (`ep-....neon.tech`).", "example": "ep-cool-name-123456.eu-central-1.aws.neon.tech" }, "databaseName": { "type": "string", "description": "The name of the database in your Neon project.", "example": "neondb" }, "roleName": { "type": "string", "description": "The role Widgetic connects as.", "example": "widgetic_data" }, "verifiedAt": { "type": "string", "format": "date-time", "description": "When the database last passed the check." }, "lastVerificationError": { "type": "string", "nullable": true, "description": "Why the latest re-check failed, in a sentence you can act on. Null when the last check passed." }, "lastVerificationFailedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the latest re-check failed. Null when the last check passed." }, "updatedAt": { "type": "string", "format": "date-time" } }, "example": { "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "host": "ep-cool-name-123456.eu-central-1.aws.neon.tech", "databaseName": "neondb", "roleName": "widgetic_data", "verifiedAt": "2026-01-15T09:30:00.000Z", "lastVerificationError": "Example lastVerificationError", "lastVerificationFailedAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z" } }, "SetPartnerDataDatabaseRequest": { "type": "object", "required": [ "connectionString" ], "properties": { "connectionString": { "type": "string", "format": "password", "writeOnly": true, "description": "The connection string of a Neon database and role you made for this, as Neon shows it under Connect: `postgresql://:@ep-..aws.neon.tech/`. Either the direct or the pooled host works. Everything after the database name (`?sslmode=...`) is ignored. It is stored encrypted and is never returned or logged.", "example": "postgresql://widgetic_data:YOUR_PASSWORD@ep-cool-name-123456.eu-central-1.aws.neon.tech/neondb" } }, "example": { "connectionString": "postgresql://widgetic_data:YOUR_PASSWORD@ep-cool-name-123456.eu-central-1.aws.neon.tech/neondb" } }, "PartnerDataDatabaseRemoval": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "description": "False when the partner had no database of its own to remove" } }, "example": { "removed": true } }, "PartnerCustomization": { "type": "object", "description": "Partner contract customization for a partner", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the customization" }, "partnerId": { "type": "string", "format": "uuid", "description": "ID of the partner this customization belongs to" }, "customPrice": { "type": "number", "description": "Custom monthly price override", "example": 299.99 }, "customCredits": { "type": "number", "description": "Credits the partner receives each billing period (`billingCycle`). What a period costs is derived from it, see `periodTotalUsd`", "example": 5000 }, "creditPriceUsd": { "type": "number", "nullable": true, "description": "What the partner pays for one credit, in dollars (up to four decimals). Null means the list price", "example": 0.085 }, "effectiveCreditPriceUsd": { "type": "number", "description": "What one credit costs the partner, in dollars. `creditPriceUsd` when the contract names one, the list price otherwise", "example": 0.085 }, "periodTotalUsd": { "type": "number", "nullable": true, "description": "What one billing period costs, in dollars before tax. `customCredits` times `effectiveCreditPriceUsd`; null while the contract names no credits", "example": 425 }, "additionalFeatures": { "type": "array", "items": { "type": "string" }, "description": "Additional features beyond base partner plan", "example": [ "Advanced analytics", "White-label branding" ] }, "billingCycle": { "type": "string", "enum": [ "monthly", "quarterly", "annual" ], "description": "Billing cycle for the customization", "example": "annual" }, "minimumCommitmentMonths": { "type": "number", "description": "Minimum commitment period in months", "example": 12 }, "supportSla": { "type": "string", "description": "Support SLA percentage", "example": "99.9%" }, "contractStartDate": { "type": "string", "format": "date", "description": "Contract start date", "example": "2024-01-01" }, "contractEndDate": { "type": "string", "format": "date", "description": "Contract end date", "example": "2024-12-31" }, "notes": { "type": "string", "description": "Admin notes about the customization", "example": "Special pricing for strategic partner" }, "isActiveContract": { "type": "boolean", "description": "Whether the contract is currently active", "example": true }, "createdAt": { "type": "string", "format": "date-time", "description": "Creation timestamp" }, "updatedAt": { "type": "string", "format": "date-time", "description": "Last update timestamp" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "customPrice": 299.99, "customCredits": 5000, "creditPriceUsd": 0.085, "effectiveCreditPriceUsd": 0.085, "periodTotalUsd": 425, "additionalFeatures": [ "Advanced analytics", "White-label branding" ], "billingCycle": "annual", "minimumCommitmentMonths": 12, "supportSla": "99.9%", "contractStartDate": "2024-01-01", "contractEndDate": "2024-12-31", "notes": "Special pricing for strategic partner", "isActiveContract": true, "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z" } }, "OrganizationDomain": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the organization domain", "example": "123e4567-e89b-12d3-a456-426614174000" }, "domain": { "type": "string", "description": "Domain pattern (supports wildcards)", "example": "example.com" }, "organizationId": { "type": "string", "format": "uuid", "description": "ID of the organization that owns this domain", "example": "456e7890-e89b-12d3-a456-426614174001" }, "createdAt": { "type": "string", "format": "date-time", "description": "When the domain was added", "example": "2024-01-15T09:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the domain was last updated", "example": "2024-01-15T09:00:00Z" } }, "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "domain": "example.com", "organizationId": "456e7890-e89b-12d3-a456-426614174001", "createdAt": "2024-01-15T09:00:00Z", "updatedAt": "2024-01-15T09:00:00Z" } }, "AddDomainRequest": { "type": "object", "required": [ "domain" ], "properties": { "domain": { "type": "string", "description": "Domain pattern to allow (supports wildcards like *.example.com)", "example": "example.com" } }, "example": { "domain": "example.com" } }, "ManagedUser": { "type": "object", "description": "A managed user as the API answers. The answer names its fields in camelCase (`externalId`), and so does the request that creates or changes a managed user; the snake_case spelling (`external_id`) is read too.\n", "required": [ "id", "managerId", "externalId", "createdAt", "updatedAt" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the managed user", "example": "123e4567-e89b-12d3-a456-426614174000" }, "managerId": { "type": "string", "format": "uuid", "description": "ID of the user who manages this managed user", "example": "123e4567-e89b-12d3-a456-426614174001" }, "externalId": { "type": "string", "description": "Your own identifier for the managed user. Unique among the managed users you manage (two different partners may use the same value).", "example": "external-user-123" }, "metadata": { "type": "object", "description": "Additional metadata for the managed user", "example": { "firstName": "John", "lastName": "Doe", "role": "editor" } }, "isActive": { "type": "boolean", "nullable": true, "description": "Whether new compositions, widgets and uploads can be filed under this managed user. `false` means it has been switched off (`updateManagedUser` with `is_active: false`): what it already has stays, and filing anything new under it answers `409 MANAGED_USER_INACTIVE`. A record from before the switch existed may answer `null`, which counts as on.\n", "example": true }, "createdAt": { "type": "string", "format": "date-time", "description": "Timestamp when the managed user was created", "example": "2023-01-01T00:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "Timestamp when the managed user was last updated", "example": "2023-01-02T00:00:00Z" }, "lastActivityAt": { "type": "string", "format": "date-time", "description": "The last time something was filed under this managed user (a widget, an embed, a file, a workflow, a canvas). It is stamped at most once in a few minutes, so it is \"about when\", never to the second. A managed user that existed before this field was added starts at the time the field was added.\n", "example": "2023-01-02T10:15:00Z" }, "counts": { "$ref": "#/components/schemas/ManagedUserContentCounts" } }, "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "managerId": "123e4567-e89b-12d3-a456-426614174001", "externalId": "external-user-123", "metadata": { "firstName": "John", "lastName": "Doe", "role": "editor" }, "isActive": true, "createdAt": "2023-01-01T00:00:00Z", "updatedAt": "2023-01-02T00:00:00Z", "lastActivityAt": "2023-01-02T10:15:00Z", "counts": null } }, "NewManagedUser": { "type": "object", "required": [ "externalId" ], "properties": { "externalId": { "type": "string", "description": "Your own identifier for the managed user. Must be unique among the managed users you manage (409 otherwise); another partner using the same value does not matter.", "example": "external-user-123" }, "managerId": { "type": "string", "format": "uuid", "description": "ID of the user who will manage this managed user. Defaults to your own user ID; a partner can only use their own ID (403 otherwise), only an admin can name another manager.", "example": "123e4567-e89b-12d3-a456-426614174001" }, "metadata": { "type": "object", "description": "Additional metadata for the managed user", "example": { "firstName": "John", "lastName": "Doe", "role": "editor" } } }, "example": { "externalId": "external-user-123", "managerId": "123e4567-e89b-12d3-a456-426614174001", "metadata": { "firstName": "John", "lastName": "Doe", "role": "editor" } } }, "UpdateManagedUser": { "type": "object", "properties": { "externalId": { "type": "string", "description": "Updated external identifier for the managed user. Must be unique among the managed users you manage (409 otherwise).", "example": "updated-external-user-123" }, "metadata": { "type": "object", "description": "Updated additional metadata for the managed user", "example": { "firstName": "John", "lastName": "Smith", "role": "admin" } }, "isActive": { "type": "boolean", "description": "Switch the managed user off (`false`) or back on (`true`). A managed user that is off keeps everything already filed under it, and that content can still be listed, but nothing new can be filed under it (`409 MANAGED_USER_INACTIVE`). Send a real boolean, not the text \"false\". Switching a managed user off also ends all of its editor sessions.\n", "example": false } }, "example": { "externalId": "updated-external-user-123", "metadata": { "firstName": "John", "lastName": "Smith", "role": "admin" }, "isActive": false } }, "ManagedUserReference": { "type": "object", "description": "Which of your managed users to file something under (moving a composition, a widget, an upload or a workflow to another managed user). Send one of the two fields, never both. `managedUserExternalId` is the one most partners hold, so they never have to store Widgetic's id.\n", "properties": { "managedUserId": { "type": "string", "format": "uuid", "description": "Widgetic's id for the managed user (the `id` the managed user was answered with when you created it)", "example": "123e4567-e89b-12d3-a456-426614174000" }, "managedUserExternalId": { "type": "string", "maxLength": 255, "description": "Your own identifier for the managed user, the `externalId` you gave when you created it", "example": "external-user-123" } }, "example": { "managedUserId": "123e4567-e89b-12d3-a456-426614174000", "managedUserExternalId": "external-user-123" } }, "ManagedUserLabel": { "type": "object", "description": "Which managed user a composition, a widget, an upload or a workflow is filed under, as the calls that move it or take its label off answer.\n", "required": [ "id", "managedUserId" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "The composition, widget, upload or workflow", "example": "7d0b4c1a-2f6e-4f3a-9b1c-5e8a3d2c1b0f" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "Widgetic's id for the managed user it is filed under now, or `null` when it is filed under no one (it is your own)", "example": "123e4567-e89b-12d3-a456-426614174000" } }, "example": { "id": "7d0b4c1a-2f6e-4f3a-9b1c-5e8a3d2c1b0f", "managedUserId": "123e4567-e89b-12d3-a456-426614174000" } }, "NewEditorSession": { "type": "object", "required": [ "surfaces" ], "properties": { "surfaces": { "type": "array", "minItems": 1, "items": { "type": "string", "enum": [ "files", "editor", "creator", "workflows" ] }, "description": "The pieces of Widgetic's editor the session may drive. `files` is the media library (the File Browser: upload a file, list the files uploaded for this user); what a user uploads is kept in your own storage destination. Partner storage is not optional: a session of any surface can be made only once you have set a destination up (`setPartnerStorageDestination`), and is refused with `409 PARTNER_STORAGE_REQUIRED` until then. `editor` is editing one of this user's compositions: read it, change its name, content, design and embed settings, read its schemas, and ask where to show it (`getCompositionPreview`: the widget's published page). `creator` is Widgetic's Widget Creator, with its drawing canvas and its AI: this user's canvases, the widgets on them and the conversation of each widget, the generation, build and publish calls that make a widget, and the compositions of those widgets (list, make). The surfaces do not imply one another: the whole creator also saves a composition (`editor`) and attaches pictures to its chat (`files`), so ask for `[\"creator\", \"editor\", \"files\"]`. `workflows` is the Workflows editor: this user's own workflows (list, make, make from one of your starting points, draw, publish, pause, resume, archive, delete, the version history and the counts) under `/workspaces/{workspaceId}/workflows`, where `workspaceId` is the one the session answers with (your partner workspace, and no other), and the compositions made for this user, which are the only ones a workflow of theirs can chain. A workflow is filed under the user it was made for (`managedUserId`), and the session reaches nothing of another user's, nor of yours.\n", "example": [ "files", "editor" ] }, "expiresInSeconds": { "type": "integer", "minimum": 60, "maximum": 14400, "default": 3600, "description": "How long the session lasts, in seconds. It cannot be extended; make a new session when it ends.", "example": 3600 }, "allowedOrigin": { "type": "string", "nullable": true, "description": "Bind the session to one web page origin, such as `https://app.example.com` (no path; `http` is accepted only for `localhost`). The session is then refused from any other origin, and from a request that carries no `Origin` header. Leave it out for a session that can be used from anywhere, which is what a server-side caller needs.\n", "example": "https://app.example.com" }, "maxCredits": { "type": "integer", "minimum": 1, "maximum": 1000000, "description": "The most credits this session may spend on Widgetic's AI, one credit being one generation. Once the operations it ran have taken that many, the next one is refused (402, `EDITOR_SESSION_CREDIT_LIMIT_REACHED`) and the browser is only told that the feature is not available right now. A generation that fails is refunded and does not count. Leave it out to get the limit Widgetic has set for your account, if it has set one (it sets none unless you ask), and otherwise no limit of its own, which leaves the credits of your account as the only ceiling. Send `null` to ask for no limit of its own even when a default is set.\n", "example": 20 } }, "example": { "surfaces": [ "files", "editor" ], "expiresInSeconds": 3600, "allowedOrigin": "https://app.example.com", "maxCredits": 20 } }, "EditorSession": { "type": "object", "description": "An editor session you have just made. `token` is shown once and cannot be read again: hand it to the browser of this one user and keep it out of logs and storage.\n", "required": [ "token", "sessionId", "managedUserId", "managedUserExternalId", "workspaceId", "surfaces", "expiresAt", "createdAt" ], "properties": { "token": { "type": "string", "description": "The credential the browser sends as `Authorization: Bearer `. It starts with `wgt_ses_`. It works only for the calls of the session's surfaces, only for this managed user's content, and only until `expiresAt`.\n", "example": "wgt_ses_3q2-7wA9vJm5cH1xT0uY8pZkR4nLd6BfGeSoVi2tMqE" }, "sessionId": { "type": "string", "format": "uuid", "description": "Identifies the session, so you can end it (`revokeManagedUserEditorSession`). It is not a credential." }, "managedUserId": { "type": "string", "format": "uuid" }, "managedUserExternalId": { "type": "string", "description": "Your own identifier for the managed user" }, "workspaceId": { "type": "string", "format": "uuid", "nullable": true, "description": "The workspace this user's content is filed in: your partner workspace, the one made with your partner account (your customers have no workspace of their own). The `workflows` surface names it in every path (`/workspaces/{workspaceId}/workflows`), and the Workflows editor takes it as its `workspaceId`. Any other workspace, your teams included, is refused. Null only when your account has no partner workspace.\n" }, "surfaces": { "type": "array", "items": { "type": "string", "enum": [ "files", "editor", "creator", "workflows" ] } }, "allowedOrigin": { "type": "string", "nullable": true, "description": "The web page origin the session is bound to, or null when it is not bound" }, "maxCredits": { "type": "integer", "nullable": true, "description": "The most credits the session may spend on Widgetic's AI (`max_credits`), or null when it has no limit of its own" }, "expiresAt": { "type": "string", "format": "date-time" }, "createdAt": { "type": "string", "format": "date-time" } }, "example": { "token": "wgt_ses_3q2-7wA9vJm5cH1xT0uY8pZkR4nLd6BfGeSoVi2tMqE", "sessionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managedUserExternalId": "Example managedUserExternalId", "workspaceId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "surfaces": [], "allowedOrigin": "Example allowedOrigin", "maxCredits": 42, "expiresAt": "2026-01-15T09:30:00.000Z", "createdAt": "2026-01-15T09:30:00.000Z" } }, "ManagedUserOperationUsage": { "type": "object", "description": "What one metered operation cost a managed user's editor sessions over the period", "required": [ "operation", "calls", "credits", "refundedCalls", "refundedCredits" ], "properties": { "operation": { "type": "string", "description": "The metered operation, as the credit ledger names it", "example": "agent.code.generate" }, "calls": { "type": "integer", "description": "How many runs of the operation were paid for and kept (a run that was refunded is not one)" }, "credits": { "type": "integer", "description": "The credits those runs took from your account" }, "refundedCalls": { "type": "integer", "description": "How many runs were refunded (a generation that failed), and so are not in `calls`" }, "refundedCredits": { "type": "integer", "description": "The credits the refunded runs took, which went back to your account" } }, "example": { "operation": "agent.code.generate", "calls": 42, "credits": 42, "refundedCalls": 42, "refundedCredits": 42 } }, "ManagedUserUsage": { "type": "object", "description": "What a managed user's editor sessions spent over a period. Only credits taken through editor sessions are counted, from the day usage was first recorded: what you spend with your API key is not, and neither is anything from before.\n", "required": [ "managedUserId", "managedUserExternalId", "from", "to", "totals", "operations" ], "properties": { "managedUserId": { "type": "string", "format": "uuid" }, "managedUserExternalId": { "type": "string", "description": "Your own identifier for the managed user" }, "from": { "type": "string", "format": "date-time", "description": "Start of the period, included" }, "to": { "type": "string", "format": "date-time", "description": "End of the period, not included" }, "totals": { "type": "object", "description": "All operations together", "required": [ "calls", "credits", "refundedCalls", "refundedCredits" ], "properties": { "calls": { "type": "integer" }, "credits": { "type": "integer" }, "refundedCalls": { "type": "integer" }, "refundedCredits": { "type": "integer" } } }, "operations": { "type": "array", "description": "One entry for each operation that was paid for in the period, in alphabetical order", "items": { "$ref": "#/components/schemas/ManagedUserOperationUsage" } } }, "example": { "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managedUserExternalId": "Example managedUserExternalId", "from": "2026-01-15T09:30:00.000Z", "to": "2026-01-15T09:30:00.000Z", "totals": {}, "operations": [ "Example ManagedUserOperationUsage" ] } }, "CopyPartnerPresetRequest": { "type": "object", "additionalProperties": false, "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 120, "description": "Names the copy. Left out, the copy is named after the preset's title, or the widget's own name." } }, "example": { "name": "Example name" } }, "PartnerPresetCopy": { "type": "object", "description": "Where the copy of a preset is. Open the Widget Creator on `canvasId` and `widgetId`.", "required": [ "presetKey", "managedUserId", "canvasId", "widgetId", "widgetName", "warnings" ], "properties": { "presetKey": { "type": "string", "example": "rating" }, "managedUserId": { "type": "string", "format": "uuid", "description": "The managed user the copy was made for" }, "canvasId": { "type": "string", "format": "uuid", "description": "The new canvas the copy is on" }, "widgetId": { "type": "string", "format": "uuid", "description": "The new widget, which is not a preset and which only this managed user's editor reaches" }, "widgetName": { "type": "string" }, "warnings": { "type": "array", "description": "Things that did not go as planned but did not stop the copy. Empty when everything did.", "items": { "type": "string" } } }, "example": { "presetKey": "rating", "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "canvasId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "widgetId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "widgetName": "Example widgetName", "warnings": [] } }, "ManagedUserLimits": { "type": "object", "required": [ "monthlyCredits", "creditsUsedThisMonth", "creditsLeftThisMonth", "resetsAt" ], "description": "The monthly credit cap of one managed user and what the user's editor sessions spent against it this month.", "properties": { "monthlyCredits": { "type": "integer", "nullable": true, "description": "The cap, or null when there is no monthly cap" }, "creditsUsedThisMonth": { "type": "integer" }, "creditsLeftThisMonth": { "type": "integer", "nullable": true }, "resetsAt": { "type": "string", "format": "date-time", "description": "First instant of the next UTC calendar month" } }, "example": { "monthlyCredits": 42, "creditsUsedThisMonth": 42, "creditsLeftThisMonth": 42, "resetsAt": "2026-01-15T09:30:00.000Z" } }, "DesignDefaults": { "type": "object", "required": [ "design" ], "description": "A stored design default. A partner has one for all its customers and each managed user can have one of its own.", "properties": { "design": { "type": "object", "nullable": true, "additionalProperties": true, "description": "The stored design document, or null when none is set." } }, "example": { "design": {} } }, "ManagedUserRemoval": { "type": "object", "required": [ "message", "id" ], "description": "What a removal of something that belongs to a managed user answers.", "properties": { "message": { "type": "string", "example": "Editor session ended" }, "id": { "type": "string", "description": "The id of what was removed." } }, "example": { "message": "Editor session ended", "id": "Example id" } }, "PurposeStorageBucket": { "type": "object", "required": [ "bytes", "fileCount" ], "properties": { "bytes": { "type": "integer" }, "fileCount": { "type": "integer" } }, "example": { "bytes": 42, "fileCount": 42 } }, "PartnerInvoice": { "type": "object", "description": "An invoice issued to a partner. Money is in dollars (not cents). Administrator notes, billing-provider identifiers and Widgetic account ids are not part of what a partner is sent.\n", "properties": { "id": { "type": "string", "format": "uuid" }, "partnerId": { "type": "string", "format": "uuid", "nullable": true }, "number": { "type": "string", "nullable": true, "description": "The number printed on the invoice, once it has been issued" }, "description": { "type": "string", "nullable": true, "description": "What the invoice is for" }, "purpose": { "type": "string", "enum": [ "contract", "extra_credits" ], "description": "Which kind of invoice this is. `contract` is what the partner agreed to pay: one that is unpaid past its due day puts the partner in payment arrears. `extra_credits` is credits the partner chose to buy on top of the contract: nothing waits for it, and its credits are added when it is paid. Every invoice that does not say otherwise is a contract invoice.\n" }, "amount": { "type": "number", "description": "Total, in dollars. The price plus the tax (the same number as `total`)" }, "subtotal": { "type": "number", "description": "The price, before tax, in dollars" }, "taxAmount": { "type": "number", "description": "The tax on the price, in dollars. 0 when there is none, for example under the EU reverse charge" }, "total": { "type": "number", "description": "What the partner pays, in dollars. The price plus the tax" }, "amountDue": { "type": "number", "nullable": true, "description": "What is still owed, in dollars" }, "amountPaid": { "type": "number", "nullable": true, "description": "What has been paid, in dollars" }, "currency": { "type": "string", "nullable": true, "example": "USD" }, "failureReason": { "type": "string", "nullable": true, "description": "Why the last attempt to pay failed, in the payment provider's words for the card holder. Null unless the status is `failed`; the invoice stays payable from `hostedInvoiceUrl`" }, "status": { "type": "string", "enum": [ "draft", "open", "pending", "paid", "failed", "void", "uncollectible", "refunded", "canceled" ], "description": "`open` waits for payment, `failed` waits for payment after an attempt was refused, `paid` is settled (a payment received outside the payment provider counts), `void` was cancelled and owes nothing, and `uncollectible` was written off\n" }, "invoiceDate": { "type": "string", "format": "date-time", "nullable": true }, "dueDate": { "type": "string", "format": "date-time", "nullable": true }, "paidDate": { "type": "string", "format": "date-time", "nullable": true }, "periodStart": { "type": "string", "format": "date-time", "nullable": true }, "periodEnd": { "type": "string", "format": "date-time", "nullable": true }, "paymentMethod": { "type": "string", "nullable": true, "description": "How it was paid, once it was" }, "hostedInvoiceUrl": { "type": "string", "format": "uri", "nullable": true, "description": "The page where the invoice can be viewed and paid, once it has been issued" }, "pdfUrl": { "type": "string", "format": "uri", "nullable": true, "description": "A PDF of the invoice, once it has been issued" }, "lineItems": { "type": "array", "nullable": true, "items": { "type": "object", "additionalProperties": true } }, "createdAt": { "type": "string", "format": "date-time", "nullable": true }, "updatedAt": { "type": "string", "format": "date-time", "nullable": true } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "partnerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "number": "Example number", "description": "Example description", "purpose": "Example purpose", "amount": 42, "subtotal": 42, "taxAmount": 42, "total": 42, "amountDue": 42, "amountPaid": 42, "currency": "USD", "failureReason": "Example failureReason", "status": "Example status", "invoiceDate": "2026-01-15T09:30:00.000Z", "dueDate": "2026-01-15T09:30:00.000Z", "paidDate": "2026-01-15T09:30:00.000Z", "periodStart": "2026-01-15T09:30:00.000Z", "periodEnd": "2026-01-15T09:30:00.000Z", "paymentMethod": "Example paymentMethod", "hostedInvoiceUrl": "Example hostedInvoiceUrl", "pdfUrl": "Example pdfUrl", "lineItems": [], "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z" } }, "Entitlement": { "type": "object", "description": "Feature entitlement for users, partners, or managed users", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the entitlement", "example": "123e4567-e89b-12d3-a456-426614174000" }, "userId": { "type": "string", "format": "uuid", "description": "ID of the user (if user-level entitlement)", "example": "123e4567-e89b-12d3-a456-426614174001" }, "partnerId": { "type": "string", "format": "uuid", "description": "ID of the partner (if partner-level entitlement)", "example": "123e4567-e89b-12d3-a456-426614174002" }, "managedUserId": { "type": "string", "format": "uuid", "description": "ID of the managed user (if managed user-level entitlement)", "example": "123e4567-e89b-12d3-a456-426614174003" }, "feature": { "type": "string", "description": "Feature identifier that this entitlement grants access to", "example": "plan.solo" }, "value": { "type": "string", "description": "Value or limit for this feature", "example": "100" }, "expiresAt": { "type": "string", "format": "date-time", "description": "When this entitlement expires (null for permanent)", "example": "2024-01-01T00:00:00Z" }, "source": { "type": "string", "description": "Source of the entitlement", "enum": [ "subscription", "contract", "manual", "marketplace", "addon" ], "example": "subscription" }, "sourceId": { "type": "string", "description": "ID of the source object that granted this entitlement", "example": "123e4567-e89b-12d3-a456-426614174004" }, "createdAt": { "type": "string", "format": "date-time", "description": "When the entitlement was created", "example": "2023-01-01T00:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the entitlement was last updated", "example": "2023-01-02T00:00:00Z" } }, "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "userId": "123e4567-e89b-12d3-a456-426614174001", "partnerId": "123e4567-e89b-12d3-a456-426614174002", "managedUserId": "123e4567-e89b-12d3-a456-426614174003", "feature": "plan.solo", "value": "100", "expiresAt": "2024-01-01T00:00:00Z", "source": "subscription", "sourceId": "123e4567-e89b-12d3-a456-426614174004", "createdAt": "2023-01-01T00:00:00Z", "updatedAt": "2023-01-02T00:00:00Z" } }, "AccountCreditBalance": { "type": "object", "description": "The credits an account holds in one workspace. A workspace's credits are its own and can be spent in that workspace only, so the same person reads a different balance in each workspace they belong to, and a workspace nobody subscribed holds none.\n", "properties": { "id": { "type": "string", "format": "uuid" }, "userId": { "type": "string", "format": "uuid" }, "balance": { "type": "number", "description": "Credits the account holds in the workspace the request acts in" }, "reservedBalance": { "type": "number", "description": "Credits committed to an operation that is still running. They cannot be spent, so what a new operation can use is `balance - reservedBalance`.\n" }, "lastUpdated": { "type": "string", "format": "date-time" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "balance": 42, "reservedBalance": 42, "lastUpdated": "2026-01-15T09:30:00.000Z" } }, "AccountCreditTransaction": { "type": "object", "description": "One entry of an account's credit ledger.", "properties": { "id": { "type": "string", "format": "uuid" }, "transactionType": { "type": "string", "nullable": true, "description": "What the entry did to the balance. `debit` is credits spent (this is how consumption shows), `credit` and `subscription` are credits added, `refund` returns credits that were spent, `reserve` and `release` move credits in and out of the reserved amount, and `adjustment`, `expiration`, `transfer_out` and `transfer_in` are the remaining ways a balance changes. The list can grow, so treat an unknown type as an entry you do not need to interpret.\n" }, "amount": { "type": "number", "description": "Always positive. The `transactionType` says whether the credits were added or taken." }, "balanceAfter": { "type": "number", "nullable": true, "description": "The balance once this entry was applied" }, "description": { "type": "string", "nullable": true }, "referenceId": { "type": "string", "nullable": true, "description": "The event the entry belongs to. An entry is recorded once per reference." }, "createdAt": { "type": "string", "format": "date-time" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "transactionType": "Example transactionType", "amount": 42, "balanceAfter": 42, "description": "Example description", "referenceId": "Example referenceId", "createdAt": "2026-01-15T09:30:00.000Z" } }, "Composition": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the composition", "example": "123e4567-e89b-12d3-a456-426614174000" }, "widgetId": { "type": "string", "format": "uuid", "description": "ID of the widget this composition is based on", "example": "123e4567-e89b-12d3-a456-426614174002" }, "name": { "type": "string", "description": "Name of the composition", "example": "My Composition" }, "content": { "type": "object", "description": "Content data for the composition", "example": { "key": "value" } }, "contentVersion": { "type": "integer", "description": "Monotonic content version when the content_version migration is applied", "example": 3 }, "status": { "type": "string", "description": "Current status of the composition", "enum": [ "draft", "published", "archived" ], "example": "draft" }, "createdAt": { "type": "string", "format": "date-time", "description": "When the composition was created", "example": "2023-01-01T00:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the composition was last updated", "example": "2023-01-02T00:00:00Z" }, "embedSettings": { "type": "object", "description": "Settings for embedding the composition", "example": { "width": "100%", "height": "500px" } }, "design": { "type": "object", "description": "Design settings for the composition", "example": { "theme": "light", "colors": { "primary": "#0066ff" } } }, "projectId": { "type": "string", "format": "uuid", "description": "ID of the project this composition belongs to", "example": "123e4567-e89b-12d3-a456-426614174004" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The managed user the composition was made for, or null when it is your own. List one managed user's compositions with the `managedUserId` or `managedUserExternalId` query parameter of `getAllCompositions`.", "example": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e" }, "managedUserExternalId": { "type": "string", "nullable": true, "description": "Your own id for that managed user (the `externalId` you registered it with). Only in the contents of a project of a partner's own workspace (`getProjectContents`); null for what is the account's own.", "example": "user-8841" } }, "required": [ "id", "widgetId", "name", "content", "status", "createdAt", "updatedAt" ], "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "widgetId": "123e4567-e89b-12d3-a456-426614174002", "name": "My Composition", "content": { "key": "value" }, "contentVersion": 3, "status": "draft", "createdAt": "2023-01-01T00:00:00Z", "updatedAt": "2023-01-02T00:00:00Z", "embedSettings": { "width": "100%", "height": "500px" }, "design": { "theme": "light", "colors": { "primary": "#0066ff" } }, "projectId": "123e4567-e89b-12d3-a456-426614174004", "managedUserId": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e", "managedUserExternalId": "user-8841" } }, "NewComposition": { "type": "object", "properties": { "name": { "type": "string", "description": "Name of the composition", "example": "My New Composition" }, "widgetId": { "type": "string", "format": "uuid", "description": "ID of the widget this composition is based on", "example": "123e4567-e89b-12d3-a456-426614174002" }, "content": { "type": "object", "description": "Content data for the composition", "example": { "key": "value" } }, "status": { "type": "string", "description": "Initial status of the composition", "default": "draft", "example": "draft" }, "embedSettings": { "type": "object", "description": "Settings for embedding the composition", "example": { "width": "100%", "height": "500px" } }, "design": { "type": "object", "description": "Design settings for the composition", "example": { "theme": "light", "colors": { "primary": "#0066ff" } } }, "databaseSchema": { "type": "object", "description": "The tables this composition keeps what visitors send it in (votes, ratings, answers). They are made when\nthe composition is created, in a schema of their own that no other composition can reach: in Widgetic's\ndatabase, or in your own Neon database when you have set one with `setPartnerDataDatabase`. They are\ndeleted with the composition.\n\nThe shape is `{ \"tables\": [ ... ] }`. A table has a `name`, a list of `columns` and, optionally, a list of\n`indexes`, and optionally `countable`. A column has a `name` and a `type`, and optionally `primaryKey`,\n`notNull`, `unique`, `default` and `readable`. An index has a `name` and the `columns` it covers (1 to 8),\nand optionally `unique`. Any other key is refused, except `source` (see below).\n\n`countable` and `readable` are the read policy of the composition's own page: nothing the visitors sent\ncan be read back by the page until you say so. `countable: true` on a table lets the widget show how many\nrows it has; `readable: true` on a column lets it show or total that column's values (a tally of votes,\nan average rating). Mark only what is safe to show to anyone who opens the page. A column whose name\nholds `email`, `phone`, `address`, `token`, `password`, `secret`, `ip` or the like, and a `json`, `jsonb`\nor `uuid` column, cannot be `readable`.\n\n- Names (tables, columns, indexes) use lower-case letters, digits and underscores, start with a letter and\n are at most 63 characters long. A name that starts with `_` or `pg_` is reserved.\n- `type` is one of `text`, `smallint`, `integer` (or `int`), `bigint`, `numeric`, `real`,\n `double precision`, `boolean` (or `bool`), `date`, `timestamp`, `timestamptz` (or\n `timestamp with time zone`), `uuid`, `json`, `jsonb`, `serial`, `bigserial`.\n- `default` is a number, `true` or `false`, a text of at most 500 characters (no backslash), a JSON value\n for a `json` or `jsonb` column, or one of `now()`, `current_timestamp` and `current_date` (date and\n timestamp columns) and `gen_random_uuid()` (a `uuid` column). A `serial` column numbers itself and has\n no default.\n- A composition declares at most 20 tables, with at most 64 columns and 10 indexes each.\n\nA declaration that cannot be used is refused with `400` and `INVALID_DATABASE_SCHEMA`;\n`error.details.problems` lists what to change. Tables that already exist are never changed or dropped:\nsending more tables later, when you update the composition, adds the ones that are missing. When the\ncomposition is saved but its tables cannot be made just now, the answer says so in `meta.warnings`: send\nthe same `databaseSchema` again to retry.\n\nLeave it out and the composition gets the tables its widget declares in its own source\n(`src/lib/meta/database.json`), if any. Send `{ \"tables\": [] }` to give the composition no tables and\nkeep it from getting its widget's.\n\nA composition whose tables were made from its widget's own file reads back with `\"source\": \"widget\"` next\nto `tables`. When the widget is published again, a table, a field or an index its file gained is added to\nthem; nothing that exists is changed or dropped, and what a page may read does not change. Send `source`\nback as it was and it stays. Leave it out and the tables are yours: no widget's file adds anything to\nthem. It is the only value `source` can have.\n", "example": { "tables": [ { "name": "votes", "columns": [ { "name": "id", "type": "serial", "primaryKey": true }, { "name": "choice", "type": "text", "notNull": true }, { "name": "created_at", "type": "timestamptz", "default": "now()" } ], "indexes": [ { "name": "votes_choice_idx", "columns": [ "choice" ] } ] } ] } }, "projectId": { "type": "string", "format": "uuid", "description": "ID of the project this composition belongs to", "example": "123e4567-e89b-12d3-a456-426614174004" }, "managedUserId": { "type": "string", "format": "uuid", "description": "Make the composition for one of your managed users, by Widgetic's id for the user. Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both. The managed user must be yours and active. The composition stays in your account; the tag lets you list one user's compositions and keeps it out of the others' lists. It is set here and does not change afterwards.", "example": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e" }, "managedUserExternalId": { "type": "string", "maxLength": 255, "description": "The same, by your own identifier for the user, the `externalId` you gave when you created the managed user (answers show it as `externalId`). Partners only. Send this or `managedUserId`, not both.", "example": "user-8841" } }, "required": [ "name", "widgetId" ], "example": { "name": "My New Composition", "widgetId": "123e4567-e89b-12d3-a456-426614174002", "content": { "key": "value" }, "status": "draft", "embedSettings": { "width": "100%", "height": "500px" }, "design": { "theme": "light", "colors": { "primary": "#0066ff" } }, "databaseSchema": { "tables": [ { "name": "votes", "columns": [ { "name": "id", "type": "serial", "primaryKey": true }, { "name": "choice", "type": "text", "notNull": true }, { "name": "created_at", "type": "timestamptz", "default": "now()" } ], "indexes": [ { "name": "votes_choice_idx", "columns": [ "choice" ] } ] } ] }, "projectId": "123e4567-e89b-12d3-a456-426614174004", "managedUserId": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e", "managedUserExternalId": "user-8841" } }, "UpdateComposition": { "type": "object", "properties": { "name": { "type": "string", "description": "Updated name of the composition", "example": "Updated Composition Name" }, "widgetId": { "type": "string", "format": "uuid", "description": "Updated widget ID", "example": "123e4567-e89b-12d3-a456-426614174002" }, "content": { "type": "object", "description": "Updated content data", "example": { "key": "new value" } }, "status": { "type": "string", "description": "Updated status", "example": "published" }, "embedSettings": { "type": "object", "description": "Updated embed settings", "example": { "width": "100%", "height": "600px" } }, "design": { "type": "object", "description": "Updated design settings", "example": { "theme": "dark", "colors": { "primary": "#0044cc" } } }, "databaseSchema": { "type": "object", "description": "Tables to make for the composition, in the shape `createComposition` takes\n(`{ \"tables\": [ ... ] }`, with the same names, types, defaults and limits). Only the tables that are\nmissing are made. A table that already exists is never changed or dropped: it keeps its columns, so a\ncolumn added to the declaration is not added to it. (Tables made from the widget's own file are the one\nexception, brought up to date when the widget is published; see `source` on `createComposition`.) A\ndeclaration that cannot be used is refused with\n`400` and `INVALID_DATABASE_SCHEMA`. When the composition is saved but its tables cannot be made just\nnow, `meta.warnings` says so: send the same `databaseSchema` again to retry.\n" }, "projectId": { "type": "string", "format": "uuid", "description": "Updated project ID", "example": "123e4567-e89b-12d3-a456-426614174004" } }, "example": { "name": "Updated Composition Name", "widgetId": "123e4567-e89b-12d3-a456-426614174002", "content": { "key": "new value" }, "status": "published", "embedSettings": { "width": "100%", "height": "600px" }, "design": { "theme": "dark", "colors": { "primary": "#0044cc" } }, "databaseSchema": {}, "projectId": "123e4567-e89b-12d3-a456-426614174004" } }, "CompositionVersion": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the version", "example": "123e4567-e89b-12d3-a456-426614174010" }, "compositionId": { "type": "string", "format": "uuid", "description": "ID of the associated composition", "example": "123e4567-e89b-12d3-a456-426614174000" }, "version": { "type": "integer", "description": "Version number", "example": 1 }, "content": { "type": "object", "description": "Content for this version", "example": { "key": "value at version 1" } }, "createdAt": { "type": "string", "format": "date-time", "description": "When this version was created", "example": "2023-01-01T00:00:00Z" } }, "example": { "id": "123e4567-e89b-12d3-a456-426614174010", "compositionId": "123e4567-e89b-12d3-a456-426614174000", "version": 1, "content": { "key": "value at version 1" }, "createdAt": "2023-01-01T00:00:00Z" } }, "CompositionDatabaseRecord": { "type": "object", "additionalProperties": true, "description": "One row of one of the composition's tables. Its properties are the table's columns, named as the widget's `database.json` names them; the row's key is `id`. Read the table's columns with `getCompositionEntries` when you need the list.\n", "example": { "id": 7, "stars": 5, "comment": "Great widget" } }, "ContentItemWriteResult": { "type": "object", "description": "What a write of one item of a content list answers with.", "properties": { "success": { "type": "boolean", "description": "Repeats the envelope's `success`." }, "contentVersion": { "type": "integer", "description": "The content's version after the write. Send it as `If-Match` on the next write to refuse a stale one." }, "validationResult": { "type": "object", "properties": { "valid": { "type": "boolean" }, "errors": { "type": "array", "items": { "type": "object", "additionalProperties": true } }, "warnings": { "type": "array", "items": { "type": "object", "additionalProperties": true } } } }, "compositionUpdated": { "type": "boolean" }, "realtimeUpdateSent": { "type": "boolean", "description": "Whether the open frames were told to reload the content." }, "item": { "type": "object", "additionalProperties": true, "description": "The item as stored, with the `id` the list gave it." } }, "example": { "success": true, "contentVersion": 42, "validationResult": {}, "compositionUpdated": true, "realtimeUpdateSent": true, "item": {} } }, "CompositionEntryColumn": { "type": "object", "required": [ "name", "type" ], "properties": { "name": { "type": "string", "description": "The column's name exactly as the database spells it. Pass it as `groupBy` to tally by it.", "example": "stars" }, "type": { "type": "string", "description": "The column's database type", "example": "integer" } }, "example": { "name": "stars", "type": "integer" } }, "CompositionEntryTable": { "type": "object", "required": [ "name", "columns", "rows" ], "properties": { "name": { "type": "string", "description": "The table's name exactly as the database spells it. Pass it as `table` to read it.", "example": "ratings" }, "columns": { "type": "array", "description": "The table's columns, in table order (up to 40)", "items": { "$ref": "#/components/schemas/CompositionEntryColumn" } }, "rows": { "type": "integer", "nullable": true, "minimum": 0, "description": "How many entries the table holds. `null` when they could not be counted, which is not zero.", "example": 212 } }, "example": { "name": "ratings", "columns": [ "Example CompositionEntryColumn" ], "rows": 212 } }, "CompositionEntriesDescription": { "type": "object", "required": [ "compositionId", "hasData", "tables" ], "properties": { "compositionId": { "type": "string", "format": "uuid", "description": "The composition whose entries these are" }, "hasData": { "type": "boolean", "description": "False when the composition keeps no entries of its own: its widget only shows content (it has no\ndatabase), or nothing was set up in the database yet. That is not an error.\n" }, "tables": { "type": "array", "description": "The tables entries are kept in (up to 20)", "items": { "$ref": "#/components/schemas/CompositionEntryTable" } } }, "example": { "compositionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "hasData": true, "tables": [ "Example CompositionEntryTable" ] } }, "CompositionEntryTally": { "type": "object", "required": [ "value", "count" ], "properties": { "value": { "type": "string", "nullable": true, "description": "One value of the column, as text (a number is `\"5\"`, a yes/no is `\"true\"`), cut to 200 characters.\n`null` groups the entries that left the column empty.\n", "example": "5" }, "count": { "type": "integer", "minimum": 1, "description": "How many entries have that value", "example": 87 } }, "example": { "value": "5", "count": 87 } }, "CompositionEntriesReading": { "type": "object", "required": [ "compositionId", "table", "totalRows", "tallies", "moreGroups", "columns", "rows", "moreRows" ], "properties": { "compositionId": { "type": "string", "format": "uuid", "description": "The composition whose entries these are" }, "table": { "type": "string", "description": "The table that was read" }, "totalRows": { "type": "integer", "minimum": 0, "description": "How many entries the table holds in all. Not narrowed by `since`, `until` or a filter: only\n`aggregates` is.\n", "example": 212 }, "tallies": { "type": "array", "nullable": true, "description": "How many entries have each value of the `groupBy` column, largest group first (up to 20 groups), over\nthe whole table. `null` when no `groupBy` was asked for. For the groups of a selection (a time window,\na `context` filter) or for more than 20 groups, ask for `aggregate`: `aggregates.tallies` holds up to\n200 groups.\n", "items": { "$ref": "#/components/schemas/CompositionEntryTally" } }, "moreGroups": { "type": "boolean", "description": "True when the `groupBy` column has more than the 20 groups `tallies` lists. It speaks of `tallies`\nonly: `aggregates.truncated` is the same signal for `aggregates` (200 groups).\n" }, "columns": { "type": "array", "description": "The name of each value of an entry in `rows`, in order, exactly as the database spells it (and as\n`describeCompositionEntries` lists it: `created_at` stays `created_at`). Empty when no entries were\nasked for, or the table has none.\n", "items": { "type": "string" }, "example": [ "id", "stars", "comment", "created_at" ] }, "rows": { "type": "array", "nullable": true, "description": "The newest entries, newest first (up to 25). `null` when no entries were asked for. Each entry is a\nlist of values in the order of `columns`. A value is text (cut to 200 characters), a number, a\nboolean or `null`.\n", "items": { "type": "array", "items": { "nullable": true, "description": "A text, a number, a boolean or null" } }, "example": [ [ 5, 5, "Loved it", "2026-10-05T10:00:00Z" ] ] }, "moreRows": { "type": "boolean", "description": "True when the table holds more entries than `rows` lists" }, "aggregates": { "description": "Only present when the read asked for `aggregate`. Unlike `totalRows`, `tallies` and `rows`, it is\nnarrowed by `since`, `until` and the `context` and column filters of the same call: it answers\n\"the average rating this week\" where `tallies` answer \"how many of each rating, ever\".\n", "allOf": [ { "$ref": "#/components/schemas/CompositionEntryAggregatesBlock" } ] } }, "example": { "compositionId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "table": "Example table", "totalRows": 212, "tallies": [ "Example CompositionEntryTally" ], "moreGroups": true, "columns": [ "id", "stars", "comment", "created_at" ], "rows": [ [ 5, 5, "Loved it", "2026-10-05T10:00:00Z" ] ], "moreRows": true, "aggregates": null } }, "CompositionDataSource": { "type": "object", "required": [ "url", "refreshSeconds" ], "description": "The public JSON address a composition's widget reads when it loads and again every `refreshSeconds`. One\nper composition: binding another replaces it. It is sent and answered as `refreshSeconds`\n(`refresh_seconds` is read too).\n", "properties": { "url": { "type": "string", "maxLength": 2048, "description": "The https address as it was saved, after the checks (a public host, never loopback, link-local or a metadata address)", "example": "https://example.com/data/results.json" }, "refreshSeconds": { "type": "integer", "minimum": 10, "maximum": 86400, "description": "How often the widget reads the address again, in seconds", "example": 60 } }, "example": { "url": "https://example.com/data/results.json", "refreshSeconds": 60 } }, "ContentCheckFinding": { "type": "object", "required": [ "path", "message" ], "description": "One thing the check of a body of content found.", "properties": { "path": { "type": "string", "description": "Where it is, for example `content.interval` or `content.items[2].caption`.", "example": "content.items[2].caption" }, "message": { "type": "string", "description": "What is wrong, in a sentence.", "example": "caption takes text, got a number" }, "expected": { "type": "string", "description": "What the field takes.", "example": "text" }, "actual": { "type": "string", "description": "What was sent, shortened. Text and numbers as they were, anything else as its kind.", "example": "a number" } }, "example": { "path": "content.items[2].caption", "message": "caption takes text, got a number", "expected": "text", "actual": "a number" } }, "Canvas": { "type": "object", "required": [ "id", "persistenceKey", "createdAt", "updatedAt" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the canvas", "example": "123e4567-e89b-12d3-a456-426614174000" }, "persistenceKey": { "type": "string", "description": "Key used for persistent storage and reference", "example": "canvas_xyz123" }, "canvasContent": { "type": "object", "description": "JSON content of the canvas, containing layout and configuration", "example": { "version": 1, "elements": [], "settings": {} } }, "primaryWidgetId": { "type": "string", "format": "uuid", "nullable": true, "description": "The widget on this canvas. A canvas holds one widget, so this is its id, or null while the canvas has none.", "example": "123e4567-e89b-12d3-a456-426614174099" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The managed user the canvas was made for (Widgetic's id for the user); null for a canvas that is the account's own.", "example": "123e4567-e89b-12d3-a456-426614174077" }, "createdAt": { "type": "string", "format": "date-time", "description": "Timestamp when the canvas was created", "example": "2023-01-01T00:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "Timestamp when the canvas was last updated", "example": "2023-01-02T00:00:00Z" } }, "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "persistenceKey": "canvas_xyz123", "canvasContent": { "version": 1, "elements": [], "settings": {} }, "primaryWidgetId": "123e4567-e89b-12d3-a456-426614174099", "managedUserId": "123e4567-e89b-12d3-a456-426614174077", "createdAt": "2023-01-01T00:00:00Z", "updatedAt": "2023-01-02T00:00:00Z" } }, "CreateCanvasRequest": { "type": "object", "required": [ "persistenceKey" ], "properties": { "persistenceKey": { "type": "string", "description": "Key used for persistent storage and reference", "example": "canvas_xyz123" }, "canvasContent": { "type": "object", "description": "JSON content of the canvas, containing layout and configuration", "example": { "version": 1, "elements": [], "settings": {} } }, "primaryWidgetId": { "type": "string", "format": "uuid", "nullable": true, "description": "Optional. The widget the canvas is for. A canvas holds one widget, and making a widget on the canvas sets this by itself." }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "Make the canvas for this managed user (Widgetic's id for the user). Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both. The tag is set here and does not change afterwards." }, "managedUserExternalId": { "type": "string", "maxLength": 255, "nullable": true, "description": "Make the canvas for the managed user you registered with this `externalId` (your own identifier for the user). Partners only. Send this or `managedUserId`, not both." }, "projectId": { "type": "string", "format": "uuid", "nullable": true, "description": "Project this canvas belongs to. Empty canvases show on that project's list." } }, "example": { "persistenceKey": "canvas_xyz123", "canvasContent": { "version": 1, "elements": [], "settings": {} }, "primaryWidgetId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managedUserExternalId": "Example managedUserExternalId", "projectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } }, "UpdateCanvasRequest": { "type": "object", "properties": { "persistenceKey": { "type": "string", "description": "Updated key used for persistent storage and reference", "example": "updated_canvas_xyz123" }, "canvasContent": { "type": "object", "description": "Updated JSON content of the canvas", "example": { "version": 2, "elements": [ { "id": "elem1" } ], "settings": { "theme": "dark" } } }, "primaryWidgetId": { "type": "string", "format": "uuid", "nullable": true, "description": "The widget the canvas is for. A canvas holds one widget. Omit to leave unchanged." } }, "example": { "persistenceKey": "updated_canvas_xyz123", "canvasContent": { "version": 2, "elements": [ { "id": "elem1" } ], "settings": { "theme": "dark" } }, "primaryWidgetId": "3fa85f64-5717-4562-b3fc-2c963f66afa6" } }, "BrandColor": { "type": "object", "required": [ "name", "hex" ], "properties": { "name": { "type": "string", "minLength": 1, "maxLength": 40 }, "hex": { "type": "string", "pattern": "^#[0-9A-Fa-f]{6}$" }, "role": { "type": "string", "enum": [ "primary", "secondary", "accent", "background", "surface", "text", "title", "sub", "border", "error" ] } }, "example": { "name": "Example name", "hex": "Example hex", "role": "Example role" } }, "BrandFont": { "type": "object", "required": [ "family", "source" ], "properties": { "family": { "type": "string", "minLength": 1, "maxLength": 80 }, "source": { "type": "string", "enum": [ "google", "upload" ] }, "weight": { "type": "integer", "enum": [ 100, 200, 300, 400, 500, 600, 700, 800, 900 ] }, "sizeMax": { "type": "integer", "minimum": 8, "maximum": 200 } }, "example": { "family": "Example family", "source": "Example source", "weight": 42, "sizeMax": 42 } }, "BrandTextStyle": { "type": "object", "required": [ "family", "weight", "size" ], "description": "One text style of the kit: a font family, a weight and a size in pixels, for example Inter 400 at 12px or Inter 500 at 18px. A family with a font file in the kit is an uploaded font; any other family is loaded from Google Fonts. The size is the size of the widget at full size.", "properties": { "family": { "type": "string", "minLength": 1, "maxLength": 80 }, "weight": { "type": "integer", "enum": [ 100, 200, 300, 400, 500, 600, 700, 800, 900 ] }, "size": { "type": "integer", "minimum": 8, "maximum": 200 } }, "example": { "family": "Example family", "weight": 42, "size": 42 } }, "BrandSpacing": { "type": "object", "required": [ "xs", "s", "m", "l", "xl", "radiusS", "radiusM", "radiusL" ], "properties": { "xs": { "type": "integer", "minimum": 0, "maximum": 128 }, "s": { "type": "integer", "minimum": 0, "maximum": 128 }, "m": { "type": "integer", "minimum": 0, "maximum": 128 }, "l": { "type": "integer", "minimum": 0, "maximum": 128 }, "xl": { "type": "integer", "minimum": 0, "maximum": 128 }, "radiusS": { "type": "integer", "minimum": 0, "maximum": 40 }, "radiusM": { "type": "integer", "minimum": 0, "maximum": 40 }, "radiusL": { "type": "integer", "minimum": 0, "maximum": 40 } }, "example": { "xs": 42, "s": 42, "m": 42, "l": 42, "xl": 42, "radiusS": 42, "radiusM": 42, "radiusL": 42 } }, "BrandKitTokens": { "type": "object", "required": [ "colors", "fonts", "spacing" ], "description": "Colors, fonts by role, text styles, spacing and corner radii of a Brand Kit.", "properties": { "colors": { "type": "array", "maxItems": 24, "items": { "$ref": "#/components/schemas/BrandColor" } }, "fonts": { "type": "object", "properties": { "title": { "$ref": "#/components/schemas/BrandFont" }, "subtitle": { "$ref": "#/components/schemas/BrandFont" }, "body": { "$ref": "#/components/schemas/BrandFont" }, "caption": { "$ref": "#/components/schemas/BrandFont" } } }, "textStyles": { "type": "array", "maxItems": 12, "description": "The owner's text styles (family, weight and size). When there are some, they are what every widget made with the kit is told about type and the fonts by role are not used; with none, the fonts by role apply. A font file that is deleted takes the text styles made from it with it. Left out when the kit has none.", "items": { "$ref": "#/components/schemas/BrandTextStyle" } }, "spacing": { "$ref": "#/components/schemas/BrandSpacing" }, "instructions": { "type": "string", "maxLength": 500, "description": "The kit owner's own style notes, taken into account in every widget made with the kit, for example \"Use the dark color as the background always and the light color for titles\". They are about how a widget looks and never about what it holds, and what a request names itself wins over them. Left out, Widgetic's default note applies (\"Widget backgrounds to be white whenever possible.\"); an empty string means none." } }, "example": { "colors": [ "Example BrandColor" ], "fonts": {}, "textStyles": [ "Example BrandTextStyle" ], "spacing": null, "instructions": "Example instructions" } }, "BrandKitFigmaSource": { "type": "object", "required": [ "url", "fileKey", "nodeId", "fileName", "importedAt" ], "properties": { "url": { "type": "string" }, "fileKey": { "type": "string" }, "nodeId": { "type": "string", "nullable": true }, "fileName": { "type": "string", "nullable": true }, "importedAt": { "type": "string", "format": "date-time" } }, "example": { "url": "Example url", "fileKey": "Example fileKey", "nodeId": "Example nodeId", "fileName": "Example fileName", "importedAt": "2026-01-15T09:30:00.000Z" } }, "BrandKitAssetView": { "type": "object", "required": [ "id", "kind", "name", "createdAt" ], "properties": { "id": { "type": "string", "format": "uuid" }, "kind": { "type": "string", "enum": [ "font", "icon" ] }, "name": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" }, "family": { "type": "string" }, "weight": { "type": "integer" }, "style": { "type": "string", "enum": [ "normal", "italic" ] }, "format": { "type": "string", "enum": [ "woff2", "woff", "ttf", "otf" ] }, "bytes": { "type": "integer" }, "url": { "type": "string", "nullable": true }, "slug": { "type": "string" }, "exportName": { "type": "string" }, "svg": { "type": "string" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "kind": "Example kind", "name": "Example name", "createdAt": "2026-01-15T09:30:00.000Z", "family": "Example family", "weight": 42, "style": "Example style", "format": "Example format", "bytes": 42, "url": "Example url", "slug": "Example slug", "exportName": "Example exportName", "svg": "Example svg" } }, "BrandKitView": { "type": "object", "required": [ "owner", "isDefault", "canEdit", "version", "tokens", "assets" ], "properties": { "owner": { "type": "object", "description": "The workspace the kit belongs to. Every kit belongs to a workspace.", "required": [ "type", "organizationId" ], "properties": { "type": { "type": "string", "enum": [ "organization" ] }, "organizationId": { "type": "string", "format": "uuid", "description": "The workspace the kit belongs to." } } }, "isDefault": { "type": "boolean" }, "canEdit": { "type": "boolean" }, "version": { "type": "integer" }, "tokens": { "$ref": "#/components/schemas/BrandKitTokens" }, "assets": { "type": "array", "items": { "$ref": "#/components/schemas/BrandKitAssetView" } }, "figmaSource": { "$ref": "#/components/schemas/BrandKitFigmaSource", "nullable": true }, "updatedAt": { "type": "string", "format": "date-time", "nullable": true }, "updatedBy": { "type": "string", "format": "uuid", "nullable": true }, "warnings": { "type": "array", "description": "Things worth fixing in the saved kit, such as a text color that is hard to read on the background, or fonts by role that are not used because the kit has text styles. The kit is saved either way.", "items": { "type": "string" } } }, "example": { "owner": {}, "isDefault": true, "canEdit": true, "version": 42, "tokens": null, "assets": [ "Example BrandKitAssetView" ], "figmaSource": null, "updatedAt": "2026-01-15T09:30:00.000Z", "updatedBy": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "warnings": [] } }, "BrandKitViewResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/BrandKitView" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "example": { "success": true, "data": null, "meta": null } }, "PutBrandKitRequest": { "type": "object", "required": [ "tokens" ], "properties": { "tokens": { "$ref": "#/components/schemas/BrandKitTokens" }, "figmaSource": { "$ref": "#/components/schemas/BrandKitFigmaSource", "nullable": true }, "expectedVersion": { "type": "integer" } }, "example": { "tokens": null, "figmaSource": null, "expectedVersion": 42 } }, "PatchBrandKitRequest": { "type": "object", "minProperties": 1, "description": "Changes part of the kit and leaves the rest as it is. Only the keys that are sent change.", "properties": { "colors": { "type": "array", "maxItems": 24, "description": "The whole list of colors (it replaces the saved list).", "items": { "$ref": "#/components/schemas/BrandColor" } }, "fonts": { "type": "object", "description": "The text roles to change; the roles that are left out keep their font.", "properties": { "title": { "$ref": "#/components/schemas/BrandFont" }, "subtitle": { "$ref": "#/components/schemas/BrandFont" }, "body": { "$ref": "#/components/schemas/BrandFont" }, "caption": { "$ref": "#/components/schemas/BrandFont" } } }, "textStyles": { "type": "array", "maxItems": 12, "description": "The whole list of text styles (it replaces the saved list). An empty list removes them, and the fonts by role apply again. Left out, the saved text styles stay as they are.", "items": { "$ref": "#/components/schemas/BrandTextStyle" } }, "spacing": { "type": "object", "description": "The spacing and radius steps to change; the steps that are left out keep their value.", "properties": { "xs": { "type": "integer", "minimum": 0, "maximum": 128 }, "s": { "type": "integer", "minimum": 0, "maximum": 128 }, "m": { "type": "integer", "minimum": 0, "maximum": 128 }, "l": { "type": "integer", "minimum": 0, "maximum": 128 }, "xl": { "type": "integer", "minimum": 0, "maximum": 128 }, "radiusS": { "type": "integer", "minimum": 0, "maximum": 40 }, "radiusM": { "type": "integer", "minimum": 0, "maximum": 40 }, "radiusL": { "type": "integer", "minimum": 0, "maximum": 40 } } }, "cornerRadius": { "type": "integer", "minimum": 0, "maximum": 40, "description": "One corner radius in pixels for the whole kit; the small, medium and large radii are made from it. 0 gives square corners. A radius step sent in `spacing` wins over the one made from this value." }, "instructions": { "type": "string", "maxLength": 500, "description": "The kit owner's style notes (see `tokens.instructions`). An empty string removes them." }, "expectedVersion": { "type": "integer", "description": "Refuse the change with a 409 when the kit was saved again since this version was read." } }, "example": { "cornerRadius": 0, "instructions": "Use the dark color as the background always and the light color for titles." } }, "PatchBrandKitAssetRequest": { "type": "object", "minProperties": 1, "properties": { "name": { "type": "string", "description": "Icon rename" }, "family": { "type": "string", "description": "Font family relabel" }, "weight": { "type": "integer", "enum": [ 100, 200, 300, 400, 500, 600, 700, 800, 900 ] }, "style": { "type": "string", "enum": [ "normal", "italic" ] } }, "example": { "name": "Example name", "family": "Example family", "weight": 42, "style": "Example style" } }, "PostBrandKitIconRequest": { "type": "object", "required": [ "name", "svg" ], "properties": { "name": { "type": "string" }, "svg": { "type": "string" } }, "example": { "name": "Example name", "svg": "Example svg" } }, "ErrorResponse": { "type": "object", "required": [ "success", "message", "error" ], "additionalProperties": true, "properties": { "success": { "type": "boolean", "description": "Always `false` on a failure.", "example": false }, "message": { "type": "string", "description": "The same text as `error.message`, for a caller that reads one line." }, "error": { "$ref": "#/components/schemas/ErrorDetail" } } }, "AiAnswersKnowledgeDocument": { "type": "object", "description": "One document in a widget's knowledge base: what the widget's AI answers visitors' questions from. Its text is not part of this: it is kept so the widget can find the passages that answer a question, and is never returned.", "required": [ "id", "title", "status", "charCount", "chunkCount", "createdAt", "readyAt" ], "properties": { "id": { "type": "string", "format": "uuid", "description": "Use it to remove the document" }, "title": { "type": "string", "maxLength": 120, "description": "What the document is called. Visitors see it as the source of an answer, so write it for them", "example": "Shipping and returns" }, "status": { "type": "string", "enum": [ "processing", "ready" ], "description": "`ready` documents are used to answer questions. A `processing` document is not: it is being added, or an add was interrupted. Remove one that stays in this state and add it again" }, "charCount": { "type": "integer", "description": "How many characters of text the document holds, after it was cleaned", "example": 4210 }, "chunkCount": { "type": "integer", "description": "Into how many passages the text was cut. Zero until the document is ready", "example": 6 }, "createdAt": { "type": "string", "format": "date-time" }, "readyAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the document became ready. Null while it is not" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "title": "Shipping and returns", "status": "Example status", "charCount": 4210, "chunkCount": 6, "createdAt": "2026-01-15T09:30:00.000Z", "readyAt": "2026-01-15T09:30:00.000Z" } }, "AiAnswersKnowledgeTotals": { "type": "object", "required": [ "documents", "characters", "maxDocuments", "maxTotalChars" ], "properties": { "documents": { "type": "integer", "description": "How many documents the widget has" }, "characters": { "type": "integer", "description": "How many characters of text they hold in all" }, "maxDocuments": { "type": "integer", "description": "The most documents one widget can hold", "example": 20 }, "maxTotalChars": { "type": "integer", "description": "The most characters of text one widget's documents can hold in all", "example": 400000 } }, "example": { "documents": 42, "characters": 42, "maxDocuments": 20, "maxTotalChars": 400000 } }, "AiAnswersKnowledge": { "type": "object", "required": [ "documents", "totals" ], "properties": { "documents": { "type": "array", "description": "Oldest first", "items": { "$ref": "#/components/schemas/AiAnswersKnowledgeDocument" } }, "totals": { "$ref": "#/components/schemas/AiAnswersKnowledgeTotals" } }, "example": { "documents": [ "Example AiAnswersKnowledgeDocument" ], "totals": null } }, "AddAiAnswersKnowledgeDocumentRequest": { "type": "object", "required": [ "title", "text" ], "additionalProperties": false, "properties": { "title": { "type": "string", "maxLength": 120, "description": "What the document is called, on one line. Visitors see it as the source of an answer. Line breaks and invisible characters are removed", "example": "Shipping and returns" }, "text": { "type": "string", "maxLength": 100000, "description": "The text of the document, as plain text. It is cleaned (line endings are made the same, invisible characters and surplus blank lines are removed) and then counted: up to 100000 characters. Markup is not interpreted, so paste the words, not a web page", "example": "Orders ship within 2 business days. Returns are accepted for 30 days after delivery, in the original packaging." } }, "example": { "title": "Shipping and returns", "text": "Orders ship within 2 business days. Returns are accepted for 30 days after delivery, in the original packaging." } }, "AiAnswersKnowledgeRemoval": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "description": "Always true. A document that was not there is a 404 instead" } }, "example": { "removed": true } }, "AdapterConnection": { "type": "object", "description": "A key an adapter can take from an account, and whether the account has connected it. The key itself is never part of this: it is given once, when it is connected, and Widgetic keeps it encrypted.", "required": [ "adapterId", "adapterLabel", "credentialKey", "label", "scope", "connected", "updatedAt", "confirmation", "awaitingConfirmation", "confirmedAt" ], "properties": { "adapterId": { "type": "string", "description": "The adapter the key is for (its id in the adapter catalog)", "example": "email" }, "adapterLabel": { "type": "string", "description": "What the adapter is called to its owner", "example": "Email" }, "credentialKey": { "type": "string", "description": "The name of the key within the adapter. Use it, with the adapter id, to connect or remove the key", "example": "resendApiKey" }, "label": { "type": "string", "description": "What the key is called to its owner", "example": "Resend API key" }, "scope": { "type": "string", "enum": [ "owner", "partner", "owner_or_partner" ], "description": "Who may keep this key. `owner` is the person who made the widget, in their own account. `partner` is a partner, for the widgets of the customers it manages. `owner_or_partner` is either; for a widget of a managed customer the partner's key is used." }, "connected": { "type": "boolean", "description": "Whether this account has connected the key" }, "updatedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the key was last set. Null when it is not connected" }, "confirmation": { "type": "string", "nullable": true, "description": "How this credential is proved before it is used. `email_code` means it is an email address: saving it emails a code to it, and it is used only after the code is given back (`confirmUserAdapterConnection`, `confirmPartnerAdapterConnection`). Null for a credential that is used as soon as it is saved", "example": "email_code" }, "awaitingConfirmation": { "type": "boolean", "description": "True when the credential is connected but has not been confirmed yet, so no adapter uses it. Always false when `confirmation` is null or the credential is not connected" }, "confirmedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the credential was confirmed. Null when it is not connected, is awaiting its code, or needs no confirmation" } }, "example": { "adapterId": "email", "adapterLabel": "Email", "credentialKey": "resendApiKey", "label": "Resend API key", "scope": "Example scope", "connected": true, "updatedAt": "2026-01-15T09:30:00.000Z", "confirmation": "email_code", "awaitingConfirmation": true, "confirmedAt": "2026-01-15T09:30:00.000Z" } }, "SetAdapterConnectionRequest": { "type": "object", "required": [ "credential" ], "additionalProperties": false, "properties": { "credential": { "type": "string", "format": "password", "writeOnly": true, "maxLength": 2048, "description": "The key exactly as its provider gave it: one line of text, at most 2048 characters. It is stored encrypted and is never returned or logged. For a credential that is an email address (`confirmation: email_code`), write that one address, with nothing else", "example": "YOUR_PROVIDER_KEY" } }, "example": { "credential": "YOUR_PROVIDER_KEY" } }, "ConfirmAdapterConnectionRequest": { "type": "object", "required": [ "code" ], "additionalProperties": false, "properties": { "code": { "type": "string", "maxLength": 32, "description": "The digits of the code Widgetic emailed to the address, with nothing else. It works for 30 minutes and for five wrong tries; after that, save the address again and a new code is emailed", "example": "123456" } }, "example": { "code": "123456" } }, "AdapterConnectionRemoval": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "description": "False when the key was not connected, so there was nothing to remove" } }, "example": { "removed": true } }, "UpdateDomainRequest": { "type": "object", "description": "The body of a request that changes an entry of a list of allowed websites. The property is `domain`, as when an entry is added: the routes read nothing called `name`.", "required": [ "domain" ], "properties": { "domain": { "type": "string", "description": "The website name to keep instead, such as `example.com`, or `*.example.com` for a website and all of its subdomains", "example": "example.com" } }, "example": { "domain": "example.com" } }, "ResponseMeta": { "type": "object", "description": "Extra information about the answer: where a page sits in a list, the cursor of the next page, or warnings about a call that succeeded with a caveat.", "additionalProperties": true, "properties": { "page": { "type": "integer", "description": "The page that was read, counting from 1.", "example": 1 }, "size": { "type": "integer", "description": "How many items one page holds.", "example": 20 }, "total": { "type": "integer", "description": "How many items the whole list has.", "example": 135 }, "limit": { "type": "integer", "description": "The same as `size`.", "example": 20 }, "offset": { "type": "integer", "description": "How many items come before this page.", "example": 0 }, "hasNextPage": { "type": "boolean", "example": true }, "hasPreviousPage": { "type": "boolean", "example": false }, "nextCursor": { "type": "string", "nullable": true, "description": "Pass this as `cursor` to read the next page of a list that is read by cursor. `null` on the last page." }, "warnings": { "type": "array", "items": { "type": "string" }, "description": "Things the call did not do, though it succeeded (for example a table that could not be created just now)." } } }, "Widget": { "type": "object", "description": "Represents a widget in the system.", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the widget.", "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6" }, "name": { "type": "string", "description": "Name of the widget.", "example": "Chart Widget" }, "description": { "type": "string", "nullable": true, "description": "Description of the widget's purpose and functionality.", "example": "Interactive chart widget for data visualization" }, "type": { "type": "string", "description": "Type of widget (e.g., chart, form, gallery).", "example": "chart" }, "content": { "type": "object", "description": "Content configuration for the widget.", "additionalProperties": true, "example": { "chartType": "bar", "dataSource": "api" } }, "isPublic": { "type": "boolean", "description": "Whether the widget is publicly available.", "example": false }, "isDraft": { "type": "boolean", "description": "Whether the widget is a draft.", "example": true }, "createdAt": { "type": "string", "format": "date-time", "description": "When the widget was created.", "example": "2025-09-15T10:23:00.000Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the widget was last updated.", "example": "2025-09-16T08:12:45.000Z" }, "thumbnailUrl": { "type": "string", "nullable": true, "description": "The widget's thumbnail: a picture of the widget, at a public address you can use as the `src` of an image. Widgetic makes it itself, a little after the widget's last build, when the widget has none. It is null until then, and for a widget that was never built. The address changes when the picture is replaced, so read it again rather than keeping it. Every composition made from the widget shows this same thumbnail.", "example": "https://cdn.widgetic.com/widgets/3fa85f64-5717-4562-b3fc-2c963f66afa6/thumbnail.png?t=1795536526532" }, "thumbnailSvg": { "type": "string", "nullable": true, "maxLength": 1200, "description": "A small line drawing of the widget, as an SVG on a 20 x 20 canvas (a few flat shapes only, one line of 1.33 drawn in currentColor, no script, style, text, link or image). Show it as a mask, 20 pixels wide, in the middle of the standard grey tile, in the darker grey. Widgetic draws it itself, a few minutes after the widget's last build, when the widget has none. It is null until then, for a widget that was never built and when the drawing could not be made, and a widget need not have one: when it is null, show `thumbnailUrl`. Every composition made from the widget shows this same drawing." }, "canvasId": { "type": "string", "format": "uuid", "nullable": true, "description": "The canvas the widget is on. A canvas holds one widget.", "example": "9f0c6b54-3e8f-4a2a-8b7d-1c5c6d9e0a1b" }, "hasUnpublishedChanges": { "type": "boolean", "description": "True when the widget was published at least once and the latest saved commit differs from the published commit. Never-published drafts are false.", "example": false }, "publishedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "ISO timestamp of the last publish, or null when the widget was never published.", "example": "2025-09-16T08:12:45.000Z" }, "organizationId": { "type": "string", "format": "uuid", "nullable": true, "description": "Organization ID if created in an organization workspace.", "example": "5e2d3f4a-1b6c-4a1f-8b9c-3c2d4e5f6a7b" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The managed user the widget was made for, or null when it is your own. List one managed user's widgets with the `managedUserId` or `managedUserExternalId` query parameter of `getWidgets`.", "example": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e" }, "managedUserExternalId": { "type": "string", "nullable": true, "description": "Your own id for that managed user (the `externalId` you registered it with). Only in the contents of a project of a partner's own workspace (`getProjectContents`); null for what is the account's own.", "example": "user-8841" } }, "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Chart Widget", "description": "Interactive chart widget for data visualization", "type": "chart", "content": { "chartType": "bar", "dataSource": "api" }, "isPublic": false, "isDraft": true, "createdAt": "2025-09-15T10:23:00.000Z", "updatedAt": "2025-09-16T08:12:45.000Z", "thumbnailUrl": "https://cdn.widgetic.com/widgets/3fa85f64-5717-4562-b3fc-2c963f66afa6/thumbnail.png?t=1795536526532", "thumbnailSvg": "Example thumbnailSvg", "canvasId": "9f0c6b54-3e8f-4a2a-8b7d-1c5c6d9e0a1b", "hasUnpublishedChanges": false, "publishedAt": "2025-09-16T08:12:45.000Z", "organizationId": "5e2d3f4a-1b6c-4a1f-8b9c-3c2d4e5f6a7b", "managedUserId": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e", "managedUserExternalId": "user-8841" } }, "NewWidget": { "type": "object", "description": "What a new widget starts from. Only the fields listed here are used. The widget is created without\ncode: it is a record with a name, a type and some starting content, on a canvas (a new one, unless you\nname an empty one of yours: a canvas holds one widget). It has no database: what the visitors of a\ncomposition leave is kept in the tables of that composition.\n", "required": [ "name", "type", "content" ], "properties": { "name": { "type": "string", "minLength": 1, "description": "Name of the widget.", "example": "New Chart Widget" }, "type": { "type": "string", "minLength": 1, "description": "What kind of widget this is, as a label of your choosing (for example chart, form, gallery).", "example": "chart" }, "content": { "type": "object", "description": "Starting content for the widget. An empty object is fine.", "additionalProperties": true, "example": { "chartType": "bar", "dataSource": "api" } }, "isPublic": { "type": "boolean", "default": false, "description": "Whether the widget is public.", "example": false }, "isDraft": { "type": "boolean", "default": true, "description": "Whether the widget starts as a draft. A widget created without this is a draft.", "example": false }, "canvasId": { "type": "string", "format": "uuid", "description": "Put the widget on this existing canvas instead of a new one. You must own the canvas, and it must have no widget yet: a canvas holds one widget, and one that already has a widget is refused with 409 (`CANVAS_ALREADY_HAS_WIDGET`).", "example": "abc12345-def6-7890-ab12-cd3456ef7890" }, "projectId": { "type": "string", "format": "uuid", "description": "Project to file the widget in. You must be able to edit the project.", "example": "7c1e2f30-4a5b-4c6d-8e9f-0a1b2c3d4e5f" }, "organizationId": { "type": "string", "format": "uuid", "description": "The workspace the widget belongs to. You must be a member who may create widgets there. Leave it out and the widget goes where its project is, or, when it names no project, in the workspace your key, your connection or your workspace switcher is working in. Naming a project of one workspace and the id of another is refused (400).", "example": "5e2d3f4a-1b6c-4a1f-8b9c-3c2d4e5f6a7b" }, "managedUserId": { "type": "string", "format": "uuid", "description": "Make the widget for one of your managed users, by Widgetic's id for the user. Partners only, with an active partner API key. Send this or `managedUserExternalId`, not both. The managed user must be yours and active. The widget stays in your account; the tag lets you list one user's widgets and keeps it out of the others' lists. It is set here and does not change afterwards.", "example": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e" }, "managedUserExternalId": { "type": "string", "maxLength": 255, "description": "The same, by your own identifier for the user, the `externalId` you gave when you created the managed user (answers show it as `externalId`). Partners only. Send this or `managedUserId`, not both.", "example": "user-8841" } }, "example": { "name": "New Chart Widget", "type": "chart", "content": { "chartType": "bar", "dataSource": "api" }, "isPublic": false, "isDraft": false, "canvasId": "abc12345-def6-7890-ab12-cd3456ef7890", "projectId": "7c1e2f30-4a5b-4c6d-8e9f-0a1b2c3d4e5f", "organizationId": "5e2d3f4a-1b6c-4a1f-8b9c-3c2d4e5f6a7b", "managedUserId": "b7c8d9e0-1f2a-4b3c-8d4e-5f6a7b8c9d0e", "managedUserExternalId": "user-8841" } }, "CompositionEntryItem": { "type": "object", "required": [ "id", "values", "context", "createdAt" ], "properties": { "id": { "type": "string", "nullable": true }, "values": { "type": "object", "additionalProperties": true }, "context": { "type": "object", "nullable": true, "additionalProperties": true, "description": "The host context the entry was stored with: what the embedding page passed in, without the two keys of a signature (`widgetic_exp` and `widgetic_sig`), which are checked when the entry comes in and are never stored." }, "createdAt": { "type": "string", "nullable": true, "format": "date-time" }, "truncatedColumns": { "type": "array", "description": "The columns whose value was cut: a value longer than 20,000 characters is cut there (a JSON value is\ncut as text, so it comes back as a string and no longer as an object), and its column is named here.\nAbsent when nothing was cut.\n", "items": { "type": "string" } } }, "example": { "id": "Example id", "values": {}, "context": {}, "createdAt": "2026-01-15T09:30:00.000Z", "truncatedColumns": [] } }, "CompositionEntryItemsMeta": { "type": "object", "required": [ "nextCursor", "total" ], "properties": { "nextCursor": { "type": "string", "nullable": true, "description": "Pass it as `cursor` to get the next page. `null` on the last page, and for a table that cannot be\npaged (see `paging`).\n" }, "total": { "type": "integer", "description": "How many entries match the filters and the `since` / `until` window, over all pages and not only this\none.\n" }, "paging": { "type": "string", "enum": [ "unavailable" ], "description": "Present, as `unavailable`, when the table cannot be paged: it has a time column but no id column to\ntell two entries of the same instant apart, or it has no time column and no id column that can be\npaged on. The answer is one page only, and `nextCursor` stays `null` even when `total` is larger than\nthe page.\n" } }, "example": { "nextCursor": "Example nextCursor", "total": 42, "paging": "Example paging" } }, "CompositionEntryItemsPageSuccess": { "type": "object", "required": [ "success", "data", "meta" ], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/CompositionEntryItem" } }, "meta": { "$ref": "#/components/schemas/CompositionEntryItemsMeta" } }, "example": { "success": true, "data": [ "Example CompositionEntryItem" ], "meta": null } }, "CompositionEntryAggregateTally": { "type": "object", "description": "The aggregates of one group (the entries that share a value of the `groupBy` column), or of the whole\nselection when no `groupBy` was asked for. Only the functions that were asked for with `aggregate` are\npresent.\n", "properties": { "group": { "type": "string", "nullable": true, "description": "The value of the `groupBy` column, as text (a number is `\"5\"`); `null` groups the entries that left it\nempty. Absent when no `groupBy` was asked for.\n", "example": "5" }, "count": { "type": "integer", "description": "How many entries are in the group (or in the selection)", "example": 87 }, "avg": { "type": "number", "nullable": true, "description": "The average of the numeric `column`, rounded to 4 decimals. `null` when no entry matched: there is no\naverage of nothing, and it is not 0.\n", "example": 4.2874 }, "min": { "type": "number", "nullable": true, "description": "The smallest value of the numeric `column`. `null` when no entry matched.", "example": 1 }, "max": { "type": "number", "nullable": true, "description": "The largest value of the numeric `column`. `null` when no entry matched.", "example": 5 }, "sum": { "type": "number", "nullable": true, "description": "The sum of the numeric `column`. `null` when no entry matched.", "example": 373 } }, "example": { "group": "5", "count": 87, "avg": 4.2874, "min": 1, "max": 5, "sum": 373 } }, "CompositionEntryAggregatesBlock": { "type": "object", "description": "What `aggregate` asked for, computed over the entries that match `since`, `until` and the `context` and\ncolumn filters of the same call.\n", "required": [ "column", "tallies" ], "properties": { "column": { "type": "string", "description": "The numeric column `avg`, `min`, `max` and `sum` were computed over. An empty text when only `count`\nwas asked for.\n", "example": "stars" }, "tallies": { "type": "array", "description": "One tally per value of `groupBy`, in the order of that column (a number as a number, `null` last), up\nto 200 groups; or ONE tally for the whole selection when no `groupBy` was asked for. Empty when\n`groupBy` was asked for and no entry matched.\n", "items": { "$ref": "#/components/schemas/CompositionEntryAggregateTally" } }, "truncated": { "type": "boolean", "description": "True when more than 200 groups matched, so `tallies` lists the first 200 in that order. Absent\notherwise. (Not to be mixed up with `moreGroups` on the reading, which is about the plain `tallies`\nof the whole table: those are 20 groups, largest first.)\n" } }, "example": { "column": "stars", "tallies": [ "Example CompositionEntryAggregateTally" ], "truncated": true } }, "CompositionEntryDeleteSuccess": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "required": [ "deleted" ], "properties": { "deleted": { "type": "integer" } } } }, "example": { "success": true, "data": {} } }, "ManagedUserEntryItem": { "allOf": [ { "$ref": "#/components/schemas/CompositionEntryItem" }, { "type": "object", "required": [ "compositionId", "table" ], "properties": { "compositionId": { "type": "string", "format": "uuid" }, "table": { "type": "string" } } } ] }, "ManagedUserEntriesMeta": { "type": "object", "required": [ "nextCursor", "total", "compositionsConsidered", "moreCompositions" ], "properties": { "nextCursor": { "type": "string", "nullable": true }, "total": { "type": "integer" }, "compositionsConsidered": { "type": "integer" }, "moreCompositions": { "type": "boolean" }, "partial": { "type": "boolean" } }, "example": { "nextCursor": "Example nextCursor", "total": 42, "compositionsConsidered": 42, "moreCompositions": true, "partial": true } }, "ManagedUserEntriesPageSuccess": { "type": "object", "required": [ "success", "data", "meta" ], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ManagedUserEntryItem" } }, "meta": { "$ref": "#/components/schemas/ManagedUserEntriesMeta" } }, "example": { "success": true, "data": [ "Example ManagedUserEntryItem" ], "meta": null } }, "PublicCompositionEntryRequest": { "type": "object", "required": [ "values" ], "properties": { "values": { "type": "object", "additionalProperties": true, "description": "Column values to insert (never id or time columns)." }, "context": { "type": "object", "nullable": true, "description": "Host attribution from the embedding page. It is not authenticated unless the partner signs it (see the description of this operation): never use it for authorization on its own. At most 20 keys; string values up to 500 characters or finite numbers; 2048 bytes JSON total. A signed context carries two more keys, `widgetic_exp` and `widgetic_sig`: the gateway checks them and drops them, so they are neither stored nor announced." }, "writeToken": { "type": "string", "nullable": true, "description": "Optional per-composition write token (`entries.writeToken` from `widgetic:host`, or `entryWriteToken` from `GET /embed/compositions/{compositionId}`) when not passed in the `X-Widgetic-Write-Token` header." } }, "example": { "values": {}, "context": {}, "writeToken": "Example writeToken" } }, "PublicCompositionEntryCreated": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "required": [ "entryId", "table", "createdAt" ], "properties": { "entryId": { "type": "string" }, "table": { "type": "string" }, "createdAt": { "type": "string", "format": "date-time" } } } }, "example": { "success": true, "data": {} } }, "ManagedUserLabelResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/ManagedUserLabel" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetWidgetsBatchResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "widgets": { "type": "array", "items": { "$ref": "#/components/schemas/Widget" } }, "errors": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "error": { "type": "string" } } } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "UploadResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/Upload" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "UploadLimitsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/UploadLimits" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "MyPartnersResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/MyPartners" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "AccountCreditBalanceResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/AccountCreditBalance" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerExtraCreditsInvoiceResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerExtraCreditsInvoice" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerContractResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerContract" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerStorageDestinationResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerStorageDestination" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerStorageRemovalResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerStorageRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerPresetResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerPreset" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerPresetRemovalResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerPresetRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerStorageUsageResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerStorageUsage" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerAnalyticsSummaryResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerAnalyticsSummary" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerAnalyticsByManagedUserResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerAnalyticsByManagedUser" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerAnalyticsTopWidgetsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerAnalyticsTopWidgets" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerAnalyticsTimelineResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerAnalyticsTimeline" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerNotificationPageResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerNotificationPage" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerNotificationDeliveryLogResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerNotificationDeliveryLog" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerNotificationSettingsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerNotificationSettings" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerNotificationSettingsChangeResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerNotificationSettingsChange" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerNotificationDeliveryResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerNotificationDelivery" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerNotificationTestEventResultResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerNotificationTestEventResult" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerEntryContextSigningResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerEntryContextSigning" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerEntryContextSecretResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerEntryContextSecret" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerDataDatabaseResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerDataDatabase" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerDataDatabaseRemovalResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerDataDatabaseRemoval" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "AddOrganizationDomainResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "message": { "type": "string" }, "domain": { "$ref": "#/components/schemas/OrganizationDomain" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "UpdateOrganizationDomainResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "message": { "type": "string" }, "domain": { "$ref": "#/components/schemas/OrganizationDomain" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "DeleteOrganizationDomainResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "message": { "type": "string" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetOperationResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "description": "Operation payload including status, metadata, and timestamps.", "properties": { "id": { "type": "string", "format": "uuid", "description": "The operation's identifier, the `operationId` the call that started it returned" }, "type": { "type": "string", "description": "What the operation does" }, "status": { "type": "string", "enum": [ "pending", "running", "completed", "failed", "cancelled" ], "description": "Where the operation stands. `completed`, `failed` and `cancelled` are final" }, "progress": { "type": "integer", "minimum": 0, "maximum": 100, "description": "How far the operation has got, in percent" }, "metadata": { "type": "object", "additionalProperties": true, "description": "What the operation tells about its work. A finished composition duplication names the new composition in `newCompositionId`, and lists any problem with its database in `warnings` (absent when there is none).\n", "properties": { "newCompositionId": { "type": "string", "format": "uuid", "description": "The composition a finished duplication made." }, "warnings": { "type": "array", "description": "The problems with the duplicate's database (for example, tables that could not be made just now), one sentence each. Absent when there is none.\n", "items": { "type": "string" } } } }, "error": { "type": "string", "description": "Why a `failed` operation failed (absent otherwise)" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "ManagedUserResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/ManagedUser" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetManagedUsersByManagerIdResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/ManagedUser" } }, "page": { "type": "integer", "example": 1 }, "size": { "type": "integer", "example": 10 }, "total": { "type": "integer", "example": 42 } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "EditorSessionResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/EditorSession" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "RevokeManagedUserEditorSessionsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "ended": { "type": "integer", "description": "The number of live sessions that were ended" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "ManagedUserUsageResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/ManagedUserUsage" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "PartnerPresetCopyResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/PartnerPresetCopy" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetPartnerEntitlementsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "partnerId": { "type": "string", "format": "uuid", "example": "123e4567-e89b-12d3-a456-426614174002" }, "entitlements": { "type": "array", "items": { "$ref": "#/components/schemas/Entitlement" } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetManagedUserEntitlementsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "managedUserId": { "type": "string", "format": "uuid", "example": "123e4567-e89b-12d3-a456-426614174003" }, "entitlements": { "type": "array", "items": { "$ref": "#/components/schemas/Entitlement" } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CompositionResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/Composition" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionDesignResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionContentResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "SetDynamicContentResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "success": { "type": "boolean" }, "contentVersion": { "type": "integer", "description": "Monotonic content version after the write" }, "validationResult": { "type": "object", "properties": { "valid": { "type": "boolean" }, "errors": { "type": "array", "items": { "type": "object" } }, "warnings": { "type": "array", "items": { "type": "object" } } } }, "compositionUpdated": { "type": "boolean" }, "realtimeUpdateSent": { "type": "boolean" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionEmbedSettingsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionPreviewResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "compositionId": { "type": "string", "format": "uuid", "description": "The composition this is the preview of" }, "widgetId": { "type": "string", "description": "The widget whose build is served" }, "version": { "type": "integer", "description": "The published version of that widget" }, "previewUrl": { "type": "string", "format": "uri", "description": "The page to load in a frame" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CompositionEntriesDescriptionResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/CompositionEntriesDescription" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CompositionEntriesReadingResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/CompositionEntriesReading" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "DeleteCompositionContentItemResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "deleted": { "type": "boolean" }, "contentVersion": { "type": "integer" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionDataSourceResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "nullable": true, "allOf": [ { "$ref": "#/components/schemas/CompositionDataSource" } ] }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CompositionDataSourceResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/CompositionDataSource" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "DeleteCompositionDataSourceResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "required": [ "removed" ], "properties": { "removed": { "type": "boolean", "description": "True whenever the call succeeded, also when there was no binding to remove", "example": true } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "ValidateCompositionContentResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "required": [ "valid" ], "properties": { "valid": { "type": "boolean", "description": "False when there is at least one error. Warnings do not change it." }, "errors": { "type": "array", "description": "What is wrong, at most 100. Absent when `valid` is true.", "items": { "$ref": "#/components/schemas/ContentCheckFinding" } }, "warnings": { "type": "array", "description": "What is worth a look but does not stop the content from being saved, at most 100.", "items": { "$ref": "#/components/schemas/ContentCheckFinding" } }, "sanitizedContent": { "type": "object", "additionalProperties": true, "description": "The body as it was sent; nothing is changed." } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionContentSchemaResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "version": { "type": "string" }, "widgetType": { "type": "string" }, "type": { "type": "string" }, "content": { "type": "object", "description": "Widget-wide fields; enriched properties may include `role` and `roleSource`. AI-built widgets keep their widget-wide fields in `genericContent`, as a list of properties, instead" }, "contentItems": { "type": "object", "description": "Repeating list schema; list-level `role` is `list`; item fields use semantic roles. AI-built widgets store an array of default items instead, each repeating the same fields with their roles, and no list-level `role`" }, "metadata": { "type": "object" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionDesignSchemaResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "version": { "type": "string" }, "widgetType": { "type": "string" }, "type": { "type": "string" }, "theme": { "type": "object" }, "componentGroups": { "type": "array", "description": "Component groups schema", "items": { "type": "object", "description": "Component group definition" } }, "metadata": { "type": "object" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionEmbedSchemaResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "id": { "type": "string", "description": "Identifier of the schema" }, "name": { "type": "string" }, "version": { "type": "string", "description": "Version of the schema; it changes when a setting is added, removed or retyped" }, "type": { "type": "string", "enum": [ "embed" ], "description": "The tab this schema describes" }, "componentGroups": { "type": "array", "description": "The controls of the Embed tab, grouped as the editor shows them", "items": { "type": "object", "description": "Component group definition" } }, "defaults": { "type": "object", "description": "The value of every setting that declares one, by setting name. A value is a boolean, a number or a\nstring, as the setting's `type` says. (Written as an open map, not as a choice of three types: a\ngenerated client cannot be built from a choice between plain types.)\n", "additionalProperties": true } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CheckCompositionAccessResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "canAccess": { "type": "boolean", "description": "Whether the user can access the composition" }, "reason": { "type": "string", "description": "Reason for access decision" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionsBatchResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "compositions": { "type": "array", "items": { "$ref": "#/components/schemas/Composition" } }, "errors": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "error": { "type": "string" } } } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetAllCanvasesResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "data": { "type": "array", "items": { "$ref": "#/components/schemas/Canvas" } }, "page": { "type": "integer", "example": 1 }, "size": { "type": "integer", "example": 20 }, "total": { "type": "integer", "description": "Total number of canvases matching the criteria", "example": 50 } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CanvasResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/Canvas" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "SuccessResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "additionalProperties": true, "description": "The result of the call. Its fields are not described for this operation yet." }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "ErrorDetail": { "type": "object", "required": [ "code", "message", "timestamp" ], "properties": { "code": { "type": "string", "description": "Machine-readable error code.", "example": "RESOURCE_NOT_FOUND" }, "message": { "type": "string", "description": "Human-readable explanation.", "example": "Composition not found" }, "param": { "type": "string", "description": "The field that caused the error, when one did.", "example": "name" }, "docUrl": { "type": "string", "description": "Where this error is explained." }, "suggestedAction": { "type": "string", "description": "What to do about it." }, "retryAfter": { "type": "integer", "description": "Seconds to wait before trying again (rate limits). The same number is in the `Retry-After` header.", "example": 60 }, "details": { "type": "object", "additionalProperties": true, "description": "More about the error: the fields that failed, a limit that was reached." }, "correlationId": { "type": "string", "description": "Quote this when you ask support about the call.", "example": "req_123e4567-e89b-12d3-a456-426614174000" }, "timestamp": { "type": "string", "format": "date-time", "example": "2026-10-15T10:00:00.000Z" } } }, "Translation": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the translation experiment", "example": "123e4567-e89b-12d3-a456-426614174000" }, "creatorId": { "type": "string", "format": "uuid", "description": "ID of the user who created this translation", "example": "456e7890-e89b-12d3-a456-426614174001" }, "name": { "type": "string", "description": "Display name for the translation experiment", "example": "Homepage Multi-language" }, "description": { "type": "string", "description": "Optional description of the translation experiment", "example": "Multi-language homepage for global audience" }, "rootCompositionId": { "type": "string", "format": "uuid", "description": "ID of the original composition being translated", "example": "789e0123-e89b-12d3-a456-426614174002" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The customer of a partner (a managed user) this translation was made for. It is set when the translation is created\nwith the partner's key and the customer's header (`X-Managed-User-Id` or `X-Managed-User-External-Id`), and never\nchanges; null for a translation made without one. In the list of a partner's own workspace, a translation with no tag\nof its own shows the customer who made its original composition, when there is one. It is not a field to send: the\ncustomer comes from the header.\n" }, "managedUserExternalId": { "type": "string", "nullable": true, "description": "Your own id for that customer (the `externalId` you registered it with). Only in the list of a partner's own workspace." }, "rootLanguage": { "type": "string", "description": "Original language code of the composition", "example": "en" }, "status": { "type": "string", "enum": [ "draft", "active", "paused", "completed" ], "description": "Current status of the translation experiment", "example": "active" }, "revision": { "type": "integer", "minimum": 1, "readOnly": true, "description": "Optimistic concurrency revision; bumped on each person-driven change.", "example": 2 }, "embedCode": { "type": "string", "description": "Generated embed code for the translation experiment", "example": "tr_123456" }, "selectedLanguages": { "type": "array", "items": { "type": "string" }, "description": "Array of language codes included in this experiment", "example": [ "en", "es", "fr", "de" ] }, "totalViews": { "type": "integer", "minimum": 0, "description": "Total number of views across all language variants", "example": 1500 }, "createdAt": { "type": "string", "format": "date-time", "description": "When the translation was created", "example": "2024-01-15T09:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the translation was last updated", "example": "2024-01-15T09:00:00Z" }, "origin": { "type": "string", "enum": [ "manual", "automation" ], "description": "Whether this translation was created manually or by workspace automation", "example": "manual" }, "syncStatus": { "type": "string", "enum": [ "current", "pending", "syncing", "failed" ], "description": "Reconciliation state when the root composition changes", "example": "current" }, "lastSyncedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When language versions were last rebuilt from the root" }, "variants": { "type": "array", "items": { "$ref": "#/components/schemas/TranslationVariant" }, "description": "Associated translation variants for each language" } }, "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "creatorId": "456e7890-e89b-12d3-a456-426614174001", "name": "Homepage Multi-language", "description": "Multi-language homepage for global audience", "rootCompositionId": "789e0123-e89b-12d3-a456-426614174002", "managedUserId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "managedUserExternalId": "Example managedUserExternalId", "rootLanguage": "en", "status": "active", "revision": 2, "embedCode": "tr_123456", "selectedLanguages": [ "en", "es", "fr", "de" ], "totalViews": 1500, "createdAt": "2024-01-15T09:00:00Z", "updatedAt": "2024-01-15T09:00:00Z", "origin": "manual", "syncStatus": "current", "lastSyncedAt": "2026-01-15T09:30:00.000Z", "variants": [ "Example TranslationVariant" ] } }, "TranslationVariant": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the translation variant", "example": "789e0123-e89b-12d3-a456-426614174002" }, "translationId": { "type": "string", "format": "uuid", "description": "ID of the parent translation experiment", "example": "123e4567-e89b-12d3-a456-426614174000" }, "compositionId": { "type": "string", "format": "uuid", "description": "ID of the translated composition", "example": "456e7890-e89b-12d3-a456-426614174003" }, "languageCode": { "type": "string", "description": "Language code for this variant", "example": "es" }, "languageName": { "type": "string", "description": "Human-readable language name", "example": "Spanish" }, "isRoot": { "type": "boolean", "description": "Whether this is the original/root language variant", "example": false }, "embedCode": { "type": "string", "description": "Generated embed code for this language variant", "example": "tr_123456_es" }, "totalViews": { "type": "integer", "minimum": 0, "description": "Total number of views for this language variant", "example": 375 }, "status": { "type": "string", "enum": [ "active", "translating", "error" ], "description": "Current status of this translation variant", "example": "active" }, "translationProgress": { "type": "number", "minimum": 0, "maximum": 100, "description": "Translation completion progress percentage", "example": 100 }, "createdAt": { "type": "string", "format": "date-time", "description": "When the variant was created", "example": "2024-01-15T09:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the variant was last updated", "example": "2024-01-15T09:00:00Z" } }, "example": { "id": "789e0123-e89b-12d3-a456-426614174002", "translationId": "123e4567-e89b-12d3-a456-426614174000", "compositionId": "456e7890-e89b-12d3-a456-426614174003", "languageCode": "es", "languageName": "Spanish", "isRoot": false, "embedCode": "tr_123456_es", "totalViews": 375, "status": "active", "translationProgress": 100, "createdAt": "2024-01-15T09:00:00Z", "updatedAt": "2024-01-15T09:00:00Z" } }, "CreateWorkspaceTranslationRequest": { "type": "object", "description": "What a new translation experiment needs, in a workspace: a `name`, the composition to translate\n(`rootCompositionId`), the language it is written in (`rootLanguage`) and the languages to make a copy in\n(`selectedLanguages`), written in camelCase like the rest of the API. All four are needed: a request without\nthe composition, the language or the languages is refused with 400 and the name of what is missing.\n", "required": [ "name" ], "properties": { "name": { "type": "string", "example": "Product Page Multi-language" }, "description": { "type": "string", "example": "Translate product page for European markets" }, "rootCompositionId": { "type": "string", "format": "uuid", "description": "The composition to translate (needed). It must be one the credential may use; for a call made for one managed user (`X-Managed-User-Id`), one of that customer's own compositions.", "example": "789e0123-e89b-12d3-a456-426614174002" }, "rootLanguage": { "type": "string", "description": "The language the composition is written in (needed)", "example": "en" }, "selectedLanguages": { "type": "array", "description": "The languages to make a copy in, one translated copy for each (needed)", "items": { "type": "string" }, "example": [ "es", "fr", "de" ] } }, "example": { "name": "Product Page Multi-language", "description": "Translate product page for European markets", "rootCompositionId": "789e0123-e89b-12d3-a456-426614174002", "rootLanguage": "en", "selectedLanguages": [ "es", "fr", "de" ], "root_composition_id": "789e0123-e89b-12d3-a456-426614174002", "root_language": "en", "selected_languages": [ "es", "fr", "de" ] } }, "TranslationRevisionRequest": { "type": "object", "description": "Optional body of the calls that change or delete a translation (delete it, start a sync now, remove a language). Send the `revision` the translation had when it was last read to be sure the call acts on that version of it.", "properties": { "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." } }, "example": { "revision": 42 } }, "TranslationListResponse": { "type": "object", "description": "The translation experiments of a workspace, in the `{ success, data }` envelope the API sends.", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "required": [ "translations", "count" ], "properties": { "translations": { "type": "array", "items": { "$ref": "#/components/schemas/Translation" } }, "count": { "type": "integer" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "example": { "success": true, "data": {}, "meta": null } }, "TranslationWithMessageResponse": { "type": "object", "description": "A translation experiment that was just created or changed, with the gateway's message, in the `{ success, data }` envelope.", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "required": [ "message", "translation" ], "properties": { "message": { "type": "string" }, "translation": { "$ref": "#/components/schemas/Translation" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } }, "example": { "success": true, "data": {}, "meta": null } }, "MyPartnership": { "type": "object", "description": "Where the partnership is on its way to its end. A partnership ends by a date Widgetic writes into the contract, never by being deleted: while the end date is ahead everything works (`ending`), then it winds down for 60 days (reading and exporting work, the embeds keep being served, nothing can be created or changed), and then it is closed (the embeds go dark and only the invoices of the signed-in owner can be read). Always sent: a partnership with no end date says `in_force` and nulls. The phase is worked out from the dates and today, so it changes on the day with nothing running.\n", "required": [ "phase", "endsOn", "windDownEndsOn", "daysLeft" ], "properties": { "phase": { "type": "string", "enum": [ "in_force", "ending", "winding_down", "closed", "erased" ], "description": "`in_force` while no end date is set. `ending` from the day an end date is set until it has passed. `winding_down` for 60 days after it. `closed` after that. `erased` once Widgetic has erased what it held for the partner.\n" }, "endsOn": { "type": "string", "format": "date", "nullable": true, "description": "The last day the partnership is in force; null while no end date is set" }, "windDownEndsOn": { "type": "string", "format": "date", "nullable": true, "description": "The last day of the wind-down; the day after it the partnership is closed. Null while no end date is set" }, "daysLeft": { "type": "integer", "nullable": true, "description": "The whole days left in the current phase: to the end date while `ending`, to the end of the wind-down while `winding_down` (0 on the last day of each). Null in every other phase.\n" } }, "example": { "phase": "Example phase", "endsOn": "Example endsOn", "windDownEndsOn": "Example windDownEndsOn", "daysLeft": 42 } }, "OrganizationApiKey": { "type": "object", "description": "A workspace API key, as it is listed. It acts as the workspace and works in that workspace only: a workspace's key starts with `wdg_org_`, and the key of a partner's home workspace (its only workspace) starts with `wgt_prt_`. It never carries the secret: that is shown once, in the answer to the request that made the key, and cannot be read again.", "properties": { "keyId": { "type": "string", "description": "The id of the key. Use it to rename, switch off, delete or read the usage of the key" }, "keyPreview": { "type": "string", "description": "The first characters of the key, to tell keys apart. Not enough to use it", "example": "wdg_org_ab12..." }, "name": { "type": "string", "description": "The name given to the key" }, "isActive": { "type": "boolean", "description": "Whether the key works. A key that is switched off is refused until it is switched on again" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "expiresAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the key stops working. Null when it does not expire" }, "lastUsedAt": { "type": "string", "format": "date-time", "nullable": true, "description": "When the key was last used. Null when it never was" }, "scopes": { "type": "array", "items": { "$ref": "#/components/schemas/ApiKeyScope" }, "description": "What the key may do. A key with full access holds every scope. The scopes of a key are fixed when it is made" }, "preset": { "type": "string", "enum": [ "read_only", "content", "full_access", "custom" ], "description": "The name the scopes amount to. `full_access` is a key that is not limited, `read_only` and `content` are the ready-made lists, and `custom` is any other list" } }, "required": [ "keyId", "keyPreview", "name", "isActive", "createdAt", "scopes", "preset" ], "example": { "keyId": "Example keyId", "keyPreview": "wdg_org_ab12...", "name": "Example name", "isActive": true, "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z", "expiresAt": "2026-01-15T09:30:00.000Z", "lastUsedAt": "2026-01-15T09:30:00.000Z", "scopes": [ "Example ApiKeyScope" ], "preset": "Example preset" } }, "CreatedOrganizationApiKey": { "type": "object", "description": "A workspace key that has just been made. It is the only answer that ever carries the secret, in `key`. Store it now: Widgetic keeps only a hash of it, and it cannot be shown again.", "properties": { "key": { "type": "string", "description": "The secret. Send it as a bearer token, in the `Authorization` header. Shown once. It starts with `wdg_org_`, or with `wgt_prt_` when the workspace is a partner's home", "example": "wdg_org_YOUR_NEW_KEY" }, "keyId": { "type": "string", "description": "The id of the key" }, "keyPreview": { "type": "string", "example": "wdg_org_ab12..." }, "name": { "type": "string" }, "isActive": { "type": "boolean" }, "createdAt": { "type": "string", "format": "date-time" }, "updatedAt": { "type": "string", "format": "date-time" }, "expiresAt": { "type": "string", "format": "date-time", "nullable": true }, "lastUsedAt": { "type": "string", "format": "date-time", "nullable": true }, "scopes": { "type": "array", "items": { "$ref": "#/components/schemas/ApiKeyScope" }, "description": "What the key may do. A key made without scopes holds every scope" }, "preset": { "type": "string", "enum": [ "read_only", "content", "full_access", "custom" ], "description": "The name the scopes amount to" } }, "required": [ "key", "keyId", "keyPreview", "name", "isActive", "createdAt", "scopes", "preset" ], "example": { "key": "wdg_org_YOUR_NEW_KEY", "keyId": "Example keyId", "keyPreview": "wdg_org_ab12...", "name": "Example name", "isActive": true, "createdAt": "2026-01-15T09:30:00.000Z", "updatedAt": "2026-01-15T09:30:00.000Z", "expiresAt": "2026-01-15T09:30:00.000Z", "lastUsedAt": "2026-01-15T09:30:00.000Z", "scopes": [ "Example ApiKeyScope" ], "preset": "Example preset" } }, "ManagedUserContentCounts": { "type": "object", "description": "What a managed user has made, as `GET /managed-users?include=counts` answers it: how many widgets (a widget with several versions counts once), compositions (a demo does not count) and workflows (an archived one does not count) are filed under it. Not part of an answer that did not ask for it.\n", "required": [ "widgets", "compositions", "workflows" ], "properties": { "widgets": { "type": "integer", "minimum": 0, "example": 12 }, "compositions": { "type": "integer", "minimum": 0, "example": 30 }, "workflows": { "type": "integer", "minimum": 0, "example": 2 } }, "example": { "widgets": 12, "compositions": 30, "workflows": 2 } }, "ABTest": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the A/B test", "example": "123e4567-e89b-12d3-a456-426614174000" }, "creatorId": { "type": "string", "format": "uuid", "description": "ID of the user who created this test", "example": "456e7890-e89b-12d3-a456-426614174001" }, "organizationId": { "type": "string", "format": "uuid", "description": "ID of the workspace (organization) the test belongs to", "example": "789e0123-e89b-12d3-a456-426614174002", "nullable": true }, "workspaceType": { "type": "string", "enum": [ "organization" ], "description": "Workspace type, always organization (there is no personal workspace any more)", "example": "organization" }, "managedUserId": { "type": "string", "format": "uuid", "nullable": true, "description": "The customer of a partner (a managed user) this test was made for. It is set when the test is created with the partner's\nkey and the customer's header (`X-Managed-User-Id` or `X-Managed-User-External-Id`), and never changes; null for a test made\nwithout one. In the list of a partner's own workspace, a test with no tag of its own shows the customer who made the\ncomposition of its first version, when there is one. It is not a field to send: the customer comes from the header.\n" }, "managedUserExternalId": { "type": "string", "nullable": true, "description": "Your own id for that customer (the `externalId` you registered it with). Only in the list of a partner's own workspace." }, "name": { "type": "string", "description": "Display name for the A/B test", "example": "Homepage Hero Test" }, "description": { "type": "string", "description": "Optional description of what the test is measuring", "example": "Testing different hero section layouts" }, "status": { "type": "string", "enum": [ "draft", "running", "paused", "completed", "graduated" ], "description": "Current status of the test", "example": "running" }, "revision": { "type": "integer", "minimum": 1, "readOnly": true, "description": "Optimistic concurrency revision; bumped on each person-driven change to the test.", "example": 3 }, "successMetrics": { "type": "array", "items": { "type": "string" }, "description": "Array of success metrics being tracked", "example": [ "clicks", "conversions" ] }, "primaryMetric": { "type": "string", "description": "Primary metric used for statistical significance", "example": "conversions" }, "confidenceLevel": { "type": "number", "minimum": 0.8, "maximum": 0.99, "description": "Required confidence level (e.g., 0.95 for 95%)", "example": 0.95 }, "minSampleSize": { "type": "integer", "minimum": 100, "description": "Minimum sample size required before results are considered valid", "example": 1000 }, "autoGraduate": { "type": "boolean", "description": "Whether the test should automatically graduate when significance is reached", "example": true }, "graduationThreshold": { "type": "number", "minimum": 0.8, "maximum": 0.99, "description": "Threshold for automatic graduation", "example": 0.95 }, "startDate": { "type": "string", "format": "date-time", "description": "When the test started or will start", "example": "2024-01-15T10:00:00Z" }, "endDate": { "type": "string", "format": "date-time", "description": "When the test ended or will end", "example": "2024-01-30T10:00:00Z" }, "durationDays": { "type": "integer", "minimum": 1, "maximum": 365, "description": "Duration of the test in days", "example": 15 }, "winningVariantId": { "type": "string", "format": "uuid", "description": "ID of the winning variant (if test has concluded)", "example": "789e0123-e89b-12d3-a456-426614174002" }, "graduatedAt": { "type": "string", "format": "date-time", "description": "When the test was graduated", "example": "2024-01-30T15:30:00Z" }, "statisticalSignificance": { "type": "number", "minimum": 0, "maximum": 1, "description": "Statistical significance level achieved", "example": 0.96 }, "createdAt": { "type": "string", "format": "date-time", "description": "When the test was created", "example": "2024-01-15T09:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the test was last updated", "example": "2024-01-15T09:00:00Z" }, "variants": { "type": "array", "items": { "$ref": "#/components/schemas/ABTestVariant" }, "description": "Associated test variants" } }, "example": { "id": "123e4567-e89b-12d3-a456-426614174000", "creatorId": "456e7890-e89b-12d3-a456-426614174001", "organizationId": "789e0123-e89b-12d3-a456-426614174002", "workspaceType": "organization", "name": "Homepage Hero Test", "description": "Testing different hero section layouts", "status": "running", "successMetrics": [ "clicks", "conversions" ], "primaryMetric": "conversions", "confidenceLevel": 0.95, "minSampleSize": 1000, "autoGraduate": true, "graduationThreshold": 0.95, "startDate": "2024-01-15T10:00:00Z", "endDate": "2024-01-30T10:00:00Z", "durationDays": 15, "createdAt": "2024-01-15T09:00:00Z", "updatedAt": "2024-01-15T09:00:00Z", "variants": [] } }, "ABTestVariant": { "type": "object", "properties": { "id": { "type": "string", "format": "uuid", "description": "Unique identifier for the variant", "example": "789e0123-e89b-12d3-a456-426614174002" }, "abTestId": { "type": "string", "format": "uuid", "description": "ID of the parent A/B test", "example": "123e4567-e89b-12d3-a456-426614174000" }, "compositionId": { "type": "string", "format": "uuid", "description": "ID of the composition this variant uses", "example": "456e7890-e89b-12d3-a456-426614174003" }, "name": { "type": "string", "description": "Display name for the variant", "example": "Control" }, "description": { "type": "string", "description": "Optional description of the variant", "example": "Original homepage design" }, "trafficPercentage": { "type": "number", "minimum": 0.1, "maximum": 100, "description": "Percentage of traffic allocated to this variant", "example": 50 }, "goalTarget": { "type": "string", "nullable": true, "description": "The element inside this version's widget that counts as the goal (a CSS selector), or null when the goal counts anywhere in the widget", "example": "#subscribe" }, "embedCode": { "type": "string", "description": "Generated embed code for this variant", "example": "" }, "totalImpressions": { "type": "integer", "minimum": 0, "description": "Total number of impressions recorded", "example": 2500 }, "totalConversions": { "type": "integer", "minimum": 0, "description": "Total number of conversions recorded", "example": 125 }, "conversionRate": { "type": "number", "minimum": 0, "maximum": 1, "description": "Calculated conversion rate", "example": 0.05 }, "createdAt": { "type": "string", "format": "date-time", "description": "When the variant was created", "example": "2024-01-15T09:00:00Z" }, "updatedAt": { "type": "string", "format": "date-time", "description": "When the variant was last updated", "example": "2024-01-20T14:30:00Z" } }, "example": { "id": "789e0123-e89b-12d3-a456-426614174002", "abTestId": "123e4567-e89b-12d3-a456-426614174000", "compositionId": "456e7890-e89b-12d3-a456-426614174003", "name": "Control", "description": "Original homepage design", "trafficPercentage": 50, "embedCode": "", "totalImpressions": 2500, "totalConversions": 125, "conversionRate": 0.05, "createdAt": "2024-01-15T09:00:00Z", "updatedAt": "2024-01-20T14:30:00Z" } }, "CreateABTestRequest": { "type": "object", "required": [ "name", "variants", "primaryMetric" ], "properties": { "name": { "type": "string", "description": "Display name for the A/B test", "example": "Homepage Hero Test" }, "description": { "type": "string", "description": "Optional description of what the test is measuring", "example": "Testing different hero section layouts" }, "workspaceType": { "type": "string", "enum": [ "organization" ], "description": "Workspace type, always organization; it may be left out (the workspace is the one in the path)", "example": "organization" }, "variants": { "type": "array", "minItems": 2, "maxItems": 4, "description": "The versions compared, two to four. Each version shows its own composition.", "items": { "type": "object", "required": [ "name", "compositionId", "trafficPercentage" ], "properties": { "name": { "type": "string", "description": "Name of the variant (e.g., 'Control', 'Variant A')", "example": "Variant A" }, "description": { "type": "string", "description": "Optional description for the variant", "example": "New design with a larger CTA" }, "compositionId": { "type": "string", "format": "uuid", "description": "The composition to use for this variant", "example": "456e7890-e89b-12d3-a456-426614174003" }, "trafficPercentage": { "type": "number", "minimum": 0.1, "maximum": 100, "description": "Percentage of traffic for this variant. The shares of all versions add up to 100.", "example": 50 }, "goalTarget": { "type": "string", "maxLength": 200, "description": "The element inside this version's widget that counts as the goal, as a CSS selector for one element (for example `[data-widgetic-goal=\"cta\"]` or `#subscribe`). Leave it out to count the goal anywhere in the widget. Only goals that support an element (see `GET /metrics/available`) take one. Use `GET /workspaces/{workspaceId}/compositions/{id}/ab-goal-targets` to list the candidates.", "example": "#subscribe" } } } }, "successMetrics": { "type": "array", "items": { "type": "string" }, "description": "Metrics to track. Must include the primary metric.", "example": [ "clicks" ] }, "primaryMetric": { "type": "string", "description": "The one goal the test measures and the winner is decided on: the only conversion that counts. One of the goals `GET /metrics/available` lists as available.", "example": "clicks" }, "confidenceLevel": { "type": "number", "default": 0.95 }, "minSampleSize": { "type": "integer", "default": 1000 }, "autoGraduate": { "type": "boolean", "default": true }, "graduationThreshold": { "type": "number", "default": 0.95 }, "startDate": { "type": "string", "format": "date-time" }, "endDate": { "type": "string", "format": "date-time" }, "durationDays": { "type": "integer" } }, "example": { "name": "Homepage Hero Test", "description": "Testing different hero section layouts", "workspaceType": "organization", "variants": [], "successMetrics": [ "clicks" ], "primaryMetric": "clicks", "confidenceLevel": 42, "minSampleSize": 42, "autoGraduate": true, "graduationThreshold": 42, "startDate": "2026-01-15T09:30:00.000Z", "endDate": "2026-01-15T09:30:00.000Z", "durationDays": 42 } }, "ABTestRevisionRequest": { "type": "object", "description": "Optional body of the calls that delete a test or move it (start, pause). Send the `revision` the test had when it was last read to be sure the call acts on that version of the test.", "properties": { "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." } }, "example": { "revision": 42 } }, "UpdateABTestRequest": { "type": "object", "properties": { "revision": { "type": "integer", "minimum": 0, "description": "The revision the caller last read. When it is no longer current the request is refused with 409 and `details.reason` `revision_changed`. Omit it to keep last-write-wins behaviour." }, "name": { "type": "string" }, "description": { "type": "string" }, "status": { "type": "string", "enum": [ "draft", "running", "paused", "completed", "graduated" ], "description": "The state to move the test to. A draft can only start (running). A running test can be paused, completed or graduated, and a paused test can resume (running), be completed or be graduated. A completed or graduated test has ended and stays ended. Naming the state the test is already in changes nothing. A test graduates to one of its versions, so to graduate a test stop it and name the winning version instead." }, "successMetrics": { "type": "array", "items": { "type": "string" }, "description": "Metrics to track. Can only be changed while the test is a draft; must include the primary metric." }, "primaryMetric": { "type": "string", "description": "The goal the test measures. Can only be changed while the test is a draft." }, "variants": { "type": "array", "maxItems": 4, "description": "The goal element of each version, matched to an existing version by `id`. Can only be changed while the test is a draft: once a test has started its goal and elements are fixed, so the counts stay comparable.", "items": { "type": "object", "required": [ "id" ], "properties": { "id": { "type": "string", "format": "uuid" }, "goalTarget": { "type": "string", "nullable": true, "maxLength": 200, "description": "The element that counts as the goal (a CSS selector), or null to count the goal anywhere in the widget" } } } }, "confidenceLevel": { "type": "number" }, "minSampleSize": { "type": "integer" }, "autoGraduate": { "type": "boolean" }, "graduationThreshold": { "type": "number" }, "startDate": { "type": "string", "format": "date-time" }, "endDate": { "type": "string", "format": "date-time" }, "durationDays": { "type": "integer" } }, "example": { "revision": 42, "name": "Example name", "description": "Example description", "status": "Example status", "successMetrics": [], "primaryMetric": "Example primaryMetric", "variants": [], "confidenceLevel": 42, "minSampleSize": 42, "autoGraduate": true, "graduationThreshold": 42, "startDate": "2026-01-15T09:30:00.000Z", "endDate": "2026-01-15T09:30:00.000Z", "durationDays": 42 } }, "ABTestStatistics": { "type": "object", "description": "What an AB test has gathered so far, overall and for each version, with the advice on what to do next", "properties": { "overall": { "type": "object", "properties": { "totalImpressions": { "type": "integer", "description": "Visitors who were shown a version (impression events for tests recorded before visitors were counted; see counting)", "example": 2000 }, "totalConversions": { "type": "integer", "description": "Visitors who converted, across all versions", "example": 180 }, "totalImpressionEvents": { "type": "integer", "description": "Every impression event received, a returning visitor counted each time" }, "totalConversionEvents": { "type": "integer", "description": "Every conversion event received, a repeat click counted each time" }, "counting": { "type": "string", "enum": [ "visitors", "events" ], "description": "What the counts and every rate and p-value are made of. `visitors`: one count per visitor. `events`: a test recorded before visitors were counted, which only has event counts." }, "overallConversionRate": { "type": "number", "description": "Conversions divided by impressions, as a fraction between 0 and 1", "example": 0.09 }, "statisticalPower": { "type": "number", "description": "The power of the test to see a real 10% relative lift over the control's rate, with the visitors its smallest version has so far (between 0 and 1). 0 until the control has a conversion rate to plan from.", "example": 0.62 }, "sampleSizeNeededPerVariant": { "type": "integer", "nullable": true, "description": "Visitors each version needs for 80% power at that lift; null while it cannot be worked out", "example": 3200 }, "sampleRatioMismatch": { "type": "object", "description": "Whether the visitors each version got match the traffic shares it was configured with", "properties": { "detected": { "type": "boolean", "description": "True when the split is off by more than chance explains (chi-square p < 0.001). The result is then not trusted and the test is never graduated automatically." }, "pValue": { "type": "number", "description": "Chi-square p-value of the split" } } }, "confidenceLevel": { "type": "number", "description": "The confidence the test is judged at, as a fraction (0.95 for 95%)", "example": 0.95 } } }, "variants": { "type": "array", "description": "One entry per version, in the test's order (the first one is the control)", "items": { "type": "object", "properties": { "variantId": { "type": "string", "format": "uuid" }, "variantName": { "type": "string", "example": "Version B" }, "impressions": { "type": "integer", "description": "Visitors who saw this version" }, "conversions": { "type": "integer", "description": "Visitors who converted in this version" }, "rawImpressions": { "type": "integer", "description": "Every impression event of this version, a returning visitor counted each time" }, "rawConversions": { "type": "integer", "description": "Every conversion event of this version, a repeat click counted each time" }, "conversionRate": { "type": "number", "description": "Conversions divided by impressions, as a fraction between 0 and 1" }, "confidenceIntervalLower": { "type": "number", "description": "Lower bound of the conversion rate's confidence interval (Wilson score)" }, "confidenceIntervalUpper": { "type": "number", "description": "Upper bound of the conversion rate's confidence interval (Wilson score)" }, "zScore": { "type": "number", "description": "Z-score of the version's rate against the control's" }, "pValue": { "type": "number", "description": "P-value of the version's rate against the control's" }, "isWinner": { "type": "boolean", "description": "Whether the test ended with this version as the winner" }, "liftPercentage": { "type": "number", "description": "How much better the version converts than the control, in percent", "example": 57.14 }, "statisticalSignificance": { "type": "number", "description": "The test's confidence level when this version is significantly BETTER than the control, and 0 otherwise", "example": 0.95 }, "significantlyWorse": { "type": "boolean", "description": "True when this version is significantly WORSE than the control at the test's confidence level" }, "bayesianProbabilityToBeatControl": { "type": "number", "nullable": true, "description": "Probability, between 0 and 1, that the version beats the control" } } } }, "recommendation": { "type": "object", "properties": { "action": { "type": "string", "enum": [ "continue", "stop", "graduate", "extend" ], "description": "What the API advises doing with the test" }, "reason": { "type": "string", "example": "Test needs more data. Current: 120, Required: 1000" }, "minAdditionalSamples": { "type": "integer", "description": "How many more impressions the test needs before it can be judged (only when it needs more)" } } } }, "example": { "overall": {}, "variants": [], "recommendation": {} } }, "ABTestDiagnosis": { "type": "object", "description": "An AI review of what the versions of a test change, and whether the winner is safe to promote", "properties": { "hasMeaningfulContrast": { "type": "boolean", "description": "Whether the versions differ in a way that can explain a difference in results" }, "primaryDriver": { "type": "string", "enum": [ "urgency_or_scarcity", "social_proof_or_trust", "clarity_and_simplicity", "value_and_pricing_framing", "friction_reduction", "cosmetic_only", "unclassified" ], "description": "The main thing the challenger changes" }, "cognitiveClarityScore": { "type": "number", "description": "How clear the challenger's message is to a visitor" }, "safeToGraduate": { "type": "boolean", "description": "Whether the challenger is safe to promote (brand safety)" }, "qualitativeReason": { "type": "string", "description": "The review's explanation, in plain words" } }, "example": { "hasMeaningfulContrast": true, "primaryDriver": "Example primaryDriver", "cognitiveClarityScore": 42, "safeToGraduate": true, "qualitativeReason": "Example qualitativeReason" } }, "ApiKeyUsageLog": { "type": "object", "description": "One call made with a workspace API key", "properties": { "id": { "type": "string", "format": "uuid" }, "keyId": { "type": "string", "description": "The key the call was made with" }, "timestamp": { "type": "string", "format": "date-time" }, "path": { "type": "string", "example": "/internal-widgetic" }, "method": { "type": "string", "example": "POST" }, "status": { "type": "integer", "description": "The HTTP status the call ended with", "example": 200 }, "kind": { "type": "string", "nullable": true, "example": "Success" }, "details": { "type": "object", "additionalProperties": true, "description": "What was recorded about the call" } }, "required": [ "id", "keyId", "timestamp", "path", "method", "status" ], "example": { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "keyId": "Example keyId", "timestamp": "2026-01-15T09:30:00.000Z", "path": "/internal-widgetic", "method": "POST", "status": 200, "kind": "Success", "details": {} } }, "GetSupportedLanguagesAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "languages": { "type": "object", "additionalProperties": { "type": "object", "properties": { "name": { "type": "string", "example": "Spanish" }, "nativeName": { "type": "string", "example": "EspaƱol" }, "region": { "type": "string", "example": "Europe" }, "isPreselected": { "type": "boolean", "example": true } } } }, "preselected": { "type": "array", "items": { "type": "string" }, "example": [ "en", "es", "fr", "de", "it" ] } } } }, "required": [ "success", "data" ] }, "GetSupportedLanguagesAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/GetSupportedLanguagesAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetLanguagePresetsAnswer": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "properties": { "presets": { "type": "object" } } } }, "required": [ "success", "data" ] }, "GetLanguagePresetsAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/GetLanguagePresetsAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "TranslationAnswer": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/Translation" } }, "required": [ "success", "data" ] }, "TranslationAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/TranslationAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "DeleteTranslationResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "success": { "type": "boolean" }, "message": { "type": "string" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "AddLanguagesToTranslationAnswer": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/Translation" }, "message": { "type": "string" } }, "required": [ "success", "data" ] }, "AddLanguagesToTranslationAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/AddLanguagesToTranslationAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "RemoveLanguageFromTranslationAnswer": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/Translation" }, "message": { "type": "string" } }, "required": [ "success", "data" ] }, "RemoveLanguageFromTranslationAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/RemoveLanguageFromTranslationAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "RetranslateExperimentResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "success": { "type": "boolean" }, "message": { "type": "string" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "UpdateTranslationStatusAnswer": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "$ref": "#/components/schemas/Translation" }, "message": { "type": "string" } }, "required": [ "success", "data" ] }, "UpdateTranslationStatusAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/UpdateTranslationStatusAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetTranslationAnalyticsAnswer": { "type": "object", "properties": { "success": { "type": "boolean" }, "data": { "type": "object", "properties": { "totalViews": { "type": "integer" }, "languageBreakdown": { "type": "array", "items": { "type": "object", "properties": { "languageCode": { "type": "string" }, "views": { "type": "integer" }, "percentage": { "type": "number" } } } }, "topPerformingLanguages": { "type": "array", "items": { "type": "object", "properties": { "languageCode": { "type": "string" }, "views": { "type": "integer" } } } }, "completionStatus": { "type": "object" } } } }, "required": [ "success", "data" ] }, "GetTranslationAnalyticsAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/GetTranslationAnalyticsAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CreatedOrganizationApiKeyResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/CreatedOrganizationApiKey" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "OrganizationApiKeyResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/OrganizationApiKey" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "DeleteOrganizationApiKeyResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "success": { "type": "boolean" }, "message": { "type": "string" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetOrganizationApiKeyUsageLogsResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "logs": { "type": "array", "items": { "$ref": "#/components/schemas/ApiKeyUsageLog" } } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetAvailableMetricsAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string", "description": "Metric identifier", "example": "clicks" }, "name": { "type": "string", "description": "Human-readable metric name", "example": "Clicks" }, "description": { "type": "string", "description": "What counts as one conversion of this goal", "example": "A visitor clicks a button, a link or another clickable element of the widget" }, "tracking": { "type": "string", "enum": [ "automatic", "widget-event" ], "description": "automatic: recognised by the embed SDK from what visitors do. widget-event: counted only when the widget reports it.", "example": "automatic" }, "supportsElementTarget": { "type": "boolean", "description": "Whether a version can name the element of its widget that counts (goal_target)", "example": true }, "available": { "type": "boolean", "description": "Whether a test can be created with this goal", "example": true }, "unavailableReason": { "type": "string", "description": "Why the goal cannot be chosen; present when available is false" } } } } }, "required": [ "success", "data" ] }, "GetAvailableMetricsAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/GetAvailableMetricsAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "ABTestListAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "array", "items": { "$ref": "#/components/schemas/ABTest" } }, "meta": { "type": "object", "properties": { "count": { "type": "integer" }, "workspaceType": { "type": "string", "enum": [ "organization" ] } } } }, "required": [ "success", "data" ] }, "ABTestListAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/ABTestListAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "ABTestAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/ABTest" } }, "required": [ "success", "data" ] }, "ABTestAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/ABTestAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "DeleteWorkspaceABTestResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "message": { "type": "string", "example": "AB test deleted successfully" } } }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "StopWorkspaceABTestAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/ABTest" }, "message": { "type": "string", "example": "AB test stopped successfully" } }, "required": [ "success", "data" ] }, "StopWorkspaceABTestAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/StopWorkspaceABTestAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "CheckWorkspaceABTestAutoStopAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "shouldStop": { "type": "boolean", "description": "Whether the test should stop", "example": true }, "reason": { "type": "string", "description": "Reason for stopping or continuing", "example": "Auto-graduated: Variant B achieved 96.5% confidence" }, "newStatus": { "type": "string", "description": "New status if test was automatically stopped", "example": "graduated" } } } }, "required": [ "success", "data" ] }, "CheckWorkspaceABTestAutoStopAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/CheckWorkspaceABTestAutoStopAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "SetWorkspaceABTestDurationAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "$ref": "#/components/schemas/ABTest" }, "message": { "type": "string", "example": "Test duration set successfully" } }, "required": [ "success", "data" ] }, "SetWorkspaceABTestDurationAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/SetWorkspaceABTestDurationAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "ValidateWorkspaceGoalTrackingAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "isValid": { "type": "boolean", "description": "Whether all compositions support the selected metrics", "example": false }, "issues": { "type": "array", "description": "Tracking issues found", "items": { "type": "object", "properties": { "variant": { "type": "string" }, "metric": { "type": "string" }, "reason": { "type": "string" } } } }, "recommendations": { "type": "array", "description": "Recommendations for fixing issues", "items": { "type": "string" } } } } }, "required": [ "success", "data" ] }, "ValidateWorkspaceGoalTrackingAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/ValidateWorkspaceGoalTrackingAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } }, "GetCompositionABGoalTargetsAnswer": { "type": "object", "properties": { "success": { "type": "boolean", "example": true }, "data": { "type": "object", "properties": { "compositionId": { "type": "string", "format": "uuid" }, "complete": { "type": "boolean", "description": "Always false for now; elements built while the widget runs are not listed", "example": false }, "note": { "type": "string", "enum": [ "widget_not_published", "widget_page_unavailable", "widget_page_too_large", "built_at_run_time" ], "description": "Why the list is empty or limited" }, "goals": { "type": "array", "nullable": true, "description": "The goals this widget can be measured on, decided when its published version was generated (from its source, so it covers elements the widget builds while it runs). Only goals the platform counts by itself are declared. `null` means the version declared nothing (a widget generated before goals were declared, or one with nothing to press, submit or play): offer the goals from `GET /metrics/available` as before. Not narrowed by `metric`.", "items": { "type": "object", "properties": { "metric": { "type": "string", "description": "One of the goals `GET /metrics/available` lists", "example": "clicks" }, "label": { "type": "string", "description": "What a person recognises, specific to this widget", "example": "Clicks on \"Choose plan\"" }, "description": { "type": "string", "description": "One sentence on what is counted" }, "selector": { "type": "string", "description": "The element that counts, to store as a version's goalTarget; absent means anywhere in the widget", "example": "[data-widgetic-goal=\"choose-plan\"]" }, "recommended": { "type": "boolean", "description": "The goal most customers of this widget will want; at most one per widget" } } } }, "targets": { "type": "array", "items": { "type": "object", "properties": { "selector": { "type": "string", "description": "The selector to store as the version's goalTarget", "example": "[data-widgetic-goal=\"subscribe\"]" }, "label": { "type": "string", "description": "What the element shows or is called", "example": "Subscribe" }, "kind": { "type": "string", "enum": [ "goal", "button", "link", "form", "media" ] }, "tag": { "type": "string", "example": "button" }, "metrics": { "type": "array", "description": "The goals this element can be the target of", "items": { "type": "string" } }, "preferred": { "type": "boolean", "description": "True for an element the widget marks with data-widgetic-goal" }, "matchCount": { "type": "integer", "description": "How many elements of the widget the selector matches; more than one means it is not specific" } } } } } } }, "required": [ "success", "data" ] }, "GetCompositionABGoalTargetsAnswerResponse": { "type": "object", "required": [ "success", "data" ], "properties": { "success": { "type": "boolean", "description": "Always `true` on a success.", "example": true }, "data": { "$ref": "#/components/schemas/GetCompositionABGoalTargetsAnswer" }, "meta": { "$ref": "#/components/schemas/ResponseMeta" } } } }, "parameters": { "WorkflowWorkspaceId": { "name": "workspaceId", "in": "path", "required": true, "description": "The workspace: the UUID of a workspace you belong to. A call made for one of your managed users\n(`X-Managed-User-Id`, or an editor session) always names your partner workspace, the one an editor session\nanswers with (`workspaceId`): a managed user has no workspace of their own, and the id of any other workspace is\nanswered 404 (`RESOURCE_WORKSPACE_NOT_FOUND`).\n", "schema": { "type": "string", "format": "uuid" }, "example": "7d0b4c1a-2f6e-4f3a-9b1c-5e8a3d2c1b0f" }, "WorkflowId": { "name": "workflowId", "in": "path", "required": true, "description": "The workflow's id", "schema": { "type": "string", "format": "uuid" } }, "WorkflowVersionId": { "name": "versionId", "in": "path", "required": true, "description": "The id of a published version of the workflow", "schema": { "type": "string", "format": "uuid" } }, "CompositionEntryLimit": { "in": "query", "name": "limit", "schema": { "type": "integer", "minimum": 1, "maximum": 100, "default": 25 } }, "CompositionEntryOrder": { "in": "query", "name": "order", "description": "`desc` (the default) lists the newest entry first, `asc` the oldest. Entries are sorted by their time, then\nby their id (compared as text, byte by byte) in the same direction, so the order of two entries made at the\nsame instant is always the same; an entry with no time counts as the oldest. A table with no time column is\nsorted by its id. The managed-user feed sorts by time, then by composition id, table and id.\n", "schema": { "type": "string", "enum": [ "asc", "desc" ], "default": "desc" } }, "CompositionEntrySince": { "in": "query", "name": "since", "description": "Only entries made at this time or later: `since` is INCLUSIVE (an entry made at exactly `since` is\nreturned). A date and time with an offset, such as `2026-10-01T00:00:00Z`; anything else answers 400\n`INVALID_SINCE`. An entry with no time never matches, and a table with no time column answers 400\n`ENTRY_TABLE_HAS_NO_TIME`.\n", "schema": { "type": "string", "format": "date-time" } }, "CompositionEntryUntil": { "in": "query", "name": "until", "description": "Only entries made before this time: `until` is EXCLUSIVE (an entry made at exactly `until` is NOT\nreturned), so `since=A&until=B` followed by `since=B&until=C` counts every entry once. Same form and same\nrefusals as `since` (400 `INVALID_UNTIL`).\n", "schema": { "type": "string", "format": "date-time" } }, "CompositionEntryCursor": { "in": "query", "name": "cursor", "schema": { "type": "string" } }, "CompositionEntryContextFilters": { "in": "query", "name": "context", "description": "Host context filters as `context[key]=value` (max 5 keys, counting dotted `context.key` too). Use `column.=value` for columns whose names collide with reserved parameters.", "style": "deepObject", "explode": true, "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "CompositionEntryColumnFilters": { "in": "query", "name": "filter", "description": "Column filters as `filter[columnName]=value` (same meaning as bare `columnName=value` or `column.columnName=value`; max 10 column filters counting all spellings). A plain `filter=value` still filters a column named `filter`.", "style": "deepObject", "explode": true, "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "IdempotencyKeyRequired": { "in": "header", "name": "Idempotency-Key", "required": true, "description": "Required: a call without it is refused with `400`. A key of your own that names this one request; a UUID is ideal. It is 8 to 50 characters of letters, digits, `-` and `_`. Send the same key again when you retry (after a timeout, a dropped connection or a `5xx`) and the call is carried out once: the retry gets the first answer back, marked `X-Idempotency-Cached: true`. The same key with a different body is refused with `422`, and a retry that arrives while the first call is still running with `409` (see `Retry-After`).", "schema": { "type": "string", "minLength": 8, "maxLength": 50, "pattern": "^[a-zA-Z0-9_-]{8,50}$", "example": "9b2d6f0a-3c41-4e5a-8d77-1f2e3a4b5c6d" } }, "IdempotencyKeyOptional": { "in": "header", "name": "Idempotency-Key", "required": false, "description": "Optional: without it the call is carried out every time it is sent. A key of your own that names this one request; a UUID is ideal. It is 8 to 50 characters of letters, digits, `-` and `_`. Send the same key again when you retry (after a timeout, a dropped connection or a `5xx`) and the call is carried out once: the retry gets the first answer back, marked `X-Idempotency-Cached: true`. The same key with a different body is refused with `422`, and a retry that arrives while the first call is still running with `409` (see `Retry-After`).", "schema": { "type": "string", "minLength": 8, "maxLength": 50, "pattern": "^[a-zA-Z0-9_-]{8,50}$", "example": "9b2d6f0a-3c41-4e5a-8d77-1f2e3a4b5c6d" } }, "ManagedUserScopeId": { "in": "header", "name": "X-Managed-User-Id", "required": false, "description": "The id Widgetic gave the managed user (`POST /managed-users`). Makes this call for one of your managed users, so that a mistake in your own code cannot reach another customer's work. Send this header, or the other one, never both. Left out, the call works on your whole account, as it always has. With it, the call reaches only that user's compositions, workflows, A/B tests and translations: a list shows only theirs, one the call makes is filed under them, and one of another user, or one that does not exist, answers `404` (the same answer, so the call cannot be used to find out what another customer has). A managed user that is not yours answers `404` with `MANAGED_USER_NOT_FOUND`. An empty, repeated or malformed header is `400` with `MANAGED_USER_SCOPE_INVALID`; an empty header is never read as no header. A call that is about the whole account, such as the list of your managed users, is refused with `403` and `MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`: send it without the header. Only a partner's API key can send it, because only a partner has managed users: a call that is not made with an API key is refused with `403` and `MANAGED_USER_SCOPE_NOT_ALLOWED`, and an API key that is not a partner's finds no managed user (`404` with `MANAGED_USER_NOT_FOUND`). The header is a limit the call asks for: whoever holds the key can leave it out, so for a credential that a customer's browser holds, use an editor session. An `Idempotency-Key` is kept apart for each managed user.", "schema": { "type": "string", "format": "uuid", "example": "3f2b8c1e-7a4d-4e0b-9c55-2d1a6b7e8f90" } }, "ManagedUserScopeExternalId": { "in": "header", "name": "X-Managed-User-External-Id", "required": false, "description": "Your own id for the managed user (its `externalId`), when you do not keep Widgetic's. Makes this call for one of your managed users, so that a mistake in your own code cannot reach another customer's work. Send this header, or the other one, never both. Left out, the call works on your whole account, as it always has. With it, the call reaches only that user's compositions, workflows, A/B tests and translations: a list shows only theirs, one the call makes is filed under them, and one of another user, or one that does not exist, answers `404` (the same answer, so the call cannot be used to find out what another customer has). A managed user that is not yours answers `404` with `MANAGED_USER_NOT_FOUND`. An empty, repeated or malformed header is `400` with `MANAGED_USER_SCOPE_INVALID`; an empty header is never read as no header. A call that is about the whole account, such as the list of your managed users, is refused with `403` and `MANAGED_USER_SCOPE_ROUTE_NOT_AVAILABLE`: send it without the header. Only a partner's API key can send it, because only a partner has managed users: a call that is not made with an API key is refused with `403` and `MANAGED_USER_SCOPE_NOT_ALLOWED`, and an API key that is not a partner's finds no managed user (`404` with `MANAGED_USER_NOT_FOUND`). The header is a limit the call asks for: whoever holds the key can leave it out, so for a credential that a customer's browser holds, use an editor session. An `Idempotency-Key` is kept apart for each managed user.", "schema": { "type": "string", "minLength": 1, "maxLength": 255, "example": "customer-1042" } } }, "securitySchemes": { "apiKeyAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" }, "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" }, "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" }, "ApiKeyAuth": { "type": "apiKey", "in": "header", "name": "Authorization" }, "webhookSignature": { "type": "apiKey", "in": "header", "name": "X-Webhook-Signature" } } }, "tags": [] }