{"openapi":"3.1.0","info":{"title":"DeskValent Public API","version":"1.0.0","description":"Contact forms, PQRS status lookup and health for DeskValent tenants. Admin and ValentConsole APIs are not part of this public reference."},"servers":[{"url":"/","description":"Same origin as this documentation"}],"paths":{"/web-forms/v1":{"get":{"tags":["Forms"],"summary":"Discover the no-dependency contact form integration","description":"Public deployment metadata, also readable through ConsoleApi. Advertised by desk_web_form_v1. Only generate a snippet for a compatible published contact definition and bot provider. The versioned asset and descriptor ship together; source code or a merge is not deployment evidence.","operationId":"getWebFormIntegration","security":[],"responses":{"200":{"description":"Integration version, same-public-origin script and supported form capabilities.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"version":{"type":"string","const":"1.1.0"},"scriptUrl":{"type":"string","format":"uri"},"kinds":{"type":"array","items":{"type":"string","const":"contact"}},"fields":{"type":"object","properties":{"name":{"const":"text"},"email":{"const":"email"},"phone":{"const":"phone"},"subject":{"const":"text"},"message":{"const":"textarea"},"consent":{"const":"checkbox"}},"required":["name","email","phone","subject","message","consent"]},"protectionKinds":{"type":"array","items":{"type":"string","const":"turnstile"}},"unprotected":{"type":"boolean","const":true}},"required":["version","scriptUrl","kinds","fields","protectionKinds","unprotected"]}},"required":["data"]}}}},"404":{"description":"No valid public origin configured.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/healthz":{"get":{"tags":["Health"],"summary":"Worker health check","operationId":"getHealth","security":[],"responses":{"200":{"description":"Worker is responding (not a database readiness probe).","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"ok":{"const":true,"type":"boolean"}},"required":["ok"]}},"required":["data"]}}}}}}},"/v1/public/forms/{slug}":{"get":{"tags":["Forms"],"summary":"Get a published form","description":"Localized field definitions for rendering a contact or PQRS form.","operationId":"getPublicForm","security":[{"publishableKey":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"locale","in":"query","required":false,"schema":{"type":"string","enum":["es","en"]}}],"responses":{"200":{"description":"The published form.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PublicForm"}},"required":["data"]}}}},"401":{"description":"Missing or invalid publishable key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Origin not in the key allow-list.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No published form with that slug.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/forms/{slug}/submissions":{"post":{"tags":["Forms"],"summary":"Submit a form","description":"Accepts JSON or multipart/form-data (files: at most 5 per message, 10 MB each, 25 MB per submission). Contact clients should send Idempotency-Key and reuse it for retries: the same accepted content returns the original 201 response (Idempotent-Replayed: true), without consuming another bot token, rate or quota allowance. Changing form, locale, field values, externalRef or file names/bytes with that key returns 409. Keys are scoped to a tenant and receipts do not expire. Requests without a key and non-Contact forms retain legacy request behavior. On a new request, bot protection is verified first. Send the token as `botProtectionToken` (body) or the `x-bot-protection-token` header; `turnstileToken`, `cf-turnstile-response`, `g-recaptcha-response` and `h-captcha-response` (body) and the `cf-turnstile-response` header are also accepted. Submissions are rate limited per IP and form. An optional top-level `externalRef` (e.g. an order id) is stored on the created conversation, unless the form defines a field with that key.","operationId":"submitPublicForm","security":[{"publishableKey":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"locale","in":"query","required":false,"schema":{"type":"string","enum":["es","en"]}},{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string"},"description":"Stable key for one logical Contact submission; retain it across lost responses and retries."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Field values keyed by field key, plus the bot-protection token.","properties":{"botProtectionToken":{"type":"string"},"turnstileToken":{"type":"string","deprecated":true},"externalRef":{"type":"string","minLength":1,"maxLength":200,"description":"Optional host reference stored on the created conversation (e.g. an order id)"}},"additionalProperties":true}},"multipart/form-data":{"schema":{"type":"object","properties":{"botProtectionToken":{"type":"string"},"turnstileToken":{"type":"string","deprecated":true},"externalRef":{"type":"string","minLength":1,"maxLength":200,"description":"Optional host reference stored on the created conversation (e.g. an order id)"},"files":{"type":"array","items":{"type":"string","format":"binary"}}},"additionalProperties":true}}}},"responses":{"201":{"description":"Submission received. PQRS forms also return the radicado and due date.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"conversationId":{"type":"string"},"radicado":{"type":"string"},"dueDate":{"type":"string","format":"date"}},"required":["conversationId"]}},"required":["data"]}}}},"400":{"description":"Invalid values or files.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Bot-protection verification failed (`bot_protection_failed`; `turnstile_failed` for forms still on the legacy `requireTurnstile` flag) or origin not allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No published form with that slug.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Idempotency-Key reused with different Contact submission content.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Files too large.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many submissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/public/pqrs/lookup":{"post":{"tags":["PQRS"],"summary":"Look up a PQRS by radicado","description":"Requires the e-mail or document number of the requester, in the body so it never appears in URLs; any mismatch answers 404.","operationId":"lookupPublicPqrs","security":[{"publishableKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["radicado"],"properties":{"radicado":{"type":"string","example":"ACME-2025-000001"},"email":{"type":"string","format":"email"},"documentNumber":{"type":"string"}}}}}},"responses":{"200":{"description":"Current status of the case.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PublicPqrsStatus"}},"required":["data"]}}}},"400":{"description":"Neither email nor documentNumber was given.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Unknown radicado or requester mismatch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many lookups.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/files/{id}":{"get":{"tags":["Files"],"summary":"Download an attachment through a signed URL","description":"Signed URLs are issued by the admin API and expire after 15 minutes; links sent with outbound messages (`s=send`) expire after 24 hours.","operationId":"downloadFile","security":[],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"t","in":"query","required":true,"schema":{"type":"string"}},{"name":"exp","in":"query","required":true,"schema":{"type":"integer"}},{"name":"s","in":"query","required":false,"schema":{"type":"string","enum":["send"]}},{"name":"sig","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The file, served as an attachment.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"403":{"description":"Invalid or expired signature.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"File not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/files/uploads/{uploadId}":{"put":{"tags":["Files"],"summary":"Upload a file through a signed URL","description":"Signed upload URLs (module-contract `files`) are issued by the admin API and expire after 15 minutes. Send the raw bytes with the returned headers; no credentials, CORS allowed from any origin. Each URL stores one file.","operationId":"uploadFile","security":[],"parameters":[{"name":"uploadId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"token","in":"query","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"responses":{"201":{"description":"Stored; the upload id can now be attached to a message."},"400":{"description":"Empty file.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Invalid or expired signature.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The upload was already completed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"The file exceeds the declared or maximum size.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"File type not allowed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"publishableKey":{"type":"http","scheme":"bearer","description":"Publishable key (`pk_…`), restricted to the origins in its allow-list."}},"schemas":{"PublicForm":{"type":"object","properties":{"slug":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["contact","ticket","pqrs"]},"version":{"type":"integer"},"locale":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"type":{"type":"string"},"label":{"type":"string"},"required":{"type":"boolean"},"maxLength":{"type":"integer"},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"}},"required":["value","label"]}}},"required":["key","type","label","required"]}},"contactRequirement":{"type":"string","enum":["email","phone","email_or_phone"]},"requireTurnstile":{"type":"boolean","deprecated":true,"description":"True when `protection.kind` is `turnstile`."},"protection":{"anyOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["turnstile","recaptcha_v2","recaptcha_v3","hcaptcha"]},"siteKey":{"type":"string"},"action":{"type":"string"}},"required":["kind","siteKey"],"description":"Widget to render with its public site key (never a secret); `action` for reCAPTCHA v3."},{"type":"null"}]},"successMessage":{"type":"string"},"consent":{"anyOf":[{"type":"object","properties":{"policyUrl":{"type":"string"},"version":{"type":"string"}},"required":["policyUrl","version"]},{"type":"null"}]}},"required":["slug","name","kind","version","locale","fields","contactRequirement","requireTurnstile","protection","successMessage","consent"]},"PublicPqrsStatus":{"type":"object","properties":{"radicado":{"type":"string"},"type":{"type":"string","enum":["peticion","queja","reclamo","sugerencia"]},"status":{"type":"string","enum":["open","pending","answered","closed"]},"filedAt":{"type":"string","format":"date-time"},"dueDate":{"type":"string","format":"date"},"slaState":{"type":"string","enum":["on_track","due_soon","due_today","overdue","suspended","answered_on_time","answered_late"]},"extended":{"type":"boolean"},"answeredAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"outcome":{"anyOf":[{"type":"string","enum":["answered","withdrawn","transferred"]},{"type":"null"}]}},"required":["radicado","type","status","filedAt","dueDate","slaState","extended","answeredAt","outcome"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"array","items":{"type":["string","integer"]}},"message":{"type":"string"}},"required":["path","message"]}},"requestId":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}