{"openapi":"3.1.0","info":{"title":"Support desk REST API","version":"1.0","description":"Tickets, messages, customers and the people who answer them. The API lives on your workspace's own address and every request carries an API key."},"servers":[{"url":"https://{workspace}.{domain}/api/v1","description":"Your workspace","variables":{"workspace":{"default":"your-workspace","description":"Your workspace's subdomain, the first part of the address you sign in at."},"domain":{"default":"lagottolabs.ai","description":"The domain the service runs on."}}}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Tickets","description":"A conversation with a customer. Tickets are addressed by their number, the one agents and customers see."},{"name":"Messages","description":"The thread on a ticket - what the customer wrote, what agents replied, and internal notes."},{"name":"Customers","description":"The people who write in. Known by their email address."},{"name":"Users","description":"The people in your workspace. Read-only."},{"name":"Groups","description":"The teams tickets are routed to. Read-only."},{"name":"Macros","description":"Saved replies. Read-only."},{"name":"Records","description":"Your own product's records about your customers (accounts, orders, subscriptions), pushed here so a ticket can show them. Needs the Production data capability. Addressed by a type of your choosing and your own id."},{"name":"Account","description":"What the token you are using is."}],"paths":{"/tickets":{"get":{"tags":["Tickets"],"operationId":"listTickets","summary":"List tickets","description":"Open tickets by default, most recent activity first. Spam is never listed. With `updated_since` the order is oldest change first, so a sync can page through without missing a ticket that changes meanwhile. With `q` the order is by relevance.","parameters":[{"name":"status","in":"query","description":"Which tickets to list.","schema":{"type":"string","enum":["open","closed","all"],"default":"open"}},{"name":"assignee_id","in":"query","description":"Only tickets assigned to this user.","schema":{"type":"integer","example":12}},{"name":"unassigned","in":"query","description":"`true` for only tickets nobody holds: no assignee, or one who has been deactivated.","schema":{"type":"boolean","example":true}},{"name":"group_id","in":"query","description":"Only tickets routed to this group.","schema":{"type":"integer","example":3}},{"name":"customer_email","in":"query","description":"Only tickets from the customer with exactly this address.","schema":{"type":"string","format":"email","example":"carol@example.com"}},{"name":"q","in":"query","description":"Search the ticket number, the customer, the subject and the thread.","schema":{"type":"string","example":"refund"}},{"name":"updated_since","in":"query","description":"Only tickets changed at or after this time (ISO 8601). A new message counts as a change.","schema":{"type":"string","format":"date-time","example":"2026-01-31T09:30:00Z"}},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"}],"responses":{"200":{"description":"A page of tickets.","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Ticket"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Tickets"],"operationId":"createTicket","summary":"Open a ticket","description":"Opens a ticket as a message from a customer, the way an email would: the customer is found by address or created, your routing triggers run, and the people who asked to hear about new tickets are notified. Nothing is sent to the customer. Send an `Idempotency-Key` header to make a retry safe.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketCreate"}}}},"responses":{"201":{"description":"The ticket that was opened.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/TicketDetail"}}}}}},"200":{"description":"The ticket an earlier request with the same `Idempotency-Key` opened. Nothing new was created.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/TicketDetail"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/tickets/{number}":{"parameters":[{"$ref":"#/components/parameters/TicketNumber"}],"get":{"tags":["Tickets"],"operationId":"getTicket","summary":"Get a ticket","description":"The ticket with its whole thread, the AI's unsent draft if there is one, and any fix proposals and pull requests made for it.","responses":{"200":{"description":"The ticket.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/TicketDetail"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Tickets"],"operationId":"updateTicket","summary":"Update a ticket","description":"Close or reopen it, assign it, route it to a group, or mark it as spam. Send only what should change. Everything is checked before anything is changed, and each change is recorded on the ticket in the name of the token's user. Closing a ticket may send the customer a satisfaction survey if your workspace uses them.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TicketUpdate"}}}},"responses":{"200":{"description":"The ticket after the change.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/TicketDetail"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/tickets/{ticket_number}/messages":{"parameters":[{"name":"ticket_number","in":"path","required":true,"description":"The ticket's number.","schema":{"type":"integer","example":1042}}],"get":{"tags":["Messages"],"operationId":"listMessages","summary":"List a ticket's messages","description":"The thread, oldest first, internal notes included.","parameters":[{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"}],"responses":{"200":{"description":"A page of messages.","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Messages"],"operationId":"createMessage","summary":"Add a message to a ticket","description":"What happens depends on `type`. A `reply` is **emailed to the customer** (and anyone copied on the ticket) from the token's user. A `note` is internal and is never sent. A `customer` message records something the customer told you elsewhere, such as your own contact form: it reopens a closed ticket and notifies your agents, exactly as an email from them would. Send an `Idempotency-Key` header to make a retry safe.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageCreate"}}}},"responses":{"201":{"description":"The message that was added.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Message"}}}}}},"200":{"description":"The message an earlier request with the same `Idempotency-Key` added. Nothing new was created or sent.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Message"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers":{"get":{"tags":["Customers"],"operationId":"listCustomers","summary":"List customers","description":"Everyone who has written in, oldest first.","parameters":[{"name":"email","in":"query","description":"Only the customer with exactly this address.","schema":{"type":"string","format":"email","example":"carol@example.com"}},{"name":"q","in":"query","description":"Only customers whose name or address contains this.","schema":{"type":"string","example":"carol"}},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"}],"responses":{"200":{"description":"A page of customers.","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Customer"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Customers"],"operationId":"createCustomer","summary":"Create a customer","description":"Rarely needed: opening a ticket creates its customer. An address that is already a customer is a 422.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCreate"}}}},"responses":{"201":{"description":"The customer that was created.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Customer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/customers/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"The customer's id.","schema":{"type":"integer","example":381}}],"get":{"tags":["Customers"],"operationId":"getCustomer","summary":"Get a customer","description":"The customer and their ten most recently active tickets.","responses":{"200":{"description":"The customer.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/CustomerDetail"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Customers"],"operationId":"updateCustomer","summary":"Update a customer","description":"Send only what should change.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerUpdate"}}}},"responses":{"200":{"description":"The customer after the change.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Customer"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/users":{"get":{"tags":["Users"],"operationId":"listUsers","summary":"List users","description":"Everyone in the workspace, including people who have been deactivated.","parameters":[{"name":"active","in":"query","description":"`true` to leave out people who have been deactivated.","schema":{"type":"boolean","example":true}},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"}],"responses":{"200":{"description":"A page of users.","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/User"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/users/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"The user's id.","schema":{"type":"integer","example":12}}],"get":{"tags":["Users"],"operationId":"getUser","summary":"Get a user","responses":{"200":{"description":"The user.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/User"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/groups":{"get":{"tags":["Groups"],"operationId":"listGroups","summary":"List groups","parameters":[{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"}],"responses":{"200":{"description":"A page of groups.","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Group"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/groups/{id}":{"parameters":[{"name":"id","in":"path","required":true,"description":"The group's id.","schema":{"type":"integer","example":3}}],"get":{"tags":["Groups"],"operationId":"getGroup","summary":"Get a group","responses":{"200":{"description":"The group.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Group"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/macros":{"get":{"tags":["Macros"],"operationId":"listMacros","summary":"List macros","description":"Saved replies, as written: `{{ customer_name }}`, `{{ agent_name }}` and `{{ ticket_number }}` are placeholders, filled in when an agent uses the macro.","parameters":[{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"}],"responses":{"200":{"description":"A page of macros.","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Macro"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/records":{"get":{"tags":["Records"],"operationId":"listRecords","summary":"List records","description":"The records you have pushed, oldest first. Filter by the customer address they belong to, by type, or both.","parameters":[{"name":"email","in":"query","description":"Only records that belong to exactly this address.","schema":{"type":"string","format":"email","example":"carol@example.com"}},{"name":"type","in":"query","description":"Only records of this type.","schema":{"type":"string","example":"account"}},{"$ref":"#/components/parameters/Page"},{"$ref":"#/components/parameters/PerPage"}],"responses":{"200":{"description":"A page of records.","content":{"application/json":{"schema":{"type":"object","required":["data","pagination"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"pagination":{"$ref":"#/components/schemas/Pagination"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ProductionDataOff"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/records/batch":{"post":{"tags":["Records"],"operationId":"batchRecords","summary":"Push many records","description":"Up to 500 upserts and deletes in one call. Each item stands alone: one that is refused says why in its own result and the rest still go through, so the answer is a `200` even when some items failed. An item with `\"delete\": true` removes that record and needs only `type` and `external_id`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordBatch"}}}},"responses":{"200":{"description":"One result for each item, in the order they were sent.","content":{"application/json":{"schema":{"type":"object","required":["data","summary"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/RecordBatchResult"}},"summary":{"type":"object","description":"How many items ended in each status.","additionalProperties":{"type":"integer"},"example":{"created":1}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/records/{record_type}/{external_id}":{"parameters":[{"name":"record_type","in":"path","required":true,"description":"What kind of record it is, in your own words. Letters, numbers, `_`, `-` and `:`.","schema":{"type":"string","example":"account"}},{"name":"external_id","in":"path","required":true,"description":"Your own id for the record. Letters, numbers and `. _ - :`.","schema":{"type":"string","example":"381"}}],"get":{"tags":["Records"],"operationId":"getRecord","summary":"Get a record","responses":{"200":{"description":"The record.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Record"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/ProductionDataOff"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}},"put":{"tags":["Records"],"operationId":"upsertRecord","summary":"Create or replace a record","description":"The first `PUT` of a type and id creates the record; every later one replaces its addresses, title, link and data with what you send. A ticket from any address in `emails` shows the record.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordWrite"}}}},"responses":{"200":{"description":"The record, replaced.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Record"}}}}}},"201":{"description":"The record, created.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Record"}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationFailed"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Records"],"operationId":"deleteRecord","summary":"Delete a record","description":"Removes our copy. Pushing the same type and id again brings it back.","responses":{"200":{"description":"The record that was deleted.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["type","external_id","deleted"],"properties":{"type":{"type":"string","example":"account"},"external_id":{"type":"string","example":"381"},"deleted":{"type":"boolean","example":true}}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/me":{"get":{"tags":["Account"],"operationId":"getMe","summary":"Get the token's identity","description":"The user the token acts as, the workspace it belongs to and what it may do. The quickest way to check a token works.","responses":{"200":{"description":"Who the token is.","content":{"application/json":{"schema":{"type":"object","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/Me"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"An API key from Settings, API keys: `Authorization: Bearer lg_...`"}},"parameters":{"Page":{"name":"page","in":"query","description":"Which page, from 1.","schema":{"type":"integer","minimum":1,"default":1}},"PerPage":{"name":"per_page","in":"query","description":"How many to a page.","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},"TicketNumber":{"name":"number","in":"path","required":true,"description":"The ticket's number.","schema":{"type":"integer","example":1042}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","description":"Any string of your choosing, up to 255 characters, unique to the thing you are creating. A retry with the same key returns what the first request made instead of making it again.","schema":{"type":"string","maxLength":255,"example":"contact-form-8f14e45f"}}},"responses":{"BadRequest":{"description":"A parameter is malformed, or the body is not valid JSON.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"bad_request","message":"per_page can be at most 100."}}}}},"Unauthorized":{"description":"The token is missing, wrong, revoked, expired, or belongs to another workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"unauthorized","message":"Missing or invalid API token."}}}}},"Forbidden":{"description":"The token is read-only, or acts as somebody with a read-only seat.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"forbidden","message":"This token is read-only."}}}}},"NotFound":{"description":"Nothing with that number or id in this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"not_found","message":"No such ticket."}}}}},"ValidationFailed":{"description":"The request was understood but a field is not acceptable. `details` says which.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"validation_failed","message":"Some fields are not valid.","details":{"body":["can't be blank"]}}}}}},"ProductionDataOff":{"description":"The Production data capability is switched off for this workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"forbidden","message":"Production data is switched off for this workspace. An administrator can switch it on under Capabilities."}}}}},"RateLimited":{"description":"Too many requests from this token. `Retry-After` says how many seconds to wait.","headers":{"Retry-After":{"description":"Seconds until the limit resets.","schema":{"type":"integer","example":17}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"error":{"type":"rate_limited","message":"Too many requests. This token may make 300 a minute."}}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","message"],"properties":{"type":{"type":"string","enum":["bad_request","unauthorized","forbidden","not_found","validation_failed","rate_limited","server_error"],"description":"What went wrong, for your code to branch on.","example":"validation_failed"},"message":{"type":"string","description":"The same, for a person.","example":"Some fields are not valid."},"details":{"type":"object","description":"On a 422 only - each field that was refused, and why.","additionalProperties":{"type":"array","items":{"type":"string"}},"example":{"body":["can't be blank"]}}}}}},"Pagination":{"type":"object","required":["page","per_page","total","next_page"],"properties":{"page":{"type":"integer","example":1},"per_page":{"type":"integer","example":25},"total":{"type":"integer","description":"How many there are across every page.","example":2},"next_page":{"type":["integer","null"],"description":"The next page's number, or null on the last page.","example":null}}},"UserReference":{"type":"object","required":["id","name","email"],"properties":{"id":{"type":"integer","example":12},"name":{"type":"string","example":"Alice Agent"},"email":{"type":"string","format":"email","example":"alice@yourcompany.com"}}},"GroupReference":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer","example":3},"name":{"type":"string","example":"Billing"}}},"CustomerReference":{"type":"object","required":["id","email","name"],"properties":{"id":{"type":"integer","example":381},"email":{"type":"string","format":"email","example":"carol@example.com"},"name":{"type":["string","null"],"example":"Carol Customer"}}},"User":{"type":"object","required":["id","name","email","role","active","group_ids","created_at","updated_at"],"properties":{"id":{"type":"integer","example":12},"name":{"type":"string","example":"Alice Agent"},"email":{"type":"string","format":"email","example":"alice@yourcompany.com"},"role":{"type":"string","enum":["owner","admin","agent","read_only"],"example":"agent"},"active":{"type":"boolean","description":"False once somebody has been deactivated. They keep their name on what they wrote.","example":true},"group_ids":{"type":"array","items":{"type":"integer"},"example":[3]},"created_at":{"type":"string","format":"date-time","example":"2025-11-03T16:20:00Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-01-12T08:02:11Z"}}},"Group":{"type":"object","required":["id","name","description","user_ids","created_at","updated_at"],"properties":{"id":{"type":"integer","example":3},"name":{"type":"string","example":"Billing"},"description":{"type":["string","null"],"example":"Invoices, refunds and payment questions"},"user_ids":{"type":"array","items":{"type":"integer"},"example":[12,15]},"created_at":{"type":"string","format":"date-time","example":"2025-11-03T16:20:00Z"},"updated_at":{"type":"string","format":"date-time","example":"2025-11-03T16:20:00Z"}}},"Macro":{"type":"object","required":["id","title","body","created_at","updated_at"],"properties":{"id":{"type":"integer","example":7},"title":{"type":"string","example":"Refund sent"},"body":{"type":"string","description":"Markdown, with its placeholders unfilled.","example":"Hi {{ customer_name }},\n\nYour refund is on its way.\n\n{{ agent_name }}"},"created_at":{"type":"string","format":"date-time","example":"2025-12-01T10:00:00Z"},"updated_at":{"type":"string","format":"date-time","example":"2025-12-01T10:00:00Z"}}},"Customer":{"type":"object","required":["id","email","name","language","created_at","updated_at"],"properties":{"id":{"type":"integer","example":381},"email":{"type":"string","format":"email","example":"carol@example.com"},"name":{"type":["string","null"],"example":"Carol Customer"},"language":{"type":["string","null"],"description":"The language they write in, as a two or three letter code, when known.","example":"en"},"created_at":{"type":"string","format":"date-time","example":"2026-01-30T14:05:09Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-01-30T14:05:09Z"}}},"CustomerDetail":{"allOf":[{"$ref":"#/components/schemas/Customer"},{"type":"object","required":["recent_tickets"],"properties":{"recent_tickets":{"type":"array","description":"Their ten most recently active tickets. Spam is left out.","items":{"$ref":"#/components/schemas/Ticket"}}}}]},"CustomerCreate":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email","example":"carol@example.com"},"name":{"type":"string","example":"Carol Customer"},"language":{"type":"string","example":"en"}}},"CustomerUpdate":{"type":"object","properties":{"email":{"type":"string","format":"email","example":"carol@example.com"},"name":{"type":["string","null"],"example":"Carol Customer-Jones"},"language":{"type":["string","null"],"example":"en"}}},"Message":{"type":"object","required":["id","type","body","author","attachments","created_at"],"properties":{"id":{"type":"integer","example":90214},"type":{"type":"string","enum":["customer","reply","note","system"],"description":"`customer` came from the customer (or somebody they copied), `reply` was sent to them by an agent, `note` is internal, `system` is an internal note we wrote ourselves.","example":"customer"},"body":{"type":["string","null"],"description":"Plain text or Markdown. Null only for a message that is nothing but attachments.","example":"I was charged twice this month. Can you refund the duplicate?"},"author":{"type":"object","required":["type","id","name","email"],"properties":{"type":{"type":"string","enum":["customer","user","system"],"example":"customer"},"id":{"type":["integer","null"],"description":"The user's id when `type` is `user`, otherwise null.","example":null},"name":{"type":"string","example":"Carol Customer"},"email":{"type":["string","null"],"example":"carol@example.com"}}},"attachments":{"type":"array","description":"What was attached. Names and sizes only - the files are read in the app.","items":{"type":"object","required":["filename","content_type","byte_size"],"properties":{"filename":{"type":"string","example":"invoice.pdf"},"content_type":{"type":["string","null"],"example":"application/pdf"},"byte_size":{"type":"integer","example":48213}}}},"created_at":{"type":"string","format":"date-time","example":"2026-01-30T14:05:09Z"}}},"MessageCreate":{"type":"object","required":["type","body"],"properties":{"type":{"type":"string","enum":["reply","note","customer"],"description":"`reply` emails the customer. `note` is internal. `customer` records a message from the customer.","example":"reply"},"body":{"type":"string","description":"Plain text or Markdown.","example":"Hi Carol,\n\nThe duplicate charge has been refunded. It should reach your card within five working days."},"close":{"type":"boolean","description":"For a `reply` only - close the ticket once it is sent.","default":false,"example":true}}},"Ticket":{"type":"object","required":["number","subject","status","spam","source","language","cc","customer","assignee","group","url","created_at","updated_at","closed_at","first_response_at","last_customer_message_at","last_agent_reply_at","last_activity_at"],"properties":{"number":{"type":"integer","description":"How the ticket is addressed, here and in the app.","example":1042},"subject":{"type":"string","example":"Charged twice this month"},"status":{"type":"string","enum":["open","closed"],"example":"open"},"spam":{"type":"boolean","example":false},"source":{"type":"string","enum":["email","api","web"],"description":"How the ticket arrived.","example":"api"},"language":{"type":["string","null"],"example":"en"},"cc":{"type":"array","description":"Who a reply goes to besides the customer.","items":{"type":"string","format":"email"},"example":["accounts@example.com"]},"customer":{"$ref":"#/components/schemas/CustomerReference"},"assignee":{"description":"Who holds the ticket, or null.","oneOf":[{"$ref":"#/components/schemas/UserReference"},{"type":"null"}]},"group":{"description":"The group it is routed to, or null.","oneOf":[{"$ref":"#/components/schemas/GroupReference"},{"type":"null"}]},"url":{"type":"string","format":"uri","description":"The ticket in the app, for a person to open.","example":"https://your-workspace.lagottolabs.ai/tickets/1042"},"created_at":{"type":"string","format":"date-time","example":"2026-01-30T14:05:09Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-01-30T14:05:09Z"},"closed_at":{"type":["string","null"],"format":"date-time","example":null},"first_response_at":{"type":["string","null"],"format":"date-time","description":"When an agent first replied.","example":null},"last_customer_message_at":{"type":["string","null"],"format":"date-time","example":"2026-01-30T14:05:09Z"},"last_agent_reply_at":{"type":["string","null"],"format":"date-time","example":null},"last_activity_at":{"type":"string","format":"date-time","example":"2026-01-30T14:05:09Z"}}},"TicketDetail":{"allOf":[{"$ref":"#/components/schemas/Ticket"},{"type":"object","required":["ai_summary","ai_draft","ai_draft_note","ai_draft_at","messages","proposals","pull_requests"],"properties":{"ai_summary":{"type":["string","null"],"description":"A summary written when the ticket was closed, if AI is switched on.","example":null},"ai_draft":{"type":["string","null"],"description":"A reply the AI has drafted and nobody has sent. It is never sent on its own: an agent sends it, or you post it as a `reply` message.","example":"Hi Carol,\n\nI can see the two charges on 28 January. I've refunded the second one."},"ai_draft_note":{"type":["string","null"],"description":"What the AI wants the agent to know about its draft.","example":"Refund not yet issued - the reply assumes you will issue it."},"ai_draft_at":{"type":["string","null"],"format":"date-time","example":"2026-01-30T14:06:40Z"},"messages":{"type":"array","description":"The whole thread, oldest first.","items":{"$ref":"#/components/schemas/Message"}},"proposals":{"type":"array","description":"Fixes the AI has proposed for this ticket, each waiting on or settled by an agent.","items":{"$ref":"#/components/schemas/Proposal"}},"pull_requests":{"type":"array","description":"Pull requests opened for this ticket after a proposal was approved.","items":{"$ref":"#/components/schemas/PullRequest"}}}}]},"TicketCreate":{"type":"object","required":["customer","body"],"properties":{"customer":{"type":"object","required":["email"],"description":"Who the ticket is from. Found by address, or created.","properties":{"email":{"type":"string","format":"email","example":"carol@example.com"},"name":{"type":"string","example":"Carol Customer"}}},"subject":{"type":"string","description":"Defaults to \"(no subject)\".","example":"Charged twice this month"},"body":{"type":"string","description":"The customer's message, as plain text or Markdown.","example":"I was charged twice this month. Can you refund the duplicate?"},"cc":{"type":"array","description":"Addresses to copy on every reply.","items":{"type":"string","format":"email"},"example":["accounts@example.com"]}}},"TicketUpdate":{"type":"object","properties":{"status":{"type":"string","enum":["open","closed"],"description":"Close or reopen the ticket.","example":"closed"},"assignee_id":{"type":["integer","null"],"description":"The user to assign it to, or null to unassign. Must be active and not a read-only seat.","example":12},"group_id":{"type":["integer","null"],"description":"The group to route it to, or null for none.","example":3},"spam":{"type":"boolean","description":"True marks it as spam and closes it; false brings it back, open. Cannot be combined with `status` when true.","example":false}}},"Proposal":{"type":"object","required":["id","kind","status","title","repository","created_at","decided_at"],"properties":{"id":{"type":"integer","example":55},"kind":{"type":"string","enum":["code_fix","data_fix"],"example":"code_fix"},"status":{"type":"string","enum":["pending","approved","declined","working","opened","failed"],"example":"pending"},"title":{"type":"string","example":"Stop charging twice when a renewal is retried"},"repository":{"type":"string","example":"yourcompany/billing"},"created_at":{"type":"string","format":"date-time","example":"2026-01-30T14:06:40Z"},"decided_at":{"type":["string","null"],"format":"date-time","example":null}}},"PullRequest":{"type":"object","required":["number","kind","state","title","url","repository","created_at","merged_at","closed_at"],"properties":{"number":{"type":"integer","example":918},"kind":{"type":"string","enum":["code_fix","data_fix"],"example":"code_fix"},"state":{"type":"string","enum":["open","merged","closed"],"example":"open"},"title":{"type":"string","example":"Stop charging twice when a renewal is retried"},"url":{"type":"string","format":"uri","example":"https://github.com/yourcompany/billing/pull/918"},"repository":{"type":"string","example":"yourcompany/billing"},"created_at":{"type":"string","format":"date-time","example":"2026-01-30T15:10:02Z"},"merged_at":{"type":["string","null"],"format":"date-time","example":null},"closed_at":{"type":["string","null"],"format":"date-time","example":null}}},"Me":{"type":"object","required":["user","workspace","access"],"properties":{"user":{"$ref":"#/components/schemas/User"},"workspace":{"type":"object","required":["name","subdomain","time_zone"],"properties":{"name":{"type":"string","example":"Your Company"},"subdomain":{"type":"string","example":"your-workspace"},"time_zone":{"type":"string","example":"UTC"}}},"access":{"type":"string","enum":["read","write"],"description":"What this token may do - never more than its user.","example":"write"}}},"Record":{"type":"object","required":["type","external_id","emails","title","url","data","bytes","created_at","updated_at"],"properties":{"type":{"type":"string","description":"What kind of record it is.","example":"account"},"external_id":{"type":"string","description":"Your own id for it.","example":"381"},"emails":{"type":"array","description":"The customer addresses the record belongs to, lowercased.","items":{"type":"string","format":"email"},"example":["carol@example.com"]},"title":{"type":["string","null"],"description":"What the card on a ticket is called.","example":"Carol Customer"},"url":{"type":["string","null"],"description":"Where the card's Open button goes.","example":"https://admin.yourcompany.com/customers/381"},"data":{"type":"object","description":"Whatever you sent.","additionalProperties":true,"example":{"plan":"Team","seats":12,"renews_at":"2026-09-01T00:00:00Z"}},"bytes":{"type":"integer","description":"How much the record weighs in storage.","example":137},"created_at":{"type":"string","format":"date-time","example":"2026-01-31T09:30:00Z"},"updated_at":{"type":"string","format":"date-time","example":"2026-02-02T16:05:00Z"}}},"RecordWrite":{"type":"object","required":["emails"],"properties":{"emails":{"type":"array","description":"1 to 20 customer addresses the record belongs to. A ticket from any of them shows it.","minItems":1,"maxItems":20,"items":{"type":"string","format":"email"},"example":["carol@example.com"]},"title":{"type":["string","null"],"description":"What the card on a ticket is called. Up to 255 characters.","example":"Carol Customer"},"url":{"type":["string","null"],"description":"A link to the record in your own admin. `http` or `https` only.","example":"https://admin.yourcompany.com/customers/381"},"data":{"type":"object","description":"What support should see, as a JSON object of up to 64KB. Shown on the ticket and given to AI drafts.","additionalProperties":true,"example":{"plan":"Team","seats":12,"renews_at":"2026-09-01T00:00:00Z"}}}},"RecordBatch":{"type":"object","required":["records"],"properties":{"records":{"type":"array","description":"Up to 500 items. Each is a record to upsert (`type`, `external_id`, `emails`, and optionally `title`, `url`, `data`), or `type`, `external_id` and `\"delete\"` set to true.","maxItems":500,"items":{"type":"object","required":["type","external_id"],"properties":{"type":{"type":"string","example":"account"},"external_id":{"type":"string","example":"381"},"emails":{"type":"array","items":{"type":"string","format":"email"},"example":["carol@example.com"]},"title":{"type":["string","null"],"example":"Carol Customer"},"url":{"type":["string","null"],"example":"https://admin.yourcompany.com/customers/381"},"data":{"type":"object","additionalProperties":true,"example":{"plan":"Team","seats":12}},"delete":{"type":"boolean","description":"True to delete the record instead.","example":false}}}}}},"RecordBatchResult":{"type":"object","required":["type","external_id","status","errors"],"properties":{"type":{"type":["string","null"],"example":"account"},"external_id":{"type":["string","null"],"example":"381"},"status":{"type":"string","enum":["created","updated","deleted","not_found","error"],"description":"What happened to this item. `not_found` is a delete of a record we don't hold.","example":"created"},"errors":{"type":["object","null"],"description":"On `error` only - each field that was refused, and why.","additionalProperties":{"type":"array","items":{"type":"string"}},"example":null}}}}}}