{"openapi":"3.1.0","info":{"title":"Otto API","version":"1","description":"The Otto API lets your systems read conversations, contacts, complaints and returns, unanswered questions, products and usage, write the catalogue and knowledge, do what the buttons in the Otto panel do, and ask Otto from your own app or system. Every response is JSON and every time is ISO 8601 in UTC. Authenticate with an API key from the panel (Settings, Connections, API) in the Authorization: Bearer header. Each key has its own permissions, x-otto-permission on every operation names the one it needs. Limit: 120 requests per minute per company; RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset tell you where you stand and a 429 carries Retry-After. Every error has { error, errcode, requestId }: errcode is stable English, error is a sentence for people. Send your own x-request-id and we echo it. Lists return nextBefore; send it back as before= and stop when it is null. Records of other companies return 404, never 403.","contact":{"name":"Otto AI","email":"podpora@ottoai.sk","url":"https://ottoai.sk"}},"servers":[{"url":"https://api.ottoai.sk"},{"url":"https://api.ottoai.cz"},{"url":"https://api.ottoai.eu"}],"security":[{"apiKey":[]}],"tags":[{"name":"Account"},{"name":"Ask","description":"Otto's answers for your own app or system. They take the same path as the chat on your site and count towards your plan limit."},{"name":"Conversations"},{"name":"Tags"},{"name":"Leads"},{"name":"Returns"},{"name":"Unanswered"},{"name":"Catalogue","description":"These routes do not need API in your plan: they replace the XML feed."},{"name":"Knowledge"},{"name":"Team"},{"name":"Webhooks"}],"paths":{"/v1/me":{"get":{"tags":["Account"],"operationId":"getMe","summary":"Who am I","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tenant":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}},"required":["id","name"]},"plan":{"type":"string"},"features":{"type":"object","properties":{"api":{"type":"boolean"},"webhooks":{"type":"boolean"},"whiteLabel":{"type":"boolean"},"inAppChat":{"type":"boolean"}},"required":["api","webhooks","whiteLabel","inAppChat"]},"limits":{"type":"object","properties":{"conversationsPerMonth":{"type":["integer","null"]}},"required":["conversationsPerMonth"]},"events":{"type":"array","items":{"type":"string"}}},"required":["tenant","plan","features","limits","events"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/stats":{"get":{"tags":["Account"],"operationId":"getStats","summary":"Counts and conversation outcomes over time","description":"Without parameters: the last 30 days by day in Europe/Bratislava. The range is at most 400 days. resolvedByOtto + unanswered are the conversations Otto handled alone, which the panel shows as solved by Otto.","parameters":[{"$ref":"#/components/parameters/since"},{"$ref":"#/components/parameters/until"},{"name":"interval","in":"query","schema":{"type":"string","enum":["day","week","month"],"default":"day"},"description":"Weeks start on Monday."},{"name":"timezone","in":"query","schema":{"type":"string","default":"Europe/Bratislava"},"description":"IANA time zone for the series boundaries."}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"conversationsTotal":{"type":"integer"},"conversationsMonth":{"type":"integer"},"products":{"type":"integer"},"range":{"type":"object","properties":{"since":{"type":"string","format":"date-time"},"until":{"type":"string","format":"date-time"},"interval":{"type":"string","enum":["day","week","month"]},"timezone":{"type":"string"},"totals":{"type":"object","properties":{"conversations":{"type":"integer"},"resolvedByOtto":{"type":"integer"},"unanswered":{"type":"integer"},"handedOff":{"type":"integer"},"missed":{"type":"integer"},"ratingUp":{"type":"integer"},"ratingDown":{"type":"integer"},"leads":{"type":"integer"},"returns":{"type":"integer"}},"required":["conversations","resolvedByOtto","unanswered","handedOff","missed","ratingUp","ratingDown","leads","returns"]},"series":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date","description":"First day of the interval in the given time zone."},"conversations":{"type":"integer"},"resolvedByOtto":{"type":"integer"},"unanswered":{"type":"integer"},"handedOff":{"type":"integer"},"missed":{"type":"integer"},"ratingUp":{"type":"integer"},"ratingDown":{"type":"integer"}},"required":["date","conversations","resolvedByOtto","unanswered","handedOff","missed","ratingUp","ratingDown"]}}},"required":["since","until","interval","timezone","totals","series"]}},"required":["conversationsTotal","conversationsMonth","products","range"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/usage":{"get":{"tags":["Account"],"operationId":"getUsage","summary":"Answers used in the current plan period","description":"With a subscription the period runs from the day of payment to the same day next month, without one it is the calendar month. limit and remaining are null on an unlimited plan.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"month":{"type":"string","pattern":"^[0-9]{4}-[0-9]{2}$"},"periodStart":{"type":"string","format":"date-time"},"periodEnd":{"type":"string","format":"date-time","description":"When the limit resets."},"conversations":{"type":"integer"},"limit":{"type":["integer","null"]},"remaining":{"type":["integer","null"]}},"required":["month","periodStart","periodEnd","conversations","limit","remaining"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/conversations":{"get":{"tags":["Conversations"],"operationId":"listConversations","summary":"List conversations","description":"Newest activity first. Returns no message text, use GET /v1/conversations/{id} for that.","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["bot","human","resolved"]}},{"name":"outcome","in":"query","schema":{"$ref":"#/components/schemas/Outcome"}},{"name":"lang","in":"query","schema":{"type":"string","pattern":"^[a-z]{2}$"},"description":"Two-letter language code, for example sk, cs or en."},{"name":"q","in":"query","schema":{"type":"string","minLength":2,"maxLength":100},"description":"Words to find in the message text or the colleague's name. Searches the newest 20,000 messages, searchTruncated is true when there were more. At most 20 searches per minute."},{"name":"tag","in":"query","schema":{"type":"string","maxLength":100},"description":"Only conversations with this tag: its name (any letter case) or id from GET /v1/tags. An unknown tag returns 400."},{"$ref":"#/components/parameters/since"},{"$ref":"#/components/parameters/until"},{"$ref":"#/components/parameters/updatedSince"},{"$ref":"#/components/parameters/before"},{"$ref":"#/components/parameters/limit100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"conversations":{"type":"array","items":{"$ref":"#/components/schemas/Conversation"}},"nextBefore":{"type":["string","null"]},"searchTruncated":{"type":"boolean","description":"Only with q."}},"required":["conversations","nextBefore"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/conversations/{id}":{"get":{"tags":["Conversations"],"operationId":"getConversation","summary":"One conversation with its messages","description":"The only endpoint that returns message text. At most 500 messages, oldest first.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"conversation":{"$ref":"#/components/schemas/ConversationDetail"},"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}}},"required":["conversation","messages"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"},"delete":{"tags":["Conversations"],"operationId":"deleteConversation","summary":"Erase a conversation","description":"Erases the conversation with its messages, notes, contacts, complaints and returns with their photos and unanswered questions, the same as deleting it in the panel. Use it when a customer asks you to erase their data. It cannot be undone.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/ask":{"post":{"tags":["Ask"],"operationId":"askOtto","summary":"Ask Otto and wait for the answer","description":"Call it from your server, the key does not belong in a mobile app or website code. Sends one customer message down the same path as the chat on your site: the same answer, the same checks before anything goes out, the same answer limit, message.created webhooks and encrypted storage. The conversation shows up in the panel's Inbox with the channel API. The call returns when the answer is ready, so set your client timeout to at least 60 seconds. Without conversationId a new conversation starts; send conversationId from the response to continue it. Only conversations started through the API can be continued, others return 409 conv_other_channel. Limit: 30 questions per minute per key and 60 per company, on top of the general API limit. A question that gets an answer counts as one answer of your plan. status tells you what happened: answered, handoff (Otto passes it to a colleague), with_operator (a colleague has the conversation, answer is null and the message is waiting for them) or stopped (the plan limit is reached or the service is paused; answer holds the same sentence the chat shows and the message stays in the Inbox). A colleague's reply reaches you through the message.created webhook or GET /v1/conversations/{id}.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskRequest"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskAnswer"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"ask"}},"/v1/chat":{"post":{"tags":["Ask"],"operationId":"chatWithOtto","summary":"Ask Otto and follow the progress as server-sent events","description":"The same request and the same result as POST /v1/ask, delivered as text/event-stream so your app can show that Otto is working. This is not token streaming: every answer is checked before it goes out, so its text arrives in one piece at the end. Events: status with { state: processing, elapsedMs } right away and then every 5 seconds; answer with the same object as POST /v1/ask, or error with { error, errcode, status, requestId }; done always comes last. A wrong key, permission, plan, parameter, limit or conversation returns an ordinary JSON error before the stream opens. When the connection drops, Otto still finishes, stores and counts the answer. Repeat the question with the same idempotencyKey to get that answer without spending another one.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskRequest"}}}},"responses":{"200":{"description":"Server-sent events: status, then answer or error, then done.","content":{"text/event-stream":{"schema":{"type":"string"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"ask"}},"/v1/conversations/{id}/contact":{"post":{"tags":["Ask"],"operationId":"sendAskContact","summary":"Pass on the customer's contact","description":"Does what the contact form in the chat does, when an answer says needsContact. Send at least an email or a phone number. When contactBeforeHandoff was true, the conversation goes to a colleague now and handedOff is true. Only for conversations started through the API.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40},"note":{"type":"string","maxLength":600},"identity":{"type":"string","description":"The identity token, needed when a verified customer owns the conversation."}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"handedOff":{"type":"boolean"}},"required":["ok","handedOff"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"ask"}},"/v1/conversations/{id}/messages":{"post":{"tags":["Conversations"],"operationId":"replyToConversation","summary":"Reply to the customer","description":"Sends a message as a colleague, exactly like replying in the panel. The conversation switches to human and Otto stays quiet in it. A customer who is not on the site gets the reply by email.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":4000},"operatorId":{"type":"string","format":"uuid","description":"Team member from GET /v1/operators. Without it the author is shown as API."}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"message":{"type":"object","properties":{"role":{"type":"string","const":"operator"},"kind":{"type":"string","const":"text"},"text":{"type":"string"},"author":{"type":"string"},"at":{"type":"string","format":"date-time"}},"required":["role","kind","text","author","at"]},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","const":"human"}},"required":["id","status"]}},"required":["ok","message","conversation"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/conversations/{id}/notes":{"post":{"tags":["Conversations"],"operationId":"addConversationNote","summary":"Add an internal note","description":"The customer never sees notes.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":2000},"operatorId":{"type":"string","format":"uuid","description":"Team member from GET /v1/operators. Without it the author is shown as API."}},"required":["text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"note":{"type":"object","properties":{"id":{"type":"string"},"author":{"type":"string"},"text":{"type":"string"},"at":{"type":"string","format":"date-time"}},"required":["id","author","text","at"]}},"required":["ok","note"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/conversations/{id}/takeover":{"post":{"tags":["Conversations"],"operationId":"takeOverConversation","summary":"Take over a conversation","description":"Otto stops answering. Without operatorId the current assignee stays. Sends the conversation.operator_joined event.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"operatorId":{"type":"string","format":"uuid","description":"Team member from GET /v1/operators. Without it the author is shown as API."}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","const":"human"},"assignee":{"type":["string","null"],"format":"uuid"}},"required":["id","status","assignee"]}},"required":["ok","conversation"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/conversations/{id}/release":{"post":{"tags":["Conversations"],"operationId":"releaseConversation","summary":"Hand the conversation back to Otto","description":"Otto answers on its own again and nobody is assigned.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","const":"bot"},"assignee":{"type":"null"}},"required":["id","status","assignee"]}},"required":["ok","conversation"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/conversations/{id}/resolve":{"post":{"tags":["Conversations"],"operationId":"resolveConversation","summary":"Resolve a conversation","description":"Like Resolve in the panel. Contacts the customer left in this conversation are marked handled, each with the lead.updated event. Sends the conversation.resolved event.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","const":"resolved"}},"required":["id","status"]}},"required":["ok","conversation"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/conversations/{id}/reopen":{"post":{"tags":["Conversations"],"operationId":"reopenConversation","summary":"Reopen a resolved conversation","description":"The conversation returns to human.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","const":"human"}},"required":["id","status"]}},"required":["ok","conversation"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/conversations/{id}/tags":{"patch":{"tags":["Tags"],"operationId":"tagConversation","summary":"Add or remove tags","description":"Like tagging in the panel. add and remove take tag names (any letter case) or ids from GET /v1/tags; the tag must exist, create it with POST /v1/tags. Send at least one non-empty list; empty or whitespace-only names are rejected. Adding a tag the conversation has, or removing one it does not, changes nothing. A conversation carries at most 10 tags (errcode too_many_tags), an unknown tag returns 404 tag_not_found.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"add":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":10,"description":"Tag names or ids to add."},"remove":{"type":"array","items":{"type":"string","maxLength":100},"maxItems":10,"description":"Tag names or ids to remove."}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"tags":{"type":"array","items":{"type":"string"}}},"required":["id","tags"]}},"required":["ok","conversation"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/tags":{"get":{"tags":["Tags"],"operationId":"listTags","summary":"Tags for conversations","description":"Alphabetical. conversations says how many conversations carry the tag.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"tags":{"type":"array","items":{"$ref":"#/components/schemas/Tag"}}},"required":["tags"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"},"post":{"tags":["Tags"],"operationId":"createTag","summary":"Create a tag","description":"At most 50 tags per company (errcode tag_limit). Names are unique regardless of letter case (errcode tag_exists). Without color the tag is blue.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"$ref":"#/components/schemas/TagName"},"color":{"$ref":"#/components/schemas/TagColor","default":"blue"}},"required":["name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"tag":{"$ref":"#/components/schemas/Tag"}},"required":["ok","tag"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/tags/{id}":{"patch":{"tags":["Tags"],"operationId":"updateTag","summary":"Rename a tag or change its colour","description":"Conversations keep the tag under its new name. Renaming and deleting tags is limited to 30 changes per minute per company (errcode rate_limited).","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"$ref":"#/components/schemas/TagName"},"color":{"$ref":"#/components/schemas/TagColor"}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"tag":{"$ref":"#/components/schemas/Tag"}},"required":["ok","tag"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"},"delete":{"tags":["Tags"],"operationId":"deleteTag","summary":"Delete a tag","description":"The tag disappears from every conversation that carried it. It cannot be undone.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/leads":{"get":{"tags":["Leads"],"operationId":"listLeads","summary":"Contacts customers left","parameters":[{"$ref":"#/components/parameters/since"},{"$ref":"#/components/parameters/until"},{"$ref":"#/components/parameters/before"},{"$ref":"#/components/parameters/limit100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"leads":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"nextBefore":{"type":["string","null"]}},"required":["leads","nextBefore"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/leads/{id}":{"patch":{"tags":["Leads"],"operationId":"updateLead","summary":"Mark a contact as handled or not","description":"Sends the lead.updated event when the value changes.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"handled":{"type":"boolean"}},"required":["handled"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"handled":{"type":"boolean"}},"required":["id","handled"]}},"required":["ok","lead"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"},"delete":{"tags":["Leads"],"operationId":"deleteLead","summary":"Erase a contact","description":"Erases one contact the customer left. The conversation stays, erase it with DELETE /v1/conversations/{id}. It cannot be undone.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/returns":{"get":{"tags":["Returns"],"operationId":"listReturns","summary":"Complaints and returns","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["new","approved","rejected","resolved"]}},{"name":"kind","in":"query","schema":{"type":"string","enum":["claim","withdrawal"]}},{"$ref":"#/components/parameters/since"},{"$ref":"#/components/parameters/until"},{"$ref":"#/components/parameters/updatedSince"},{"$ref":"#/components/parameters/before"},{"$ref":"#/components/parameters/limit100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"returns":{"type":"array","items":{"$ref":"#/components/schemas/Return"}},"nextBefore":{"type":["string","null"]}},"required":["returns","nextBefore"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/returns/{id}":{"patch":{"tags":["Returns"],"operationId":"decideReturn","summary":"Decide on a complaint or return","description":"Like the decision in the panel. notify: true emails the customer the decision and your note. Sends the return.updated event.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["new","approved","rejected","resolved"]},"note":{"type":"string","maxLength":2000},"notify":{"type":"boolean","default":false}},"required":["status"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"return":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string"}},"required":["id","status"]}},"required":["ok","return"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/unanswered":{"get":{"tags":["Unanswered"],"operationId":"listUnanswered","summary":"Questions missing an answer","parameters":[{"$ref":"#/components/parameters/since"},{"$ref":"#/components/parameters/until"},{"$ref":"#/components/parameters/before"},{"$ref":"#/components/parameters/limit100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"unanswered":{"type":"array","items":{"$ref":"#/components/schemas/Unanswered"}},"nextBefore":{"type":["string","null"]}},"required":["unanswered","nextBefore"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/unanswered/{id}/dismiss":{"post":{"tags":["Unanswered"],"operationId":"dismissUnanswered","summary":"Hide a question from the list","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/operators":{"get":{"tags":["Team"],"operationId":"listOperators","summary":"Your team","description":"Use id as operatorId in conversation actions.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"operators":{"type":"array","items":{"$ref":"#/components/schemas/Operator"}}},"required":["operators"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"}},"/v1/products":{"get":{"tags":["Catalogue"],"operationId":"listProducts","summary":"Products Otto knows","parameters":[{"$ref":"#/components/parameters/before"},{"$ref":"#/components/parameters/limit200"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"$ref":"#/components/schemas/Product"}},"nextBefore":{"type":["string","null"]}},"required":["products","nextBefore"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"},"post":{"tags":["Catalogue"],"operationId":"upsertProducts","summary":"Add or update products","description":"Only what you send, nothing is deleted. At most 500 at once. Meant for price and stock changes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"$ref":"#/components/schemas/ProductInput"}}},"required":["products"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"products":{"type":"integer"}},"required":["ok","products"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"catalogue"}},"/v1/products/snapshot":{"post":{"tags":["Catalogue"],"operationId":"replaceCatalogue","summary":"Replace the whole catalogue","description":"Products missing from the snapshot are deleted. At most 5000 at once and 12 times per hour. If the snapshot would delete more products than it contains, the missing products are kept the first time and the response has warning, errcode prune_skipped and pendingRemoval. Send the same list again to delete them, otherwise they go with the first smaller snapshot you send after 24 hours. A snapshot with none of the ids we hold and at least 90% of their count (for example after switching to new ids) deletes the old products right away. Products read from your website are always replaced, so removed can be above 0 even with the warning. A snapshot with fewer than 5 products deletes nothing.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"$ref":"#/components/schemas/ProductInput"}}},"required":["products"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"products":{"type":"integer"},"removed":{"type":"integer"},"currency":{"type":["string","null"]},"warning":{"type":"string"},"errcode":{"type":"string","const":"prune_skipped"},"pendingRemoval":{"type":"integer"}},"required":["ok","products","removed"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"catalogue"}},"/v1/products/{id}":{"delete":{"tags":["Catalogue"],"operationId":"deleteProduct","summary":"Delete one product by your id","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"catalogue"}},"/v1/knowledge":{"get":{"tags":["Knowledge"],"operationId":"listKnowledge","summary":"What Otto knows besides products","description":"source faq was added by you, page was read from your website. Only faq records can be deleted.","parameters":[{"$ref":"#/components/parameters/before"},{"$ref":"#/components/parameters/limit200"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"knowledge":{"type":"array","items":{"$ref":"#/components/schemas/Knowledge"}},"nextBefore":{"type":["string","null"]}},"required":["knowledge","nextBefore"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"read"},"post":{"tags":["Knowledge"],"operationId":"addKnowledge","summary":"Add knowledge","description":"Otto uses it right away. Content with an unfilled placeholder in square brackets, such as [delivery time] or [your e-mail], is refused with 400 and errcode kb_placeholder, and placeholders lists them. Markdown links and markers such as [1] are fine.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":200},"content":{"type":"string","maxLength":4000}},"required":["title","content"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"id":{"type":"string"}},"required":["ok","id"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/knowledge/{id}":{"delete":{"tags":["Knowledge"],"operationId":"deleteKnowledge","summary":"Delete knowledge you added","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^[0-9]+$"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"write"}},"/v1/webhooks":{"get":{"tags":["Webhooks"],"operationId":"listWebhooks","summary":"List your webhooks","description":"Needs the webhooks_write permission. The address is shortened and the secret is never returned here, it comes only once when the webhook is created.","x-otto-permission":"webhooks_write","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"webhooks":{"type":"array","items":{"$ref":"#/components/schemas/Webhook"}}},"required":["webhooks"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}}},"post":{"tags":["Webhooks"],"operationId":"createWebhook","summary":"Register a webhook","description":"Does what adding a webhook in the panel does: the same address check (only public https or http addresses, never your own Otto domains or an internal network), the same limit of 10 webhooks and the same e-mail to the account owner. Needs the webhooks_write permission. The secret, with which Otto signs the events, is returned only in this response, store it. The format follows the address: Discord and Slack addresses get a ready message, everything else gets the JSON envelope. Use it for REST hooks, for example from Zapier or Make: subscribe when the user switches the trigger on, delete when they switch it off.","x-otto-permission":"webhooks_write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","maxLength":500},"name":{"type":"string","maxLength":60,"description":"Defaults to the host of the address."},"events":{"type":"array","minItems":1,"items":{"type":"string","enum":["conversation.started","conversation.handoff","conversation.operator_joined","conversation.resolved","conversation.rated","message.created","lead.created","lead.updated","return.created","return.updated","unanswered.created","catalog.synced","catalog.failed","usage.threshold"]}}},"required":["url","events"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookCreated"}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/webhooks/{id}":{"delete":{"tags":["Webhooks"],"operationId":"deleteWebhook","summary":"Delete a webhook","description":"Needs the webhooks_write permission. A webhook that does not exist or is not yours returns 404 webhook_nie_je.","x-otto-permission":"webhooks_write","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"429":{"$ref":"#/components/responses/E429"}}}},"/v1/webhooks/deliveries":{"get":{"tags":["Webhooks"],"operationId":"listDeliveries","summary":"Webhook deliveries","parameters":[{"name":"status","in":"query","schema":{"type":"string","enum":["pending","delivered","failed","cancelled"]}},{"name":"event","in":"query","schema":{"type":"string"}},{"name":"webhookId","in":"query","description":"Only deliveries of one webhook.","schema":{"type":"string","format":"uuid"}},{"$ref":"#/components/parameters/before"},{"$ref":"#/components/parameters/limit100"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"deliveries":{"type":"array","items":{"$ref":"#/components/schemas/Delivery"}},"nextBefore":{"type":["string","null"]}},"required":["deliveries","nextBefore"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"webhooks"}},"/v1/webhooks/deliveries/{id}/resend":{"post":{"tags":["Webhooks"],"operationId":"resendDelivery","summary":"Send an event again","description":"The body is kept 7 days after the last attempt; after that 410.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"202":{"description":"Accepted","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"id":{"type":"string","format":"uuid"}},"required":["ok","id"]}}}},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"410":{"$ref":"#/components/responses/E410"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"webhooks"}},"/v1/webhooks/test":{"post":{"tags":["Webhooks"],"operationId":"sendTestEvent","summary":"Send the test.ping event","description":"Delivers right away and tells you how your URL answered. When the company has more webhooks, send webhookId (errcode webhook_id_required otherwise).","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"webhookId":{"type":"string","format":"uuid"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"webhookId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","delivered","failed","cancelled"]},"httpStatus":{"type":["integer","null"]},"unconfirmed":{"type":"boolean"},"error":{"type":["string","null"]}},"required":["id","webhookId","status","httpStatus","unconfirmed","error"]}}}},"400":{"$ref":"#/components/responses/E400"},"401":{"$ref":"#/components/responses/E401"},"403":{"$ref":"#/components/responses/E403"},"404":{"$ref":"#/components/responses/E404"},"409":{"$ref":"#/components/responses/E409"},"429":{"$ref":"#/components/responses/E429"}},"x-otto-permission":"webhooks"}}},"webhooks":{"event":{"post":{"summary":"An event from Otto","description":"Otto POSTs this envelope to your webhook URL. Signed per Standard Webhooks (webhook-id, webhook-timestamp, webhook-signature). The id stays the same across retries, drop duplicates. Retries for about 3 days on non-2xx; 4xx other than 408 and 429 is not retried. Events: conversation.started, conversation.handoff, conversation.operator_joined, conversation.resolved, conversation.rated, message.created, lead.created, lead.updated, return.created, return.updated, unanswered.created, catalog.synced, catalog.failed, usage.threshold. message.created is sent only when you select it explicitly.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Any 2xx confirms the delivery."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"API key from the Otto panel. Keep it on your server, never in website code. Permissions: read for every GET, write for actions and knowledge, catalogue for product writes, webhooks for webhook deliveries, webhooks_write for listing, registering and deleting webhooks, ask for Otto's answers. A missing permission returns 403 insufficient_scope with required naming it."}},"parameters":{"since":{"name":"since","in":"query","schema":{"type":"string","format":"date-time"},"description":"Created at or after this time."},"until":{"name":"until","in":"query","schema":{"type":"string","format":"date-time"},"description":"Created before this time."},"updatedSince":{"name":"updatedSince","in":"query","schema":{"type":"string","format":"date-time"},"description":"Changed at or after this time."},"before":{"name":"before","in":"query","schema":{"type":"string"},"description":"nextBefore from the previous page. Opaque, do not build it yourself."},"limit100":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},"limit200":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":100}}},"responses":{"E400":{"description":"Bad request. errors says exactly what.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E401":{"description":"Invalid or missing API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E403":{"description":"The feature is not in your plan (api_not_in_plan, webhooks_not_in_plan), the key lacks the permission this route needs (insufficient_scope), Otto is switched off in your settings (otto_off), or you blocked this customer (blocked).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E404":{"description":"The record does not exist or is not yours.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E409":{"description":"The action does not fit the current state, for example taking over a resolved conversation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E410":{"description":"The event body is gone.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"E429":{"description":"Too many requests. Retry-After says how many seconds to wait.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"errcode":{"type":"string"},"requestId":{"type":"string"},"errors":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"]}},"placeholders":{"type":"array","items":{"type":"string"},"description":"Only with errcode kb_placeholder: the unfilled placeholders in square brackets found in content, such as [delivery time]."}},"required":["error","errcode","requestId"]},"Outcome":{"type":"string","enum":["resolved_by_otto","unanswered","handed_off","missed"],"description":"resolved_by_otto: Otto handled it alone. unanswered: Otto alone, but the question wasn't settled (the answer was missing from the knowledge, Otto didn't find it, or it was about a specific order). handed_off: a colleague replied. missed: the customer wanted a person and nobody replied."},"AskRequest":{"type":"object","properties":{"message":{"type":"string","minLength":1,"maxLength":4000,"description":"What the customer wrote."},"conversationId":{"type":"string","format":"uuid","description":"From the previous response, to continue the conversation."},"idempotencyKey":{"type":"string","format":"uuid","description":"A new UUID for every question. Repeat it when you retry: you get the stored answer and no other answer is spent."},"language":{"type":"string","enum":["sk","cs","en"],"description":"The language of your page. Otto replies in the language the customer writes in and uses this for a short message whose language cannot be told."},"identity":{"type":"string","description":"The signed identity token of your signed-in customer, the same one the chat on your site uses."},"page":{"type":"object","properties":{"url":{"type":"string","format":"uri","maxLength":800},"title":{"type":"string","maxLength":200}},"required":[]},"customer":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"email":{"type":"string","maxLength":160},"phone":{"type":"string","maxLength":40}},"required":[]}},"required":["message"]},"AskAnswer":{"type":"object","properties":{"conversationId":{"type":"string","format":"uuid"},"messageId":{"type":["string","null"],"description":"Otto's message, the same id as in the message.created webhook. null when status is with_operator."},"status":{"type":"string","enum":["answered","handoff","with_operator","stopped"]},"answer":{"type":["string","null"],"description":"The checked answer, the same text the chat on your site shows. It may contain **bold** and links. null when status is with_operator."},"followup":{"type":["string","null"],"description":"A follow-up question for the customer, shown after the answer."},"suggestions":{"type":"array","items":{"type":"string"},"description":"Short replies the customer can tap."},"products":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"url":{"type":["string","null"]},"price":{"type":["number","string","null"]},"currency":{"type":["string","null"]},"image":{"type":["string","null"]},"availability":{"type":["string","null"]}},"required":["title","url","price","currency","image","availability"]}},"handoff":{"type":"boolean","description":"Otto wants to pass the conversation to a colleague."},"needsContact":{"type":"boolean","description":"Where the chat would show the contact form. Ask for an email or phone and send it to POST /v1/conversations/{id}/contact."},"contactBeforeHandoff":{"type":"boolean","description":"The handover waits for that contact."},"returnForm":{"type":["string","null"],"enum":["claim","withdrawal",null],"description":"Where the chat would show the complaint or return form. The API has no such form: show your own or send the customer to your complaints page."},"language":{"type":["string","null"]},"customerVerified":{"type":"boolean","description":"The identity token was accepted."}},"required":["conversationId","messageId","status","answer","followup","suggestions","products","handoff","needsContact","contactBeforeHandoff","returnForm","language","customerVerified"]},"Conversation":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["bot","human","resolved"]},"outcome":{"$ref":"#/components/schemas/Outcome"},"lang":{"type":["string","null"]},"channel":{"type":"string","enum":["web","messenger","instagram","api"],"description":"Where the customer writes from."},"tags":{"type":"array","items":{"type":"string"},"description":"Names of the tags in the order they were added. Changing them changes updatedAt."},"rating":{"type":["integer","null"],"enum":[1,-1,null]},"createdAt":{"type":"string","format":"date-time"},"lastAt":{"type":["string","null"],"format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"customerId":{"type":["string","null"],"description":"Your customer ID from a verified identity token (sub), null for anonymous chats."}},"required":["id","status","outcome","lang","channel","tags","rating","createdAt","lastAt","updatedAt","customerId"]},"ConversationDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["bot","human","resolved"]},"outcome":{"$ref":"#/components/schemas/Outcome"},"lang":{"type":["string","null"]},"channel":{"type":"string","enum":["web","messenger","instagram","api"],"description":"Where the customer writes from."},"tags":{"type":"array","items":{"type":"string"},"description":"Names of the tags in the order they were added."},"rating":{"type":["integer","null"],"enum":[1,-1,null]},"createdAt":{"type":"string","format":"date-time"},"lastAt":{"type":["string","null"],"format":"date-time"},"customerId":{"type":["string","null"]},"customer":{"$ref":"#/components/schemas/Customer","description":"The customer your site verified with a signed token, null for anonymous chats."}},"required":["id","status","outcome","lang","channel","tags","rating","createdAt","lastAt","customerId","customer"]},"Customer":{"type":["object","null"],"properties":{"id":{"type":"string"},"email":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"verifiedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","email","name","phone","verifiedAt"]},"Message":{"type":"object","properties":{"role":{"type":"string","enum":["user","bot","operator"]},"kind":{"type":["string","null"]},"text":{"type":"string"},"at":{"type":"string","format":"date-time"},"deletedAt":{"type":"string","format":"date-time","description":"When the operator deleted the message. The customer no longer sees it, the text stays for you."}},"required":["role","kind","text","at"]},"Tag":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"color":{"$ref":"#/components/schemas/TagColor"},"conversations":{"type":"integer","description":"How many conversations carry the tag."}},"required":["id","name","color","conversations"]},"TagName":{"type":"string","minLength":1,"maxLength":30,"description":"Letters, digits, spaces and common punctuation, for example Order, VIP or Complaint."},"TagColor":{"type":"string","enum":["blue","green","yellow","orange","red","pink","purple","teal","gray"]},"Lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"note":{"type":"string"},"handled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","conversationId","name","email","phone","note","handled","createdAt"]},"Return":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["claim","withdrawal"]},"status":{"type":"string","enum":["new","approved","rejected","resolved"]},"orderId":{"type":"string"},"issue":{"type":"string"},"want":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"},"conversationId":{"type":["string","null"],"format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"decidedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","kind","status","orderId","issue","want","name","email","conversationId","createdAt","decidedAt"]},"Unanswered":{"type":"object","properties":{"id":{"type":"string"},"conversationId":{"type":["string","null"],"format":"uuid"},"question":{"type":"string"},"at":{"type":"string","format":"date-time"}},"required":["id","conversationId","question","at"]},"Operator":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["owner","operator"]}},"required":["id","name","email","role"]},"Product":{"type":"object","properties":{"id":{"type":"string"},"externalId":{"type":["string","null"]},"title":{"type":"string"},"url":{"type":["string","null"]},"meta":{"type":"object"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","externalId","title","url","meta","updatedAt"]},"ProductInput":{"type":"object","properties":{"id":{"type":"string","maxLength":200,"description":"Your product id. externalId works too."},"title":{"type":"string","maxLength":300,"description":"name works too."},"description":{"type":"string","maxLength":5000},"url":{"type":"string","maxLength":1000},"image":{"type":"string","maxLength":1000,"description":"imageUrl works too."},"price":{"type":"number","minimum":0},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"availability":{"type":"string","maxLength":200},"category":{"type":"string","maxLength":300},"manufacturer":{"type":"string","maxLength":200},"params":{"type":"object","additionalProperties":{"type":"string"},"maxProperties":30}},"required":["id","title"]},"Knowledge":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string","enum":["faq","page"]},"title":{"type":"string"},"content":{"type":"string"},"url":{"type":["string","null"]},"updatedAt":{"type":"string","format":"date-time"},"deletable":{"type":"boolean"}},"required":["id","source","title","content","url","updatedAt","deletable"]},"Webhook":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string"},"format":{"type":"string","enum":["json","discord","slack"]},"events":{"type":"array","items":{"type":"string"}},"disabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["id","name","url","format","events","disabled","createdAt"]},"WebhookCreated":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"url":{"type":"string"},"format":{"type":"string","enum":["json","discord","slack"]},"events":{"type":"array","items":{"type":"string"}},"disabled":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"secret":{"type":"string","description":"Returned only here."}},"required":["id","name","url","format","events","disabled","createdAt","secret"]},"Delivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"webhookId":{"type":["string","null"],"format":"uuid"},"event":{"type":"string"},"status":{"type":"string","enum":["pending","delivered","failed","cancelled"]},"httpStatus":{"type":["integer","null"]},"attempts":{"type":"integer"},"error":{"type":["string","null"]},"unconfirmed":{"type":"boolean"},"test":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"lastAttemptAt":{"type":["string","null"],"format":"date-time"},"nextAttemptAt":{"type":["string","null"],"format":"date-time"},"canResend":{"type":"boolean"}},"required":["id","webhookId","event","status","httpStatus","attempts","error","unconfirmed","test","createdAt","lastAttemptAt","nextAttemptAt","canResend"]},"Event":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event":{"type":"string","enum":["conversation.started","conversation.handoff","conversation.operator_joined","conversation.resolved","conversation.rated","message.created","lead.created","lead.updated","return.created","return.updated","unanswered.created","catalog.synced","catalog.failed","usage.threshold","test.ping"]},"at":{"type":"string","format":"date-time"},"apiVersion":{"type":"string","const":"1"},"tenantId":{"type":"string","format":"uuid"},"tenant":{"type":"string"},"data":{"type":"object"}},"required":["id","event","at","apiVersion","tenantId","tenant","data"]}}}}