{"openapi":"3.1.0","info":{"title":"TinyX API","version":"v1 (2.21.8)","description":"TinyX REST API v1 — link intelligence + secure file delivery, headless. Authenticate with `Authorization: Bearer txng_live_<token>`. Mint tokens at /app/account → API Keys.","contact":{"name":"TinyX support","email":"hello@support.tinyx.co"}},"servers":[{"url":"/api/v1","description":"This server"}],"security":[{"bearerAuth":[]},{"cookieAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"txng_live_<32 url-safe chars>","description":"Pass an API key as `Authorization: Bearer txng_live_<…>`. Mint keys via `POST /api/v1/account/keys` while signed in to the dashboard (cookie auth)."},"cookieAuth":{"type":"apiKey","in":"cookie","name":"session_token","description":"Same-origin dashboard session. Sign in at `/app/auth/login`; the browser will attach the `session_token` cookie automatically on subsequent /api/v1/* calls. This is the auth Stoplight's Try It panel uses on cookie-only endpoints (e.g. POST /account/keys)."}},"schemas":{"Account":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"username":{"type":"string"},"email":{"type":["string","null"]},"tier":{"type":"string","enum":["free","pro","max"]},"usage":{"type":"object","properties":{"linksCreatedThisMonth":{"type":"integer","description":"Links created this UTC calendar month that count toward `limits.linksPerMonth`. Questionnaires are not counted: they have their own per-account limit."},"storageBytes":{"type":"integer"}},"required":["linksCreatedThisMonth","storageBytes"]},"limits":{"type":"object","properties":{"linksPerMonth":{"type":"integer"},"storageBytes":{"type":"integer"},"maxUploadBytes":{"type":"integer"},"apiKeys":{"type":"integer"}},"required":["linksPerMonth","storageBytes","maxUploadBytes","apiKeys"]}},"required":["id","username","email","tier","usage","limits"]},"ProblemDetails":{"type":"object","properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"number"}]}},"message":{"type":"string"}},"required":["path","message"]}},"requiredScope":{"type":"string","description":"Present on `scope_required` errors. The wire-format scope name (e.g. `links:write`) the request was missing."},"retryAfter":{"type":"integer","description":"Present on `rate_limited` errors. Seconds the client should wait before retrying. Mirrors the `Retry-After` HTTP header."}},"required":["type","title","status"]},"ApiKeySummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"prefix":{"type":"string","description":"Public-safe handle, e.g. `txng_live_aB3xY7zQ`."},"name":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"lastUsedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":["string","null"],"format":"date-time"}},"required":["id","prefix","name","scopes","lastUsedAt","createdAt","expiresAt"]},"Scope":{"type":"string","enum":["links:read","links:write","files:read","files:write","webhooks:read","webhooks:write","blog:read","blog:write","blog:publish","sales:read","sales:write"]},"ApiKeyCreated":{"allOf":[{"$ref":"#/components/schemas/ApiKeySummary"},{"type":"object","properties":{"token":{"type":"string","description":"Full token. Shown ONCE. Store securely; cannot be retrieved later."}},"required":["token"]}]},"ApiKeyCreateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"},"minItems":1},"expiresAt":{"type":"string","format":"date-time"}},"required":["name","scopes"]},"LinkList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Link"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"Link":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"code":{"type":"string"},"target":{"type":["string","null"]},"fileId":{"type":["string","null"],"format":"uuid"},"isEncrypted":{"type":"boolean"},"encryptionSalt":{"type":["string","null"]},"isUploadLink":{"type":"boolean"},"isQuestionnaire":{"type":"boolean"},"displayMode":{"type":"string"},"password":{"type":"boolean","description":"True if a password is set; the password itself is never returned."},"expiresAt":{"type":["string","null"],"format":"date-time"},"maxDownloads":{"type":["integer","null"]},"maxUploads":{"type":["integer","null"]},"maxResponses":{"type":["integer","null"]},"requireEncryption":{"type":"boolean"},"questionnaireMarkdown":{"type":["string","null"]},"encryptResponses":{"type":"boolean","description":"True if responses to this questionnaire are encrypted in the respondent's browser. Their answers are then unreadable to this API: see the responses endpoint."},"responseRetentionDays":{"type":["integer","null"],"description":"Responses older than this many days are deleted nightly. Null means they are kept indefinitely."},"webhookEnabled":{"type":"boolean"},"accessCount":{"type":"integer"},"downloadCount":{"type":"integer"},"uploadCount":{"type":"integer"},"responseCount":{"type":"integer"},"notes":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","code","target","fileId","isEncrypted","encryptionSalt","isUploadLink","isQuestionnaire","displayMode","password","expiresAt","maxDownloads","maxUploads","maxResponses","requireEncryption","questionnaireMarkdown","encryptResponses","responseRetentionDays","webhookEnabled","accessCount","downloadCount","uploadCount","responseCount","notes","createdAt","updatedAt"]},"Pagination":{"type":"object","properties":{"cursor":{"type":["string","null"]},"hasMore":{"type":"boolean"},"limit":{"type":"integer","exclusiveMinimum":0}},"required":["cursor","hasMore","limit"]},"LinkCreateRequest":{"type":"object","properties":{"target":{"type":"string","format":"uri"},"fileId":{"type":"string","format":"uuid"},"code":{"type":"string","pattern":"^[A-Za-z0-9_-]{3,64}$"},"password":{"type":"string","minLength":1},"accessVerifier":{"type":"string","pattern":"^[0-9a-f]{64}$"},"verifierSalt":{"type":"string","pattern":"^[0-9a-f]{64}$"},"expiresAt":{"type":["string","null"],"format":"date-time"},"maxDownloads":{"type":["integer","null"],"exclusiveMinimum":0},"maxUploads":{"type":["integer","null"],"exclusiveMinimum":0},"maxResponses":{"type":"integer","exclusiveMinimum":0},"notes":{"type":["string","null"],"maxLength":1000},"message":{"type":["string","null"],"maxLength":2000},"isUploadLink":{"type":"boolean"},"requireEncryption":{"type":"boolean"},"isQuestionnaire":{"type":"boolean"},"questionnaireMarkdown":{"type":"string","maxLength":102400,"description":"The questionnaire definition in TinyX questionnaire markdown: at most 102,400 characters and 100 questions. A definition the parser cannot read is refused with 400."},"encryptResponses":{"type":"boolean"},"responseRetentionDays":{"type":["integer","null"],"exclusiveMinimum":0,"maximum":3650},"webhookEnabled":{"type":"boolean"}}},"LinkUpdateRequest":{"type":"object","properties":{"target":{"type":"string","format":"uri"},"fileId":{"type":"string","format":"uuid"},"code":{"type":"string","pattern":"^[A-Za-z0-9_-]{3,64}$"},"password":{"type":"string","minLength":1},"accessVerifier":{"type":"string","pattern":"^[0-9a-f]{64}$"},"verifierSalt":{"type":"string","pattern":"^[0-9a-f]{64}$"},"expiresAt":{"type":["string","null"],"format":"date-time"},"maxDownloads":{"type":["integer","null"],"exclusiveMinimum":0},"maxUploads":{"type":["integer","null"],"exclusiveMinimum":0},"maxResponses":{"type":"integer","exclusiveMinimum":0},"notes":{"type":["string","null"],"maxLength":1000},"message":{"type":["string","null"],"maxLength":2000},"isUploadLink":{"type":"boolean"},"requireEncryption":{"type":"boolean"},"isQuestionnaire":{"type":"boolean"},"questionnaireMarkdown":{"type":"string","maxLength":102400,"description":"The questionnaire definition in TinyX questionnaire markdown: at most 102,400 characters and 100 questions. A definition the parser cannot read is refused with 400."},"encryptResponses":{"type":"boolean"},"responseRetentionDays":{"type":["integer","null"],"exclusiveMinimum":0,"maximum":3650},"webhookEnabled":{"type":"boolean"}}},"AccessLogList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"AccessLog":{"type":"object","properties":{"id":{"type":"integer"},"linkId":{"type":"string","format":"uuid"},"action":{"type":"string"},"success":{"type":"boolean"},"ipAddress":{"type":["string","null"]},"country":{"type":["string","null"]},"city":{"type":["string","null"]},"referrer":{"type":["string","null"]},"userAgent":{"type":["string","null"]},"deviceType":{"type":["string","null"]},"browserName":{"type":["string","null"]},"osName":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","linkId","action","success","ipAddress","country","city","referrer","userAgent","deviceType","browserName","osName","createdAt"]},"QuestionnaireResponseList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/QuestionnaireResponse"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"QuestionnaireResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"linkId":{"type":"string","format":"uuid"},"responseData":{"type":["object","null"],"additionalProperties":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"encrypted":{"type":"boolean"},"envelope":{"type":["object","null"],"properties":{"iv":{"type":"string"},"ct":{"type":"string"}},"required":["iv","ct"]},"ipAddress":{"type":["string","null"]},"country":{"type":["string","null"]},"city":{"type":["string","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","linkId","responseData","encrypted","ipAddress","country","city","createdAt"]},"FileList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/File"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"File":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"fileName":{"type":"string"},"contentType":{"type":["string","null"]},"sizeBytes":{"type":"integer"},"isEncrypted":{"type":"boolean"},"isComplete":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","fileName","contentType","sizeBytes","isEncrypted","isComplete","createdAt"]},"FileUploadStartResponse":{"type":"object","properties":{"fileId":{"type":"string","format":"uuid"},"completeToken":{"type":"string"},"mode":{"type":"string","enum":["single","multipart"]},"presignedUrl":{"type":"string","format":"uri"},"partUrls":{"type":"array","items":{"type":"object","properties":{"partNumber":{"type":"integer","exclusiveMinimum":0},"url":{"type":"string","format":"uri"}},"required":["partNumber","url"]}},"chunkSize":{"type":"integer"},"expiresAt":{"type":"string","format":"date-time"}},"required":["fileId","completeToken","mode","expiresAt"]},"FileUploadStartRequest":{"type":"object","properties":{"fileName":{"type":"string","minLength":1,"maxLength":500},"sizeBytes":{"type":"integer","exclusiveMinimum":0},"contentType":{"type":"string"},"isEncrypted":{"type":"boolean"}},"required":["fileName","sizeBytes"]},"FileUploadCompleteRequest":{"type":"object","properties":{"fileId":{"type":"string","format":"uuid"},"completeToken":{"type":"string"},"parts":{"type":"array","items":{"type":"object","properties":{"partNumber":{"type":"integer","exclusiveMinimum":0},"etag":{"type":"string"}},"required":["partNumber","etag"]}}},"required":["fileId","completeToken"]},"FileDownloadResponse":{"type":"object","properties":{"url":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"},"fileName":{"type":"string"},"contentType":{"type":["string","null"]},"sizeBytes":{"type":"integer"}},"required":["url","expiresAt","fileName","contentType","sizeBytes"]},"WebhookList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"Webhook":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string","format":"uri"},"platform":{"type":["string","null"]},"isActive":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","url","platform","isActive","createdAt"]},"WebhookCreateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"url":{"type":"string","format":"uri"},"isActive":{"type":"boolean"}},"required":["name","url"]},"WebhookUpdateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"url":{"type":"string","format":"uri"},"isActive":{"type":"boolean"}}},"BlogPostList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BlogPost"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"BlogPost":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"title":{"type":"string"},"excerpt":{"type":["string","null"]},"bodyMd":{"type":"string"},"coverImageUrl":{"type":["string","null"]},"author":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["draft","published"]},"visibility":{"type":"string","enum":["draft","scheduled","live"]},"publishedAt":{"type":["string","null"],"format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","slug","title","excerpt","bodyMd","coverImageUrl","author","tags","status","visibility","publishedAt","createdAt","updatedAt"]},"BlogPostCreateRequest":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"bodyMd":{"type":"string","minLength":1,"maxLength":1000000},"slug":{"type":"string","maxLength":80},"excerpt":{"type":["string","null"],"maxLength":500},"coverImageUrl":{"type":["string","null"],"description":"Cover image, as the path returned by POST /api/v1/blog/covers (multipart, field `file`, PNG/JPEG/WebP/GIF/AVIF, max 5 MB, same bearer token). Upload the image there first, then pass the `url` from its response here verbatim. An external or data: URL is rejected — this value is emitted into og:image and the RSS feed."},"author":{"type":"string","maxLength":80},"tags":{"type":"array","items":{"type":"string","maxLength":40},"maxItems":20},"status":{"type":"string","enum":["draft","published"]},"publishedAt":{"type":["string","null"],"format":"date-time"}},"required":["title","bodyMd"]},"BlogPostUpdateRequest":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"bodyMd":{"type":"string","minLength":1,"maxLength":1000000},"slug":{"type":"string","maxLength":80},"excerpt":{"type":["string","null"],"maxLength":500},"coverImageUrl":{"type":["string","null"],"description":"Cover image, as the path returned by POST /api/v1/blog/covers (multipart, field `file`, PNG/JPEG/WebP/GIF/AVIF, max 5 MB, same bearer token). Upload the image there first, then pass the `url` from its response here verbatim. An external or data: URL is rejected — this value is emitted into og:image and the RSS feed."},"author":{"type":"string","maxLength":80},"tags":{"type":"array","items":{"type":"string","maxLength":40},"maxItems":20},"status":{"type":"string","enum":["draft","published"]},"publishedAt":{"type":["string","null"],"format":"date-time"}}},"BlogStatusRequest":{"type":"object","properties":{"status":{"type":"string","enum":["draft","published"]}},"required":["status"]},"BlogTagList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/BlogTag"}}},"required":["data"]},"BlogTag":{"type":"object","properties":{"tag":{"type":"string"},"count":{"type":"integer"}},"required":["tag","count"]},"CoverUploaded":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]},"SalesQuoteList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesQuote"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"SalesQuote":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"$ref":"#/components/schemas/QuoteStatus"},"clientName":{"type":"string"},"clientEmail":{"type":["string","null"]},"clientCompany":{"type":["string","null"]},"domain":{"type":"string"},"users":{"type":"integer"},"storageGb":{"type":"number"},"transfersK":{"type":"number"},"contract":{"$ref":"#/components/schemas/QuoteContract"},"support":{"$ref":"#/components/schemas/QuoteSupport"},"encryption":{"type":"boolean","deprecated":true,"description":"Historic. In-browser encryption is included as standard on White Label and is no longer a priced add-on. Always false for a quote whose pricing was saved since; true only on an older quote, whose stored prices may include encryptionFee. A PATCH that changes only clientName, clientEmail, clientCompany, domain or notes keeps the stored prices; any other PATCH reprices the quote without the fee."},"encryptionFee":{"type":"number","deprecated":true,"description":"Historic. The monthly encryption add-on fee an older quote was saved with. Always 0 for a quote saved since encryption became standard."},"addonApi":{"type":"boolean"},"addonApiFee":{"type":"number"},"addonCli":{"type":"boolean"},"addonCliSetup":{"type":"number"},"addonCliMonthly":{"type":"number"},"bespokeHours":{"type":"number"},"setupFee":{"type":"number"},"minFloor":{"type":"number"},"perUserFee":{"type":"number"},"marginPct":{"type":"integer"},"pmHours":{"type":"number"},"hourlyRate":{"type":"number"},"discountPct":{"type":"number"},"discountAmount":{"type":"number"},"monthlyPrice":{"type":"number"},"annualPrice":{"type":"number"},"setupTotal":{"type":"number"},"internalCost":{"type":"number"},"grossMargin":{"type":"number"},"notes":{"type":["string","null"]},"convertedToClientId":{"type":["string","null"],"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","status","clientName","clientEmail","clientCompany","domain","users","storageGb","transfersK","contract","support","encryption","encryptionFee","addonApi","addonApiFee","addonCli","addonCliSetup","addonCliMonthly","bespokeHours","setupFee","minFloor","perUserFee","marginPct","pmHours","hourlyRate","discountPct","discountAmount","monthlyPrice","annualPrice","setupTotal","internalCost","grossMargin","notes","convertedToClientId","createdAt","updatedAt"]},"QuoteStatus":{"type":"string","enum":["quote","opportunity","won","lost"]},"QuoteContract":{"type":"string","enum":["monthly","annual","2year"]},"QuoteSupport":{"type":"string","enum":["basic","priority","dedicated"]},"SalesQuoteCreateRequest":{"type":"object","properties":{"clientName":{"type":"string","minLength":1,"maxLength":120},"clientEmail":{"type":["string","null"],"maxLength":120,"format":"email"},"clientCompany":{"type":["string","null"],"maxLength":120},"domain":{"type":"string","pattern":"^[a-z0-9.-]{1,253}$"},"users":{"type":"integer","minimum":1,"maximum":500},"storageGb":{"type":"number","minimum":0,"maximum":1000000},"transfersK":{"type":"number","minimum":0,"maximum":1000000},"contract":{"$ref":"#/components/schemas/QuoteContract"},"support":{"$ref":"#/components/schemas/QuoteSupport"},"addonApi":{"type":"boolean"},"addonApiFee":{"type":"number","minimum":0,"maximum":1000000},"addonCli":{"type":"boolean"},"addonCliSetup":{"type":"number","minimum":0,"maximum":1000000},"addonCliMonthly":{"type":"number","minimum":0,"maximum":1000000},"bespokeHours":{"type":"number","minimum":0,"maximum":1000000},"setupFee":{"type":"number","minimum":0,"maximum":1000000},"minFloor":{"type":"number","minimum":0,"maximum":1000000},"perUserFee":{"type":"number","minimum":0,"maximum":1000000},"marginPct":{"type":"integer","minimum":0,"maximum":80},"pmHours":{"type":"number","minimum":0,"maximum":1000000},"hourlyRate":{"type":"number","minimum":0,"maximum":1000000},"discountPct":{"type":"integer","minimum":0,"maximum":100},"discountAmount":{"type":"number","minimum":0,"maximum":1000000},"notes":{"type":["string","null"],"maxLength":1000}},"required":["clientName","users","storageGb","transfersK"]},"SalesQuoteUpdateRequest":{"type":"object","properties":{"clientName":{"type":"string","minLength":1,"maxLength":120},"clientEmail":{"type":["string","null"],"maxLength":120,"format":"email"},"clientCompany":{"type":["string","null"],"maxLength":120},"domain":{"type":"string","pattern":"^[a-z0-9.-]{1,253}$"},"users":{"type":"integer","minimum":1,"maximum":500},"storageGb":{"type":"number","minimum":0,"maximum":1000000},"transfersK":{"type":"number","minimum":0,"maximum":1000000},"contract":{"$ref":"#/components/schemas/QuoteContract"},"support":{"$ref":"#/components/schemas/QuoteSupport"},"addonApi":{"type":"boolean"},"addonApiFee":{"type":"number","minimum":0,"maximum":1000000},"addonCli":{"type":"boolean"},"addonCliSetup":{"type":"number","minimum":0,"maximum":1000000},"addonCliMonthly":{"type":"number","minimum":0,"maximum":1000000},"bespokeHours":{"type":"number","minimum":0,"maximum":1000000},"setupFee":{"type":"number","minimum":0,"maximum":1000000},"minFloor":{"type":"number","minimum":0,"maximum":1000000},"perUserFee":{"type":"number","minimum":0,"maximum":1000000},"marginPct":{"type":"integer","minimum":0,"maximum":80},"pmHours":{"type":"number","minimum":0,"maximum":1000000},"hourlyRate":{"type":"number","minimum":0,"maximum":1000000},"discountPct":{"type":"integer","minimum":0,"maximum":100},"discountAmount":{"type":"number","minimum":0,"maximum":1000000},"notes":{"type":["string","null"],"maxLength":1000}}},"SalesQuoteMoveRequest":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/QuoteStatus"}},"required":["status"]},"SalesClient":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"domain":{"type":"string"},"monthlyFeeUsd":{"type":"number"},"statsEndpoint":{"type":"string"},"notes":{"type":["string","null"]},"contactName":{"type":["string","null"]},"contactEmail":{"type":["string","null"]},"contactPhone":{"type":["string","null"]},"quotaUsers":{"type":["integer","null"]},"quotaStorageGb":{"type":["number","null"]},"quotaTransfersK":{"type":["number","null"]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","domain","monthlyFeeUsd","statsEndpoint","notes","contactName","contactEmail","contactPhone","quotaUsers","quotaStorageGb","quotaTransfersK","createdAt"]},"SalesConvertRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"domain":{"type":"string","pattern":"^[a-z0-9.-]{1,253}$"},"monthlyFeeUsd":{"type":"number","minimum":0,"maximum":1000000},"statsEndpoint":{"type":"string","format":"uri"},"statsSecret":{"type":"string","minLength":16},"notes":{"type":["string","null"],"maxLength":500},"contactName":{"type":["string","null"],"maxLength":120},"contactEmail":{"type":["string","null"],"maxLength":120,"format":"email"},"contactPhone":{"type":["string","null"],"maxLength":40},"quotaUsers":{"type":["integer","null"],"minimum":0,"maximum":1000000},"quotaStorageGb":{"type":["number","null"],"minimum":0,"maximum":1000000},"quotaTransfersK":{"type":["number","null"],"minimum":0,"maximum":1000000}},"required":["statsSecret"]},"SalesPricing":{"type":"object","properties":{"monthlyPrice":{"type":"number"},"annualPrice":{"type":"number"},"setupTotal":{"type":"number"},"internalCost":{"type":"number"},"grossMargin":{"type":"number"}},"required":["monthlyPrice","annualPrice","setupTotal","internalCost","grossMargin"]},"SalesPricingRequest":{"type":"object","properties":{"users":{"type":"integer","minimum":1,"maximum":500},"storageGb":{"type":"number","minimum":0,"maximum":1000000},"transfersK":{"type":"number","minimum":0,"maximum":1000000},"contract":{"$ref":"#/components/schemas/QuoteContract"},"support":{"$ref":"#/components/schemas/QuoteSupport"},"addonApi":{"type":"boolean"},"addonApiFee":{"type":"number","minimum":0,"maximum":1000000},"addonCli":{"type":"boolean"},"addonCliSetup":{"type":"number","minimum":0,"maximum":1000000},"addonCliMonthly":{"type":"number","minimum":0,"maximum":1000000},"bespokeHours":{"type":"number","minimum":0,"maximum":1000000},"setupFee":{"type":"number","minimum":0,"maximum":1000000},"minFloor":{"type":"number","minimum":0,"maximum":1000000},"perUserFee":{"type":"number","minimum":0,"maximum":1000000},"marginPct":{"type":"integer","minimum":0,"maximum":80},"pmHours":{"type":"number","minimum":0,"maximum":1000000},"hourlyRate":{"type":"number","minimum":0,"maximum":1000000},"discountPct":{"type":"integer","minimum":0,"maximum":100},"discountAmount":{"type":"number","minimum":0,"maximum":1000000}},"required":["users","storageGb","transfersK"]},"SalesClientList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SalesClient"}},"pagination":{"$ref":"#/components/schemas/Pagination"}},"required":["data","pagination"]},"SalesClientCreateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"domain":{"type":"string","pattern":"^[a-z0-9.-]{1,253}$"},"monthlyFeeUsd":{"type":"number","minimum":0,"maximum":1000000},"statsEndpoint":{"type":"string","format":"uri"},"statsSecret":{"type":"string","minLength":16},"notes":{"type":["string","null"],"maxLength":500},"contactName":{"type":["string","null"],"maxLength":120},"contactEmail":{"type":["string","null"],"maxLength":120,"format":"email"},"contactPhone":{"type":["string","null"],"maxLength":40},"quotaUsers":{"type":["integer","null"],"minimum":0,"maximum":1000000},"quotaStorageGb":{"type":["number","null"],"minimum":0,"maximum":1000000},"quotaTransfersK":{"type":["number","null"],"minimum":0,"maximum":1000000}},"required":["name","domain","monthlyFeeUsd","statsSecret"]},"SalesClientUpdateRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"monthlyFeeUsd":{"type":"number","minimum":0,"maximum":1000000},"notes":{"type":["string","null"],"maxLength":500},"contactName":{"type":["string","null"],"maxLength":120},"contactEmail":{"type":["string","null"],"maxLength":120,"format":"email"},"contactPhone":{"type":["string","null"],"maxLength":40},"quotaUsers":{"type":["integer","null"],"minimum":0,"maximum":1000000},"quotaStorageGb":{"type":["number","null"],"minimum":0,"maximum":1000000},"quotaTransfersK":{"type":["number","null"],"minimum":0,"maximum":1000000}}}},"parameters":{}},"paths":{"/account":{"get":{"operationId":"getAccount","tags":["Account"],"summary":"Get the current user's profile, tier, and usage.","responses":{"200":{"description":"Account details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"401":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/account/keys":{"get":{"operationId":"listAccountKeys","tags":["Account"],"summary":"List your API keys (cookie auth only).","description":"Returns the prefix and metadata for each of the calling user's active keys. The full token is only returned at creation time.","security":[{"cookieAuth":[]},{}],"responses":{"200":{"description":"List of keys","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeySummary"}}},"required":["data"]}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"post":{"operationId":"createAccountKey","tags":["Account"],"summary":"Mint a new API key (cookie auth only).","description":"The full token is returned ONCE in the `token` field. Store it securely. The server retains only a hash and the prefix; lost tokens cannot be recovered. This endpoint requires the dashboard cookie (`session_token`); Bearer tokens cannot mint other keys, by design.","security":[{"cookieAuth":[]},{}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreateRequest"}}}},"responses":{"201":{"description":"Key minted; full token in `token`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/account/keys/{id}":{"delete":{"operationId":"revokeAccountKey","tags":["Account"],"summary":"Revoke an API key (cookie auth only).","security":[{"cookieAuth":[]},{}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Revoked."},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/links":{"get":{"operationId":"listLinks","tags":["Links"],"summary":"List the calling user's links.","description":"Cursor-paginated. Pass the `pagination.cursor` from the previous response as `?cursor=…` to get the next page. Default limit 25, max 100.","parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paginated list of links","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkList"}}}},"401":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"post":{"operationId":"createLink","tags":["Links"],"summary":"Create a new link.","description":"Exactly one of these four link-type discriminators must be set:\n  • `target` — redirect to a URL\n  • `fileId` — file download link wrapping an existing uploaded file\n  • `isUploadLink: true` — public upload landing page (optionally `maxUploads`)\n  • `isQuestionnaire: true` + `questionnaireMarkdown` — markdown form (optionally `maxResponses`)\n\nCommon to all: optional `code`, `expiresAt`, `notes`, `message`, `webhookEnabled`.\n\n**Limits.** Questionnaires do not count toward, and are not blocked by, the monthly link limit (`limits.linksPerMonth`); they have their own per-account limit instead. Either limit answers 409. A questionnaire may have up to 100 questions and a definition of up to 102,400 characters; a definition the parser cannot read answers 400 with the reason. On Free, each questionnaire can receive up to 1,000 responses per UTC calendar month.\n\n**Passwords: `password` is no longer accepted and returns 400.** A link password is never transmitted to TinyX. Derive an access verifier client-side and send `accessVerifier` + `verifierSalt` together:\n```\nikm      = PBKDF2-SHA256(password, verifierSalt, 100000)      // 32 bytes\nverifier = HKDF-SHA256(ikm, salt=\"\", info=\"tinyx-e2e-auth-v1\") // 32 bytes, hex\n```\n`verifierSalt` is 32 random bytes, hex. Keep the password: the recipient needs it, and we cannot recover it.\n\n`requireEncryption` is also refused here — the uploader access code has to be derived in a browser. End-to-end encrypted links are likewise dashboard-only (`/app/links/create-encrypted`), as are galleries and folder links (they use the `link_files` junction).","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkCreateRequest"}}}},"responses":{"201":{"description":"Link created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/links/{idOrCode}":{"get":{"operationId":"getLink","tags":["Links"],"summary":"Get a single link by id or code.","parameters":[{"schema":{"type":"string"},"required":true,"name":"idOrCode","in":"path"}],"responses":{"200":{"description":"Link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"patch":{"operationId":"updateLink","tags":["Links"],"summary":"Update a link in place.","description":"Send only the fields you want to change.\n\n`isQuestionnaire`, `questionnaireMarkdown` and `maxResponses` cannot be changed through this endpoint and are ignored if sent; create a new questionnaire to change its questions.\n\n**`password` is no longer accepted and returns 400.** To set or change a link password, derive an access verifier client-side and send `accessVerifier` + `verifierSalt` together — see `createLink` for the derivation. A link password is never transmitted to TinyX.\n\nEnd-to-end encrypted links reject the change either way: the password derives the AES key, so rotating it would orphan existing ciphertext. Re-upload the file and create a new link.","parameters":[{"schema":{"type":"string"},"required":true,"name":"idOrCode","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkUpdateRequest"}}}},"responses":{"200":{"description":"Updated link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Link"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"delete":{"operationId":"deleteLink","tags":["Links"],"summary":"Delete a link.","description":"Drops the link row and its access-logs and fingerprint rows. Does not delete any underlying file (use `DELETE /files/{id}` for that).","parameters":[{"schema":{"type":"string"},"required":true,"name":"idOrCode","in":"path"}],"responses":{"204":{"description":"Deleted."},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/links/{idOrCode}/access-logs":{"get":{"operationId":"listLinkAccessLogs","tags":["Links"],"summary":"Paginated access log for a link.","parameters":[{"schema":{"type":"string"},"required":true,"name":"idOrCode","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Access logs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessLogList"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/links/{idOrCode}/responses":{"get":{"operationId":"listLinkResponses","tags":["Links"],"summary":"Questionnaire responses for a link (JSON or CSV).","description":"Returns submitted answers for a `isQuestionnaire: true` link. Default content type is `application/json`; pass `Accept: text/csv` to receive a spreadsheet-friendly export keyed by the field labels parsed from the questionnaire markdown. Non-questionnaire links return an empty list.\n\nIf the link has `encryptResponses: true` the answers were encrypted in each respondent's browser and are NOT readable here: every response carries `encrypted: true`, `responseData` is `null`, and the ciphertext is in `envelope`. There is no API path to decrypt it — the key derives from the link password, which never reaches us. The CSV form is refused with a 400 for such a link, because a CSV of base64 is not an export; the dashboard builds the real one in the browser after decryption.\n\n`ipAddress` and `city` are always `null` for an encrypted questionnaire's responses, and `userAgent` is never returned for any response.","parameters":[{"schema":{"type":"string"},"required":true,"name":"idOrCode","in":"path"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Responses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionnaireResponseList"}},"text/csv":{"schema":{"type":"string"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/files":{"get":{"operationId":"listFiles","tags":["Files"],"summary":"List the calling user's complete files.","description":"Excludes incomplete (presigned-upload-in-progress) files. Use cursor pagination.","parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"File list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileList"}}}}}}},"/files/{id}":{"get":{"operationId":"getFile","tags":["Files"],"summary":"Get file metadata.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"File metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/File"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"delete":{"operationId":"deleteFile","tags":["Files"],"summary":"Delete a file (and the R2 object behind it).","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted."},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/files/upload":{"post":{"operationId":"startFileUpload","tags":["Files"],"summary":"Start a presigned upload.","description":"Returns a presigned upload handshake. Files smaller than 100 MiB come back as `mode: \"single\"` with a single `presignedUrl`; larger files come back as `mode: \"multipart\"` with a `partUrls[]` array (one per 16 MiB chunk) and a `chunkSize`. After PUTing the bytes (collecting ETags for multipart), call POST /files/upload/complete with the completeToken (and `parts: [{partNumber, etag}]` for multipart).","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadStartRequest"}}}},"responses":{"200":{"description":"Presigned upload URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadStartResponse"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"413":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/files/upload/complete":{"post":{"operationId":"completeFileUpload","tags":["Files"],"summary":"Finalize a presigned upload.","description":"Marks the file as complete. Idempotent — re-calling with the same completeToken returns the same fileId. For single-PUT uploads, `parts` is omitted.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileUploadCompleteRequest"}}}},"responses":{"200":{"description":"Completed file","content":{"application/json":{"schema":{"$ref":"#/components/schemas/File"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"413":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/files/upload/abort":{"post":{"operationId":"abortFileUpload","tags":["Files"],"summary":"Abort an in-flight multipart upload.","description":"Calls R2 AbortMultipartUpload to drop any uploaded parts and the file row. Single-PUT uploads are aborted by simply not calling /upload/complete; this endpoint is multipart-only.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"fileId":{"type":"string","format":"uuid"},"completeToken":{"type":"string"}},"required":["fileId","completeToken"]}}}},"responses":{"204":{"description":"Aborted (or already cleaned up)."},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/files/{id}/download":{"get":{"operationId":"getFileDownloadUrl","tags":["Files"],"summary":"Get a presigned download URL for a file.","description":"Returns a 1-hour presigned R2 URL. Stream the bytes directly from `url` — no auth header needed on the R2 request itself.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Presigned download URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileDownloadResponse"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/webhooks":{"get":{"operationId":"listWebhooks","tags":["Webhooks"],"summary":"List the calling user's webhook endpoints.","responses":{"200":{"description":"Webhook list","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookList"}}}}}},"post":{"operationId":"createWebhook","tags":["Webhooks"],"summary":"Register a new webhook endpoint.","description":"TinyX auto-detects Discord, Slack, and Google Chat URLs and formats payloads accordingly; any other URL receives a generic JSON event body.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreateRequest"}}}},"responses":{"201":{"description":"Created webhook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/webhooks/{id}":{"patch":{"operationId":"updateWebhook","tags":["Webhooks"],"summary":"Update a webhook (label and/or URL).","description":"Update the label, URL, or both. Changing the URL re-runs platform detection so the badge stays accurate (Discord/Slack/Google Chat/custom).","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookUpdateRequest"}}}},"responses":{"200":{"description":"Updated webhook","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Webhook"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"delete":{"operationId":"deleteWebhook","tags":["Webhooks"],"summary":"Delete a webhook.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted."},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/webhooks/{id}/test":{"post":{"operationId":"testWebhook","tags":["Webhooks"],"summary":"Fire a test event to a webhook.","description":"Sends a synthetic test payload formatted for the detected platform. Returns 204 on dispatch (regardless of whether the destination accepted it — check your Discord/Slack/etc. for the actual receipt).","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Dispatched."},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"502":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/blog/posts":{"get":{"operationId":"listBlogPosts","tags":["Blog"],"summary":"List blog posts.","description":"Organisation-wide, not user-scoped — every caller with the `blog:read` scope and the `blog` capability sees the same list. Requires the `blog` capability (see docs/AUTH-V2.md). Cursor-paginated. `?status` filters on the stored column (`draft`/`published`); `?visibility` filters on what the public site actually serves (`draft`/`scheduled`/`live`). They differ: a scheduled post is `published` with a future `publishedAt`, so `?status=published` includes posts that are not yet public. Every post in the response also carries a derived `visibility`.","parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","enum":["draft","published"]},"required":false,"name":"status","in":"query"},{"schema":{"type":"string","enum":["draft","scheduled","live"]},"required":false,"name":"visibility","in":"query"}],"responses":{"200":{"description":"Paginated list of posts","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPostList"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"post":{"operationId":"createBlogPost","tags":["Blog"],"summary":"Create a blog post.","description":"Requires `blog:write`. Creating a post that is ALREADY `status: \"published\"` additionally requires `blog:publish` — a drafting key can write content but cannot put it live. Omitting `status` (or passing `draft`) needs only `blog:write`.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPostCreateRequest"}}}},"responses":{"201":{"description":"Post created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPost"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/blog/posts/{id}":{"get":{"operationId":"getBlogPost","tags":["Blog"],"summary":"Get a single blog post by id.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPost"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"patch":{"operationId":"updateBlogPost","tags":["Blog"],"summary":"Update a blog post in place.","description":"Send only the fields you want to change. Requires `blog:write`. Additionally requires `blog:publish` when the post is CURRENTLY published (any edit to live content) or when this call changes `status`.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPostUpdateRequest"}}}},"responses":{"200":{"description":"Updated post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPost"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"delete":{"operationId":"deleteBlogPost","tags":["Blog"],"summary":"Delete a draft, or unpublish a live post.","description":"A published post is never truly deleted through this API — it is unpublished instead, and the response says so (`200` with the now-draft post). Only a `draft` is actually removed (`204`, no body), which also reclaims its uploaded cover. Requires `blog:write`; unpublishing a live post additionally requires `blog:publish`. The dashboard retains real delete for a published post.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Was published — unpublished instead of deleted; body is the now-draft post.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPost"}}}},"204":{"description":"Was a draft — deleted for real."},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/blog/posts/{id}/status":{"post":{"operationId":"setBlogPostStatus","tags":["Blog"],"summary":"Publish or unpublish a post.","description":"The one dedicated path for changing what is live. Always requires `blog:publish`.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogStatusRequest"}}}},"responses":{"200":{"description":"Updated post","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogPost"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/blog/tags":{"get":{"operationId":"listBlogTags","tags":["Blog"],"summary":"List tags in use across published posts, with counts.","responses":{"200":{"description":"Tags","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlogTagList"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/blog/covers":{"post":{"operationId":"uploadBlogCover","tags":["Blog"],"summary":"Upload a cover image for a blog post.","description":"Multipart `file` field (PNG/JPEG/WebP/GIF/AVIF, up to 5 MB). Returns a same-origin `/blog/cover/<uuid>` path — the only URL shape `coverImageUrl` on a create/update request may reference. Requires `blog:write`. Rate-limited per caller.","requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}}}},"responses":{"201":{"description":"Uploaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoverUploaded"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"413":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"429":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/sales/quotes":{"get":{"operationId":"listSalesQuotes","tags":["Sales"],"summary":"List white-label sales quotes.","description":"Organisation-wide, not user-scoped — every caller with the `sales:read` scope and the `sales` capability sees the same pipeline. Requires the `sales` capability (see docs/AUTH-V2.md). Cursor-paginated; `?status` filters to one pipeline stage. There is no delete for a quote — a dead deal is retired by moving it to `lost` (`POST /sales/quotes/{id}/move`), not removed, so the pipeline stays a complete record.","parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"},{"schema":{"$ref":"#/components/schemas/QuoteStatus"},"required":false,"name":"status","in":"query"}],"responses":{"200":{"description":"Paginated list of quotes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuoteList"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"post":{"operationId":"createSalesQuote","tags":["Sales"],"summary":"Create a sales quote.","description":"Requires `sales:write`. A new quote always starts in the `quote` stage — there is no `status` field on this request; use `POST /sales/quotes/{id}/move` to advance it.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuoteCreateRequest"}}}},"responses":{"201":{"description":"Quote created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuote"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/sales/quotes/{id}":{"get":{"operationId":"getSalesQuote","tags":["Sales"],"summary":"Get a single sales quote by id.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuote"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"patch":{"operationId":"updateSalesQuote","tags":["Sales"],"summary":"Update a sales quote in place.","description":"Send only the fields you want to change. Requires `sales:write`. Cannot change pipeline stage — use `POST /sales/quotes/{id}/move` for that.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuoteUpdateRequest"}}}},"responses":{"200":{"description":"Updated quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuote"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/sales/quotes/{id}/move":{"post":{"operationId":"moveSalesQuote","tags":["Sales"],"summary":"Move a quote to a different pipeline stage.","description":"The one dedicated path for changing pipeline stage. Requires `sales:write`. Retiring a dead deal is `{\"status\": \"lost\"}` here, not a delete — there is no delete for a quote.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuoteMoveRequest"}}}},"responses":{"200":{"description":"Updated quote","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesQuote"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/sales/quotes/{id}/convert":{"post":{"operationId":"convertSalesQuote","tags":["Sales"],"summary":"Convert a quote into a paying white-label client.","description":"Creates a `whitelabel_clients` row and links it back onto the quote (which also moves the quote to `won`). `name`/`domain`/`monthlyFeeUsd` may be omitted to inherit the quote's own values. Requires `sales:write`. `statsSecret` is required (it has no quote-side source) and, like every client-create call, is never echoed back.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesConvertRequest"}}}},"responses":{"201":{"description":"Converted — the now-won quote and the new client","content":{"application/json":{"schema":{"type":"object","properties":{"quoteId":{"type":"string","format":"uuid"},"clientId":{"type":"string","format":"uuid"},"quote":{"$ref":"#/components/schemas/SalesQuote"},"client":{"$ref":"#/components/schemas/SalesClient"}},"required":["quoteId","clientId","quote","client"]}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/sales/pricing/preview":{"post":{"operationId":"previewSalesPricing","tags":["Sales"],"summary":"Preview quote pricing without saving anything.","description":"Runs the same pricing math a saved quote uses (`computeQuotePricing`) and returns the numbers — nothing is written. Requires `sales:read`, not `sales:write`, since it has no side effects.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesPricingRequest"}}}},"responses":{"200":{"description":"Pricing preview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesPricing"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/sales/clients":{"get":{"operationId":"listSalesClients","tags":["Sales"],"summary":"List white-label clients.","description":"Organisation-wide, not user-scoped. Requires the `sales` capability. Cursor-paginated. Exposes contact names, emails and phone numbers, so every call fires a `sales.client.read` audit row (quote reads do not).","parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Paginated list of clients","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesClientList"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"post":{"operationId":"createSalesClient","tags":["Sales"],"summary":"Create a white-label client.","description":"Requires `sales:write`. `statsSecret` is write-only — accepted here, never returned by this or any other client response.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesClientCreateRequest"}}}},"responses":{"201":{"description":"Client created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesClient"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"409":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/sales/clients/{id}":{"get":{"operationId":"getSalesClient","tags":["Sales"],"summary":"Get a single white-label client by id.","description":"Fires a `sales.client.read` audit row — see the list endpoint.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Client","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesClient"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"patch":{"operationId":"updateSalesClient","tags":["Sales"],"summary":"Update a white-label client in place.","description":"Send only the fields you want to change. Requires `sales:write`. `domain`, `statsEndpoint` and `statsSecret` cannot be changed through this API — both `domain` and `statsEndpoint` feed the URL the stats fetch sends the stored secret to, and rotating the secret is a dashboard-only action.","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesClientUpdateRequest"}}}},"responses":{"200":{"description":"Updated client","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesClient"}}}},"400":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"403":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Problem Details (RFC 9457)","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"webhooks":{}}