{"openapi":"3.1.0","info":{"title":"ZiloOne API","version":"1.0.0","description":"Mail, calendar, contacts, files and the business apps of ZiloOne, for apps in any language. Every call acts as a person: their role, branches, territory and approvals apply. Guides: https://developers.zilomail.in","contact":{"url":"https://developers.zilomail.in"}},"servers":[{"url":"https://api.zilomail.in"}],"tags":[{"name":"Basics","description":"Who the token acts as."},{"name":"Mail","description":"Mailboxes, folders, messages, drafts, sending and the changes feed."},{"name":"Calendar","description":"Events, invitations and answers."},{"name":"Contacts","description":"The address book phones sync too."},{"name":"ZiloDrive","description":"Files and folders, uploads and downloads."},{"name":"People","description":"The organisation's directory."},{"name":"ZiloInvoice","description":"Customers, products, invoices and receipts."},{"name":"ZiloInventory","description":"Warehouses and stock on hand."},{"name":"ZiloHR","description":"Employees, attendance and leave."},{"name":"ZiloCRM","description":"Leads, activities and deals."},{"name":"ZiloProjects","description":"Projects and tasks."},{"name":"ZiloDesk","description":"Tickets and replies."},{"name":"Approvals","description":"Changes waiting for an approver."}],"paths":{"/v1/me":{"get":{"operationId":"me","summary":"Who am I","description":"The person the token acts as, their organisation, and what the token may do. A good first call: it proves the token works.","tags":["Basics"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"Their ZiloOne user id (the same `sub` Sign in with ZiloOne gives).","type":"string"},"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"username":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"description":"Their role in the organisation: owner, admin or user.","type":"string"},"organisation":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["organisation","personal"]}},"required":["id","name","kind"],"additionalProperties":false},"via":{"description":"How this request signed in.","type":"string","enum":["app","key","personal"]},"app":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"scopes":{"description":"What this token may do.","type":"array","items":{"type":"string"}},"apps":{"description":"Which ZiloOne apps the organisation has on.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}}},"required":["id","email","name","username","role","organisation","via","app","scopes","apps"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":[]},{"token":[]}]}},"/v1/calendar/events":{"get":{"operationId":"calendar.events.list","summary":"List events","description":"Events overlapping `from`–`to` (at most 92 days), repeats expanded: a repeating event appears once per occurrence, with the same id.","tags":["Calendar"],"parameters":[{"name":"from","in":"query","required":true,"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","schema":{"type":"string"}},{"name":"to","in":"query","required":true,"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"allDay":{"type":"boolean"},"start":{"description":"ISO date and time; for all-day events, YYYY-MM-DD.","type":"string"},"end":{"description":"ISO date and time; for all-day events the last day, YYYY-MM-DD (inclusive).","type":"string"},"recurring":{"type":"boolean"},"organizer":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},{"type":"null"}]},"mine":{"description":"The person organises it (they may change it; otherwise they answer).","type":"boolean"},"guests":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"answer":{"type":"string","enum":["NEEDS-ACTION","ACCEPTED","DECLINED","TENTATIVE"]}},"required":["email","name","answer"],"additionalProperties":false}},"myAnswer":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","title","location","description","allDay","start","end","recurring","organizer","mine","guests","myAnswer","updatedAt"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["calendar.read"]},{"token":[]}],"x-scope":"calendar.read"},"post":{"operationId":"calendar.events.create","summary":"Add an event","description":"Phones syncing the calendar get it; guests get an invitation by email.","tags":["Calendar"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"allDay":{"type":"boolean"},"start":{"description":"ISO date and time; for all-day events, YYYY-MM-DD.","type":"string"},"end":{"description":"ISO date and time; for all-day events the last day, YYYY-MM-DD (inclusive).","type":"string"},"recurring":{"type":"boolean"},"organizer":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},{"type":"null"}]},"mine":{"description":"The person organises it (they may change it; otherwise they answer).","type":"boolean"},"guests":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"answer":{"type":"string","enum":["NEEDS-ACTION","ACCEPTED","DECLINED","TENTATIVE"]}},"required":["email","name","answer"],"additionalProperties":false}},"myAnswer":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","title","location","description","allDay","start","end","recurring","organizer","mine","guests","myAnswer","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["calendar.write"]},{"token":[]}],"x-scope":"calendar.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"location":{"type":"string","maxLength":300},"description":{"type":"string","maxLength":5000},"allDay":{"default":false,"type":"boolean"},"start":{"description":"ISO date and time (or YYYY-MM-DD for all-day).","type":"string"},"end":{"description":"ISO date and time (or YYYY-MM-DD, the last day, for all-day).","type":"string"},"guests":{"description":"Invited by email.","maxItems":100,"type":"array","items":{"type":"string","maxLength":254}},"notifyGuests":{"description":"Email invitations, updates and cancellations.","default":true,"type":"boolean"},"timeZone":{"description":"For the times written in invitations, e.g. \"Asia/Kolkata\".","type":"string","maxLength":64}},"required":["title","start","end"]},"example":{"title":"Review with Asha","start":"2026-10-20T10:00:00+05:30","end":"2026-10-20T10:30:00+05:30","guests":["asha@example.com"],"timeZone":"Asia/Kolkata"}}}}}},"/v1/calendar/events/{id}":{"get":{"operationId":"calendar.events.get","summary":"Get an event","tags":["Calendar"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"allDay":{"type":"boolean"},"start":{"description":"ISO date and time; for all-day events, YYYY-MM-DD.","type":"string"},"end":{"description":"ISO date and time; for all-day events the last day, YYYY-MM-DD (inclusive).","type":"string"},"recurring":{"type":"boolean"},"organizer":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},{"type":"null"}]},"mine":{"description":"The person organises it (they may change it; otherwise they answer).","type":"boolean"},"guests":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"answer":{"type":"string","enum":["NEEDS-ACTION","ACCEPTED","DECLINED","TENTATIVE"]}},"required":["email","name","answer"],"additionalProperties":false}},"myAnswer":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","title","location","description","allDay","start","end","recurring","organizer","mine","guests","myAnswer","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["calendar.read"]},{"token":[]}],"x-scope":"calendar.read"},"patch":{"operationId":"calendar.events.update","summary":"Change an event","description":"Only the organiser can change an event; guests answer with `answer`.","tags":["Calendar"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"location":{"anyOf":[{"type":"string"},{"type":"null"}]},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"allDay":{"type":"boolean"},"start":{"description":"ISO date and time; for all-day events, YYYY-MM-DD.","type":"string"},"end":{"description":"ISO date and time; for all-day events the last day, YYYY-MM-DD (inclusive).","type":"string"},"recurring":{"type":"boolean"},"organizer":{"anyOf":[{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},{"type":"null"}]},"mine":{"description":"The person organises it (they may change it; otherwise they answer).","type":"boolean"},"guests":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"answer":{"type":"string","enum":["NEEDS-ACTION","ACCEPTED","DECLINED","TENTATIVE"]}},"required":["email","name","answer"],"additionalProperties":false}},"myAnswer":{"anyOf":[{"type":"string"},{"type":"null"}]},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","title","location","description","allDay","start","end","recurring","organizer","mine","guests","myAnswer","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["calendar.write"]},{"token":[]}],"x-scope":"calendar.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"location":{"type":"string","maxLength":300},"description":{"type":"string","maxLength":5000},"allDay":{"default":false,"type":"boolean"},"start":{"description":"ISO date and time (or YYYY-MM-DD for all-day).","type":"string"},"end":{"description":"ISO date and time (or YYYY-MM-DD, the last day, for all-day).","type":"string"},"guests":{"description":"Invited by email.","maxItems":100,"type":"array","items":{"type":"string","maxLength":254}},"notifyGuests":{"description":"Email invitations, updates and cancellations.","default":true,"type":"boolean"},"timeZone":{"description":"For the times written in invitations, e.g. \"Asia/Kolkata\".","type":"string","maxLength":64},"answer":{"description":"A guest's answer: the organiser gets it by email.","type":"string","enum":["ACCEPTED","TENTATIVE","DECLINED"]}}}}}}},"delete":{"operationId":"calendar.events.delete","summary":"Remove an event","description":"Guests get a cancellation unless `notifyGuests=false`.","tags":["Calendar"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"notifyGuests","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"204":{"description":"Done."},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["calendar.write"]},{"token":[]}],"x-scope":"calendar.write"}},"/v1/contacts":{"get":{"operationId":"contacts.list","summary":"List contacts","description":"The person's address book (the same one phones sync over CardDAV), by name.","tags":["Contacts"],"parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","name","email","phone","company","notes","createdAt","updatedAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["contacts.read"]},{"token":[]}],"x-scope":"contacts.read"},"post":{"operationId":"contacts.create","summary":"Add a contact","description":"Needs an email address or a phone number; one contact per email address.","tags":["Contacts"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","name","email","phone","company","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["contacts.write"]},{"token":[]}],"x-scope":"contacts.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"email":{"anyOf":[{"type":"string","maxLength":254},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"company":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}}},"example":{"name":"Ravi Kumar","email":"ravi@example.com","phone":"+91 98765 43210","company":"Kumar Traders"}}}}}},"/v1/contacts/{id}":{"get":{"operationId":"contacts.get","summary":"Get a contact","tags":["Contacts"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","name","email","phone","company","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["contacts.read"]},{"token":[]}],"x-scope":"contacts.read"},"patch":{"operationId":"contacts.update","summary":"Change a contact","tags":["Contacts"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"company":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","name","email","phone","company","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["contacts.write"]},{"token":[]}],"x-scope":"contacts.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"email":{"anyOf":[{"type":"string","maxLength":254},{"type":"null"}]},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"company":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]}}}}}}},"delete":{"operationId":"contacts.delete","summary":"Remove a contact","tags":["Contacts"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"204":{"description":"Done."},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["contacts.write"]},{"token":[]}],"x-scope":"contacts.write"}},"/v1/drive/items":{"get":{"operationId":"drive.items.list","summary":"List files and folders","description":"A folder's contents (My Drive when no `folder`), or with `q` a search of everything the person can open (theirs and shared with them). Folders first, then by name.","tags":["ZiloDrive"],"parameters":[{"name":"folder","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"trashed","in":"query","required":false,"description":"List their Trash instead.","schema":{"type":"boolean"}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["file","folder","doc","sheet","slide","pdf","form"]},{"type":"string"}]},"mimeType":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"folderId":{"description":"The folder it's in; null: My Drive.","anyOf":[{"type":"string"},{"type":"null"}]},"starred":{"type":"boolean"},"virusScan":{"description":"ZiloSecur: \"clean\", \"pending\", \"skipped\" or \"unavailable\" (files only).","anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"trashedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","name","kind","mimeType","sizeBytes","folderId","starred","virusScan","owner","createdAt","updatedAt","trashedAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["drive.read"]},{"token":[]}],"x-scope":"drive.read"}},"/v1/drive/items/{id}":{"get":{"operationId":"drive.items.get","summary":"Get a file or folder","tags":["ZiloDrive"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["file","folder","doc","sheet","slide","pdf","form"]},{"type":"string"}]},"mimeType":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"folderId":{"description":"The folder it's in; null: My Drive.","anyOf":[{"type":"string"},{"type":"null"}]},"starred":{"type":"boolean"},"virusScan":{"description":"ZiloSecur: \"clean\", \"pending\", \"skipped\" or \"unavailable\" (files only).","anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"trashedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","name","kind","mimeType","sizeBytes","folderId","starred","virusScan","owner","createdAt","updatedAt","trashedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["drive.read"]},{"token":[]}],"x-scope":"drive.read"},"patch":{"operationId":"drive.items.update","summary":"Rename, move or star","description":"`folder`: a folder id, or \"root\" for My Drive (the owner only). A name already used there gets a number added.","tags":["ZiloDrive"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["file","folder","doc","sheet","slide","pdf","form"]},{"type":"string"}]},"mimeType":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"folderId":{"description":"The folder it's in; null: My Drive.","anyOf":[{"type":"string"},{"type":"null"}]},"starred":{"type":"boolean"},"virusScan":{"description":"ZiloSecur: \"clean\", \"pending\", \"skipped\" or \"unavailable\" (files only).","anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"trashedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","name","kind","mimeType","sizeBytes","folderId","starred","virusScan","owner","createdAt","updatedAt","trashedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["drive.write"]},{"token":[]}],"x-scope":"drive.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"folder":{"type":"string","maxLength":64},"starred":{"type":"boolean"}}}}}}},"delete":{"operationId":"drive.items.delete","summary":"Move to Trash","description":"With everything inside it (owner only). It stays in Trash for the organisation's retention time.","tags":["ZiloDrive"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"204":{"description":"Done."},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["drive.write"]},{"token":[]}],"x-scope":"drive.write"}},"/v1/drive/items/{id}/content":{"get":{"operationId":"drive.items.content","summary":"Download a file","description":"The file's bytes (Range requests work). Documents, spreadsheets and presentations are exported from their own apps.","tags":["ZiloDrive"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"The file.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["drive.read"]},{"token":[]}],"x-scope":"drive.read"}},"/v1/drive/files":{"post":{"operationId":"drive.files.upload","summary":"Upload a file","description":"Send the file's bytes as the body (any Content-Type), its name in `name`. Virus-scanned like every upload (a virus is refused with 422). Up to 100 MB here, within the organisation's own limits and the person's storage.","tags":["ZiloDrive"],"parameters":[{"name":"name","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":255}},{"name":"folder","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["file","folder","doc","sheet","slide","pdf","form"]},{"type":"string"}]},"mimeType":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"folderId":{"description":"The folder it's in; null: My Drive.","anyOf":[{"type":"string"},{"type":"null"}]},"starred":{"type":"boolean"},"virusScan":{"description":"ZiloSecur: \"clean\", \"pending\", \"skipped\" or \"unavailable\" (files only).","anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"trashedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","name","kind","mimeType","sizeBytes","folderId","starred","virusScan","owner","createdAt","updatedAt","trashedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["drive.write"]},{"token":[]}],"x-scope":"drive.write","requestBody":{"required":true,"content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}}}},"/v1/drive/folders":{"post":{"operationId":"drive.folders.create","summary":"Make a folder","tags":["ZiloDrive"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["file","folder","doc","sheet","slide","pdf","form"]},{"type":"string"}]},"mimeType":{"anyOf":[{"type":"string"},{"type":"null"}]},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"folderId":{"description":"The folder it's in; null: My Drive.","anyOf":[{"type":"string"},{"type":"null"}]},"starred":{"type":"boolean"},"virusScan":{"description":"ZiloSecur: \"clean\", \"pending\", \"skipped\" or \"unavailable\" (files only).","anyOf":[{"type":"string"},{"type":"null"}]},"owner":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"trashedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","name","kind","mimeType","sizeBytes","folderId","starred","virusScan","owner","createdAt","updatedAt","trashedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["drive.write"]},{"token":[]}],"x-scope":"drive.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":255},"folder":{"description":"Inside this folder; default My Drive.","type":"string","maxLength":64}},"required":["name"]}}}}}},"/v1/people":{"get":{"operationId":"people.list","summary":"List people","description":"The organisation's directory: everyone with an active account, by name.","tags":["People"],"parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"department":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","username","jobTitle","department"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["users.read"]},{"token":[]}],"x-scope":"users.read"}},"/v1/people/{id}":{"get":{"operationId":"people.get","summary":"Get a person","tags":["People"],"parameters":[{"name":"id","in":"path","required":true,"description":"Their user id or email address.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"},"username":{"anyOf":[{"type":"string"},{"type":"null"}]},"jobTitle":{"anyOf":[{"type":"string"},{"type":"null"}]},"department":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","email","username","jobTitle","department"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["users.read"]},{"token":[]}],"x-scope":"users.read"}},"/v1/mail/mailboxes":{"get":{"operationId":"mail.mailboxes.list","summary":"List mailboxes","description":"The person's own mailboxes.","tags":["Mail"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"address":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"quotaBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"usedBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"primary":{"description":"The one used when `mailbox` isn't given.","type":"boolean"}},"required":["id","address","name","quotaBytes","usedBytes","primary"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.read"]},{"token":[]}],"x-scope":"mail.read"}},"/v1/mail/folders":{"get":{"operationId":"mail.folders.list","summary":"List folders","description":"Every folder of a mailbox with its message and unread counts.","tags":["Mail"],"parameters":[{"name":"mailbox","in":"query","required":false,"description":"Which of the person's mailboxes: its id or address. Default: their first.","schema":{"type":"string","maxLength":320}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"description":"A special folder's job; null for the person's own folders.","anyOf":[{"type":"string","enum":["inbox","sent","drafts","trash","junk","archive"]},{"type":"null"}]},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unread":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uidValidity":{"description":"As IMAP's UIDVALIDITY: if it changes, forget the folder's UIDs.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uidNext":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","role","parentId","total","unread","uidValidity","uidNext"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.read"]},{"token":[]}],"x-scope":"mail.read"},"post":{"operationId":"mail.folders.create","summary":"Create a folder","tags":["Mail"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"description":"A special folder's job; null for the person's own folders.","anyOf":[{"type":"string","enum":["inbox","sent","drafts","trash","junk","archive"]},{"type":"null"}]},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unread":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uidValidity":{"description":"As IMAP's UIDVALIDITY: if it changes, forget the folder's UIDs.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uidNext":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","role","parentId","total","unread","uidValidity","uidNext"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mailbox":{"description":"Which of the person's mailboxes: its id or address. Default: their first.","type":"string","maxLength":320},"name":{"type":"string","minLength":1,"maxLength":100},"parentId":{"description":"An id this API gave out.","type":"string","minLength":1,"maxLength":64}},"required":["name"]},"example":{"name":"Invoices"}}}}}},"/v1/mail/folders/{id}":{"patch":{"operationId":"mail.folders.update","summary":"Rename a folder","description":"Special folders (Inbox, Sent, Drafts, Trash, Junk) keep their names.","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"description":"A special folder's job; null for the person's own folders.","anyOf":[{"type":"string","enum":["inbox","sent","drafts","trash","junk","archive"]},{"type":"null"}]},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"unread":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uidValidity":{"description":"As IMAP's UIDVALIDITY: if it changes, forget the folder's UIDs.","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"uidNext":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","name","role","parentId","total","unread","uidValidity","uidNext"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"]}}}}},"delete":{"operationId":"mail.folders.delete","summary":"Delete a folder","description":"Its messages go to Trash first. Special folders can't be deleted.","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"204":{"description":"Done."},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write"}},"/v1/mail/messages":{"get":{"operationId":"mail.messages.list","summary":"List messages","description":"Newest first. Search with `q` (sender, subject, text and attachment names). For keeping an app in step, list once, then follow the changes feed.","tags":["Mail"],"parameters":[{"name":"mailbox","in":"query","required":false,"description":"Which of the person's mailboxes: its id or address. Default: their first.","schema":{"type":"string","maxLength":320}},{"name":"folder","in":"query","required":false,"description":"A folder id, name or role (\"inbox\", \"sent\"…). Default: inbox. Omit with `q` to search everywhere.","schema":{"type":"string","maxLength":200}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"unread","in":"query","required":false,"description":"Only unread (true) or only read (false).","schema":{"type":"boolean"}},{"name":"starred","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"since","in":"query","required":false,"description":"Received at or after.","schema":{"type":"string"}},{"name":"threadId","in":"query","required":false,"description":"Only this conversation.","schema":{"type":"string","maxLength":998}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"folderId":{"type":"string"},"uid":{"description":"The message's IMAP UID in its folder (changes when it moves).","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"threadId":{"description":"Messages of one conversation share it.","anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"snippet":{"description":"The start of the text.","type":"string"},"date":{"description":"The Date header.","anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"receivedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"boolean"},"starred":{"type":"boolean"},"answered":{"type":"boolean"},"draft":{"type":"boolean"},"attachments":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"zilosecur":{"description":"ZiloSecur's verdict: \"safe\", \"caution\", \"danger\" or null.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","mailboxId","folderId","uid","threadId","from","to","cc","subject","snippet","date","receivedAt","sizeBytes","read","starred","answered","draft","attachments","zilosecur"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.read"]},{"token":[]}],"x-scope":"mail.read"}},"/v1/mail/messages/{id}":{"get":{"operationId":"mail.messages.get","summary":"Get a message","description":"Headers, text, HTML and the list of attachments. `?format=raw` answers the whole message as RFC 822 (message/rfc822). Reading doesn't mark it read: send `read: true`.","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"format","in":"query","required":false,"schema":{"default":"full","type":"string","enum":["full","raw"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"folderId":{"type":"string"},"uid":{"description":"The message's IMAP UID in its folder (changes when it moves).","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"threadId":{"description":"Messages of one conversation share it.","anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"snippet":{"description":"The start of the text.","type":"string"},"date":{"description":"The Date header.","anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"receivedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"boolean"},"starred":{"type":"boolean"},"answered":{"type":"boolean"},"draft":{"type":"boolean"},"attachments":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"zilosecur":{"description":"ZiloSecur's verdict: \"safe\", \"caution\", \"danger\" or null.","anyOf":[{"type":"string"},{"type":"null"}]},"messageId":{"description":"The Message-ID header (use as `inReplyTo` to reply).","anyOf":[{"type":"string"},{"type":"null"}]},"inReplyTo":{"anyOf":[{"type":"string"},{"type":"null"}]},"replyTo":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"bcc":{"description":"Only on drafts and mail this mailbox sent.","type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"description":"Cleaned of scripts and trackers, as webmail shows it.","anyOf":[{"type":"string"},{"type":"null"}]},"attachmentList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inline":{"type":"boolean"},"url":{"type":"string"}},"required":["id","filename","contentType","sizeBytes","inline","url"],"additionalProperties":false}}},"required":["id","mailboxId","folderId","uid","threadId","from","to","cc","subject","snippet","date","receivedAt","sizeBytes","read","starred","answered","draft","attachments","zilosecur","messageId","inReplyTo","replyTo","bcc","text","html","attachmentList"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.read"]},{"token":[]}],"x-scope":"mail.read"},"patch":{"operationId":"mail.messages.update","summary":"Mark or move a message","description":"Change any of: read, starred, answered, or the folder (id, name or role). Moving gives the message a new `uid`.","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"folderId":{"type":"string"},"uid":{"description":"The message's IMAP UID in its folder (changes when it moves).","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"threadId":{"description":"Messages of one conversation share it.","anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"snippet":{"description":"The start of the text.","type":"string"},"date":{"description":"The Date header.","anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"receivedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"boolean"},"starred":{"type":"boolean"},"answered":{"type":"boolean"},"draft":{"type":"boolean"},"attachments":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"zilosecur":{"description":"ZiloSecur's verdict: \"safe\", \"caution\", \"danger\" or null.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","mailboxId","folderId","uid","threadId","from","to","cc","subject","snippet","date","receivedAt","sizeBytes","read","starred","answered","draft","attachments","zilosecur"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"read":{"type":"boolean"},"starred":{"type":"boolean"},"answered":{"type":"boolean"},"folder":{"type":"string","maxLength":200}}},"example":{"read":true,"folder":"archive"}}}}},"delete":{"operationId":"mail.messages.delete","summary":"Delete a message","description":"Moves it to Trash. A message already in Trash (or with `?permanent=true`) is deleted for good.","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"permanent","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"204":{"description":"Done."},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write"}},"/v1/mail/messages/{id}/attachments/{attachmentId}":{"get":{"operationId":"mail.attachments.get","summary":"Download an attachment","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"name":"attachmentId","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"The file.","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.read"]},{"token":[]}],"x-scope":"mail.read"}},"/v1/mail/send":{"post":{"operationId":"mail.send","summary":"Send a message","description":"Sends from one of the person's mailboxes; a copy goes to Sent. Mail to addresses on this server arrives at once; other mail is queued and retried. Up to 50 recipients (to, cc and bcc together) and 25 MB of attachments; each person may send to 500 recipients an hour through the API.","tags":["Mail"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"description":"The message in Sent.","type":"string"},"messageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}}},"required":["id","messageId","from","to","cc","bcc"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.send"]},{"token":[]}],"x-scope":"mail.send","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mailbox":{"description":"Send from this mailbox (id or address). Default: their first.","type":"string","maxLength":320},"fromName":{"description":"Shown beside the address; default: the person's name.","type":"string","maxLength":200},"to":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"cc":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"bcc":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"replyTo":{"type":"string","maxLength":320},"subject":{"type":"string","minLength":1,"maxLength":998},"text":{"type":"string","maxLength":5000000},"html":{"type":"string","maxLength":5000000},"inReplyTo":{"description":"The Message-ID being answered: threads the reply.","type":"string","maxLength":998},"attachments":{"description":"Up to 25 MB in all.","maxItems":50,"type":"array","items":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","maxLength":255},"content":{"description":"The file, base64-encoded.","type":"string"}},"required":["filename","content"]}}},"required":["to","subject"]},"example":{"to":["priya@example.com"],"subject":"Order 1182 shipped","text":"It's on its way: AWB 1290012.","html":"<p>It's on its way: <b>AWB 1290012</b>.</p>"}}}}}},"/v1/mail/send/{id}":{"get":{"operationId":"mail.send.status","summary":"Delivery status","description":"For each outside recipient: queued, sent, deferred (retrying) or failed, with the last error.","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deliveries":{"type":"array","items":{"type":"object","properties":{"recipient":{"type":"string"},"status":{"type":"string"},"attempts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastError":{"anyOf":[{"type":"string"},{"type":"null"}]},"nextAttemptAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["recipient","status","attempts","lastError","nextAttemptAt"],"additionalProperties":false}}},"required":["id","deliveries"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.send"]},{"token":[]}],"x-scope":"mail.send"}},"/v1/mail/drafts":{"get":{"operationId":"mail.drafts.list","summary":"List drafts","tags":["Mail"],"parameters":[{"name":"mailbox","in":"query","required":false,"description":"Which of the person's mailboxes: its id or address. Default: their first.","schema":{"type":"string","maxLength":320}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"folderId":{"type":"string"},"uid":{"description":"The message's IMAP UID in its folder (changes when it moves).","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"threadId":{"description":"Messages of one conversation share it.","anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"snippet":{"description":"The start of the text.","type":"string"},"date":{"description":"The Date header.","anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"receivedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"boolean"},"starred":{"type":"boolean"},"answered":{"type":"boolean"},"draft":{"type":"boolean"},"attachments":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"zilosecur":{"description":"ZiloSecur's verdict: \"safe\", \"caution\", \"danger\" or null.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","mailboxId","folderId","uid","threadId","from","to","cc","subject","snippet","date","receivedAt","sizeBytes","read","starred","answered","draft","attachments","zilosecur"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.read"]},{"token":[]}],"x-scope":"mail.read"},"post":{"operationId":"mail.drafts.create","summary":"Save a draft","description":"Drafts are messages in the Drafts folder, the same ones webmail and mail apps show.","tags":["Mail"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"folderId":{"type":"string"},"uid":{"description":"The message's IMAP UID in its folder (changes when it moves).","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"threadId":{"description":"Messages of one conversation share it.","anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"snippet":{"description":"The start of the text.","type":"string"},"date":{"description":"The Date header.","anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"receivedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"boolean"},"starred":{"type":"boolean"},"answered":{"type":"boolean"},"draft":{"type":"boolean"},"attachments":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"zilosecur":{"description":"ZiloSecur's verdict: \"safe\", \"caution\", \"danger\" or null.","anyOf":[{"type":"string"},{"type":"null"}]},"messageId":{"description":"The Message-ID header (use as `inReplyTo` to reply).","anyOf":[{"type":"string"},{"type":"null"}]},"inReplyTo":{"anyOf":[{"type":"string"},{"type":"null"}]},"replyTo":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"bcc":{"description":"Only on drafts and mail this mailbox sent.","type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"description":"Cleaned of scripts and trackers, as webmail shows it.","anyOf":[{"type":"string"},{"type":"null"}]},"attachmentList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inline":{"type":"boolean"},"url":{"type":"string"}},"required":["id","filename","contentType","sizeBytes","inline","url"],"additionalProperties":false}}},"required":["id","mailboxId","folderId","uid","threadId","from","to","cc","subject","snippet","date","receivedAt","sizeBytes","read","starred","answered","draft","attachments","zilosecur","messageId","inReplyTo","replyTo","bcc","text","html","attachmentList"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mailbox":{"description":"Send from this mailbox (id or address). Default: their first.","type":"string","maxLength":320},"fromName":{"description":"Shown beside the address; default: the person's name.","type":"string","maxLength":200},"to":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"cc":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"bcc":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"replyTo":{"type":"string","maxLength":320},"subject":{"type":"string","minLength":1,"maxLength":998},"text":{"type":"string","maxLength":5000000},"html":{"type":"string","maxLength":5000000},"inReplyTo":{"description":"The Message-ID being answered: threads the reply.","type":"string","maxLength":998},"attachments":{"description":"Up to 25 MB in all.","maxItems":50,"type":"array","items":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","maxLength":255},"content":{"description":"The file, base64-encoded.","type":"string"}},"required":["filename","content"]}}}}}}}}},"/v1/mail/drafts/{id}":{"patch":{"operationId":"mail.drafts.update","summary":"Change a draft","description":"Fields sent replace the draft's; the rest stay. The draft gets a new id (mail apps store a new version and remove the old).","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"mailboxId":{"type":"string"},"folderId":{"type":"string"},"uid":{"description":"The message's IMAP UID in its folder (changes when it moves).","type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"threadId":{"description":"Messages of one conversation share it.","anyOf":[{"type":"string"},{"type":"null"}]},"from":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"to":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"cc":{"type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"snippet":{"description":"The start of the text.","type":"string"},"date":{"description":"The Date header.","anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"receivedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"read":{"type":"boolean"},"starred":{"type":"boolean"},"answered":{"type":"boolean"},"draft":{"type":"boolean"},"attachments":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"zilosecur":{"description":"ZiloSecur's verdict: \"safe\", \"caution\", \"danger\" or null.","anyOf":[{"type":"string"},{"type":"null"}]},"messageId":{"description":"The Message-ID header (use as `inReplyTo` to reply).","anyOf":[{"type":"string"},{"type":"null"}]},"inReplyTo":{"anyOf":[{"type":"string"},{"type":"null"}]},"replyTo":{"anyOf":[{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false},{"type":"null"}]},"bcc":{"description":"Only on drafts and mail this mailbox sent.","type":"array","items":{"type":"object","properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"address":{"type":"string"}},"required":["name","address"],"additionalProperties":false}},"text":{"anyOf":[{"type":"string"},{"type":"null"}]},"html":{"description":"Cleaned of scripts and trackers, as webmail shows it.","anyOf":[{"type":"string"},{"type":"null"}]},"attachmentList":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"filename":{"type":"string"},"contentType":{"type":"string"},"sizeBytes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"inline":{"type":"boolean"},"url":{"type":"string"}},"required":["id","filename","contentType","sizeBytes","inline","url"],"additionalProperties":false}}},"required":["id","mailboxId","folderId","uid","threadId","from","to","cc","subject","snippet","date","receivedAt","sizeBytes","read","starred","answered","draft","attachments","zilosecur","messageId","inReplyTo","replyTo","bcc","text","html","attachmentList"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mailbox":{"description":"Send from this mailbox (id or address). Default: their first.","type":"string","maxLength":320},"fromName":{"description":"Shown beside the address; default: the person's name.","type":"string","maxLength":200},"to":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"cc":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"bcc":{"maxItems":50,"type":"array","items":{"type":"string","maxLength":320}},"replyTo":{"type":"string","maxLength":320},"subject":{"type":"string","minLength":1,"maxLength":998},"text":{"type":"string","maxLength":5000000},"html":{"type":"string","maxLength":5000000},"inReplyTo":{"description":"The Message-ID being answered: threads the reply.","type":"string","maxLength":998},"attachments":{"description":"Up to 25 MB in all.","maxItems":50,"type":"array","items":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","maxLength":255},"content":{"description":"The file, base64-encoded.","type":"string"}},"required":["filename","content"]}}}}}}}},"delete":{"operationId":"mail.drafts.delete","summary":"Discard a draft","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"204":{"description":"Done."},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.write"]},{"token":[]}],"x-scope":"mail.write"}},"/v1/mail/drafts/{id}/send":{"post":{"operationId":"mail.drafts.send","summary":"Send a draft","description":"Sends it as it is (with its attachments) and removes it from Drafts.","tags":["Mail"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"messageId":{"anyOf":[{"type":"string"},{"type":"null"}]},"from":{"type":"string"},"to":{"type":"array","items":{"type":"string"}},"cc":{"type":"array","items":{"type":"string"}},"bcc":{"type":"array","items":{"type":"string"}}},"required":["id","messageId","from","to","cc","bcc"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.send"]},{"token":[]}],"x-scope":"mail.send"}},"/v1/mail/changes":{"get":{"operationId":"mail.changes","summary":"What changed","description":"Everything that happened in a mailbox since `since`, in order: new mail, read/starred/moved, deleted, from any app (webmail, phones over IMAP, other API apps). Start with no `since` to get the current position, then pass back `cursor` each time. With `wait` (seconds, up to 25) the request holds until something changes: an app can keep one open instead of polling. A position older than 30 days answers 410: list the folders again.","tags":["Mail"],"parameters":[{"name":"mailbox","in":"query","required":false,"description":"Which of the person's mailboxes: its id or address. Default: their first.","schema":{"type":"string","maxLength":320}},{"name":"since","in":"query","required":false,"schema":{"type":"string","pattern":"^\\d+$"}},{"name":"wait","in":"query","required":false,"schema":{"default":0,"type":"integer","minimum":0,"maximum":25}},{"name":"limit","in":"query","required":false,"schema":{"default":500,"type":"integer","minimum":1,"maximum":1000}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"string"},"kind":{"type":"string","enum":["created","updated","deleted"]},"messageId":{"type":"string"},"folderId":{"type":"string"},"uid":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"at":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["seq","kind","messageId","folderId","uid","at"],"additionalProperties":false}},"cursor":{"description":"Pass as `since` next time.","type":"string"},"more":{"description":"More changes are waiting: ask again straight away.","type":"boolean"}},"required":["data","cursor","more"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["mail.read"]},{"token":[]}],"x-scope":"mail.read"}},"/v1/invoice/customers":{"get":{"operationId":"invoice.customers.list","summary":"List customers","description":"The customers the person may see (their territory). Search by name, code, phone, email or tax id.","tags":["ZiloInvoice"],"parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"status":{"description":"ACTIVE, PENDING_APPROVAL or INACTIVE.","type":"string"},"phone":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxId":{"description":"GSTIN in India; the country's tax number elsewhere.","anyOf":[{"type":"string"},{"type":"null"}]},"pan":{"anyOf":[{"type":"string"},{"type":"null"}]},"contactPerson":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"shipping":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"creditLimit":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"paymentTerms":{"anyOf":[{"type":"string"},{"type":"null"}]},"dueDays":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"outstanding":{"description":"Unpaid on their confirmed invoices.","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","status","phone","email","taxId","pan","contactPerson","country","billing","shipping","creditLimit","paymentTerms","dueDays","outstanding","pendingApproval","createdAt","updatedAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"},"post":{"operationId":"invoice.customers.create","summary":"Add a customer","description":"The same checks as the Add customer form (phone, GSTIN and its state, PAN, postal codes). Made by someone limited to part of the sales geography, it goes into their part. With approval levels on Customers: create, it answers 202 and the customer waits as PENDING_APPROVAL.","tags":["ZiloInvoice"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"status":{"description":"ACTIVE, PENDING_APPROVAL or INACTIVE.","type":"string"},"phone":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxId":{"description":"GSTIN in India; the country's tax number elsewhere.","anyOf":[{"type":"string"},{"type":"null"}]},"pan":{"anyOf":[{"type":"string"},{"type":"null"}]},"contactPerson":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"shipping":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"creditLimit":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"paymentTerms":{"anyOf":[{"type":"string"},{"type":"null"}]},"dueDays":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"outstanding":{"description":"Unpaid on their confirmed invoices.","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","status","phone","email","taxId","pan","contactPerson","country","billing","shipping","creditLimit","paymentTerms","dueDays","outstanding","pendingApproval","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.write"]},{"token":[]}],"x-scope":"invoice.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"code":{"description":"Default: the next number in the Customers series.","type":"string","maxLength":40},"phone":{"description":"10 digits in India; with the country code elsewhere.","type":"string","minLength":1,"maxLength":30},"email":{"type":"string","maxLength":254},"taxId":{"type":"string","maxLength":30},"pan":{"type":"string","maxLength":10},"contactPerson":{"type":"string","maxLength":120},"country":{"description":"ISO country code; default the company's.","type":"string","maxLength":2},"billingAddress":{"type":"string","maxLength":500},"billingCity":{"type":"string","maxLength":100},"billingState":{"type":"string","maxLength":100},"billingStateCode":{"type":"string","maxLength":10},"billingPostalCode":{"type":"string","maxLength":12},"shippingAddress":{"type":"string","maxLength":500},"shippingCity":{"type":"string","maxLength":100},"shippingState":{"type":"string","maxLength":100},"shippingStateCode":{"type":"string","maxLength":10},"shippingPostalCode":{"type":"string","maxLength":12},"creditLimit":{"type":"number","minimum":0},"paymentTerms":{"type":"string","enum":["DUE_ON_RECEIPT","NET_15","NET_30","NET_45","NET_60","ADVANCE"]},"dueDays":{"type":"integer","minimum":0,"maximum":3650}},"required":["name","phone"]},"example":{"name":"Kumar Traders","phone":"9876543210","email":"accounts@kumartraders.in","taxId":"18AABCK1234F1Z5","billingCity":"Guwahati","billingState":"Assam","billingStateCode":"18","paymentTerms":"NET_30"}}}}}},"/v1/invoice/customers/{id}":{"get":{"operationId":"invoice.customers.get","summary":"Get a customer","tags":["ZiloInvoice"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"status":{"description":"ACTIVE, PENDING_APPROVAL or INACTIVE.","type":"string"},"phone":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxId":{"description":"GSTIN in India; the country's tax number elsewhere.","anyOf":[{"type":"string"},{"type":"null"}]},"pan":{"anyOf":[{"type":"string"},{"type":"null"}]},"contactPerson":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"shipping":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"creditLimit":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"paymentTerms":{"anyOf":[{"type":"string"},{"type":"null"}]},"dueDays":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"outstanding":{"description":"Unpaid on their confirmed invoices.","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","status","phone","email","taxId","pan","contactPerson","country","billing","shipping","creditLimit","paymentTerms","dueDays","outstanding","pendingApproval","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"},"patch":{"operationId":"invoice.customers.update","summary":"Change a customer","description":"Only the fields sent change. With approval levels on Customers: edit, the change waits (202).","tags":["ZiloInvoice"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"status":{"description":"ACTIVE, PENDING_APPROVAL or INACTIVE.","type":"string"},"phone":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxId":{"description":"GSTIN in India; the country's tax number elsewhere.","anyOf":[{"type":"string"},{"type":"null"}]},"pan":{"anyOf":[{"type":"string"},{"type":"null"}]},"contactPerson":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"billing":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"shipping":{"type":"object","properties":{"line":{"anyOf":[{"type":"string"},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"stateCode":{"anyOf":[{"type":"string"},{"type":"null"}]},"postalCode":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["line","city","state","stateCode","postalCode"],"additionalProperties":false},"creditLimit":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"paymentTerms":{"anyOf":[{"type":"string"},{"type":"null"}]},"dueDays":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"outstanding":{"description":"Unpaid on their confirmed invoices.","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","status","phone","email","taxId","pan","contactPerson","country","billing","shipping","creditLimit","paymentTerms","dueDays","outstanding","pendingApproval","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.write"]},{"token":[]}],"x-scope":"invoice.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"code":{"description":"Default: the next number in the Customers series.","type":"string","maxLength":40},"phone":{"description":"10 digits in India; with the country code elsewhere.","type":"string","minLength":1,"maxLength":30},"email":{"type":"string","maxLength":254},"taxId":{"type":"string","maxLength":30},"pan":{"type":"string","maxLength":10},"contactPerson":{"type":"string","maxLength":120},"country":{"description":"ISO country code; default the company's.","type":"string","maxLength":2},"billingAddress":{"type":"string","maxLength":500},"billingCity":{"type":"string","maxLength":100},"billingState":{"type":"string","maxLength":100},"billingStateCode":{"type":"string","maxLength":10},"billingPostalCode":{"type":"string","maxLength":12},"shippingAddress":{"type":"string","maxLength":500},"shippingCity":{"type":"string","maxLength":100},"shippingState":{"type":"string","maxLength":100},"shippingStateCode":{"type":"string","maxLength":10},"shippingPostalCode":{"type":"string","maxLength":12},"creditLimit":{"type":"number","minimum":0},"paymentTerms":{"type":"string","enum":["DUE_ON_RECEIPT","NET_15","NET_30","NET_45","NET_60","ADVANCE"]},"dueDays":{"type":"integer","minimum":0,"maximum":3650}}}}}}}},"/v1/invoice/products":{"get":{"operationId":"invoice.products.list","summary":"List products and services","tags":["ZiloInvoice"],"parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","enum":["goods","services"]}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["goods","services"]},"status":{"type":"string"},"barcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"hsn":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"taxPercent":{"type":"number"}},"required":["id","code","taxPercent"],"additionalProperties":false},{"type":"null"}]},"rate":{"description":"Sale rate before tax.","type":"string"},"rateWithTax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"purchaseRate":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","kind","status","barcode","brand","unit","category","hsn","rate","rateWithTax","purchaseRate","pendingApproval","createdAt","updatedAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"},"post":{"operationId":"invoice.products.create","summary":"Add a product or service","tags":["ZiloInvoice"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["goods","services"]},"status":{"type":"string"},"barcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"hsn":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"taxPercent":{"type":"number"}},"required":["id","code","taxPercent"],"additionalProperties":false},{"type":"null"}]},"rate":{"description":"Sale rate before tax.","type":"string"},"rateWithTax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"purchaseRate":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","kind","status","barcode","brand","unit","category","hsn","rate","rateWithTax","purchaseRate","pendingApproval","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.write"]},{"token":[]}],"x-scope":"invoice.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"default":"goods","type":"string","enum":["goods","services"]},"code":{"type":"string","maxLength":40},"barcode":{"type":"string","maxLength":60},"brand":{"type":"string","maxLength":80},"unitId":{"description":"Its base unit (GET /v1/invoice/units).","type":"string","maxLength":64},"categoryId":{"type":"string","maxLength":64},"hsnId":{"description":"Its HSN/SAC code (decides the tax).","type":"string","maxLength":64},"rate":{"description":"Sale rate before tax.","type":"number","minimum":0},"purchaseRate":{"type":"number","minimum":0}},"required":["name","unitId","rate"]},"example":{"name":"Tea 250 g","unitId":"<unit id>","rate":120,"hsnId":"<hsn id>"}}}}}},"/v1/invoice/products/{id}":{"get":{"operationId":"invoice.products.get","summary":"Get a product","tags":["ZiloInvoice"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["goods","services"]},"status":{"type":"string"},"barcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"hsn":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"taxPercent":{"type":"number"}},"required":["id","code","taxPercent"],"additionalProperties":false},{"type":"null"}]},"rate":{"description":"Sale rate before tax.","type":"string"},"rateWithTax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"purchaseRate":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","kind","status","barcode","brand","unit","category","hsn","rate","rateWithTax","purchaseRate","pendingApproval","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"},"patch":{"operationId":"invoice.products.update","summary":"Change a product","description":"Only the fields sent change; its other units, tracking and reorder levels stay as they are.","tags":["ZiloInvoice"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string","enum":["goods","services"]},"status":{"type":"string"},"barcode":{"anyOf":[{"type":"string"},{"type":"null"}]},"brand":{"anyOf":[{"type":"string"},{"type":"null"}]},"unit":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"category":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},{"type":"null"}]},"hsn":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"taxPercent":{"type":"number"}},"required":["id","code","taxPercent"],"additionalProperties":false},{"type":"null"}]},"rate":{"description":"Sale rate before tax.","type":"string"},"rateWithTax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"purchaseRate":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","kind","status","barcode","brand","unit","category","hsn","rate","rateWithTax","purchaseRate","pendingApproval","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.write"]},{"token":[]}],"x-scope":"invoice.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"kind":{"default":"goods","type":"string","enum":["goods","services"]},"code":{"type":"string","maxLength":40},"barcode":{"type":"string","maxLength":60},"brand":{"type":"string","maxLength":80},"unitId":{"description":"Its base unit (GET /v1/invoice/units).","type":"string","maxLength":64},"categoryId":{"type":"string","maxLength":64},"hsnId":{"description":"Its HSN/SAC code (decides the tax).","type":"string","maxLength":64},"rate":{"description":"Sale rate before tax.","type":"number","minimum":0},"purchaseRate":{"type":"number","minimum":0}}}}}}}},"/v1/invoice/invoices":{"get":{"operationId":"invoice.invoices.list","summary":"List sales invoices","description":"Newest first, within the person's branches and territory.","tags":["ZiloInvoice"],"parameters":[{"name":"customer","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"status","in":"query","required":false,"schema":{"type":"string","maxLength":30}},{"name":"from","in":"query","required":false,"description":"A calendar date, YYYY-MM-DD.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"description":"A calendar date, YYYY-MM-DD.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"unpaid","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"description":"DRAFT, CONFIRMED, PENDING_APPROVAL or CANCELLED.","type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"],"additionalProperties":false},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"branchId":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"subtotal":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"discount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"tax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"total":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"paid":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"balance":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"lines":{"description":"On GET /v1/invoice/invoices/{id}.","type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"product":{"type":"string"},"unit":{"type":"string"},"quantity":{"type":"number"},"rate":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"discountPercent":{"type":"number"},"taxPercent":{"type":"number"},"tax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"total":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"}},"required":["productId","product","unit","quantity","rate","discountPercent","taxPercent","tax","total"],"additionalProperties":false}},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","status","customer","date","dueDate","branchId","currency","subtotal","discount","tax","total","paid","balance","pendingApproval","createdAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"},"post":{"operationId":"invoice.invoices.create","summary":"Make a sales invoice","description":"Taxed from the branch's state and the customer's place of supply, numbered in the branch's series, stock taken out and the books posted, exactly as the invoice form does. Draft invoices don't move stock or the books. With approval levels on Sales invoices: create, it answers 202 and waits.","tags":["ZiloInvoice"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"description":"DRAFT, CONFIRMED, PENDING_APPROVAL or CANCELLED.","type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"],"additionalProperties":false},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"branchId":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"subtotal":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"discount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"tax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"total":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"paid":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"balance":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"lines":{"description":"On GET /v1/invoice/invoices/{id}.","type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"product":{"type":"string"},"unit":{"type":"string"},"quantity":{"type":"number"},"rate":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"discountPercent":{"type":"number"},"taxPercent":{"type":"number"},"tax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"total":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"}},"required":["productId","product","unit","quantity","rate","discountPercent","taxPercent","tax","total"],"additionalProperties":false}},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","status","customer","date","dueDate","branchId","currency","subtotal","discount","tax","total","paid","balance","pendingApproval","createdAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.write"]},{"token":[]}],"x-scope":"invoice.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string"},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"description":"Default: the date plus the customer's due days (as the invoice form sets it).","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"number":{"description":"Default: the next in the branch's series.","type":"string","maxLength":40},"branchId":{"description":"Default: the person's first branch (the head office first), as the invoice form preselects.","type":"string"},"warehouseId":{"description":"Where the goods leave from; default: found per line.","type":"string"},"status":{"default":"CONFIRMED","type":"string","enum":["DRAFT","CONFIRMED"]},"lines":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"quantity":{"type":"number","exclusiveMinimum":0},"rate":{"description":"Before tax; default the product's rate.","type":"number","minimum":0},"unitId":{"description":"Default: the product's base unit.","type":"string"},"discountPercent":{"type":"number","minimum":0,"maximum":100},"warehouseId":{"type":"string"}},"required":["productId","quantity"]}}},"required":["customerId","date","lines"]},"example":{"customerId":"<customer id>","date":"2026-10-17","lines":[{"productId":"<product id>","quantity":12}]}}}}}},"/v1/invoice/invoices/{id}":{"get":{"operationId":"invoice.invoices.get","summary":"Get an invoice","description":"With its lines.","tags":["ZiloInvoice"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"status":{"description":"DRAFT, CONFIRMED, PENDING_APPROVAL or CANCELLED.","type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"}},"required":["id","code","name"],"additionalProperties":false},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"dueDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"branchId":{"anyOf":[{"type":"string"},{"type":"null"}]},"currency":{"type":"string"},"subtotal":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"discount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"tax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"total":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"paid":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"balance":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"lines":{"description":"On GET /v1/invoice/invoices/{id}.","type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"product":{"type":"string"},"unit":{"type":"string"},"quantity":{"type":"number"},"rate":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"discountPercent":{"type":"number"},"taxPercent":{"type":"number"},"tax":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"total":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"}},"required":["productId","product","unit","quantity","rate","discountPercent","taxPercent","tax","total"],"additionalProperties":false}},"pendingApproval":{"description":"A change of it waiting for approval.","anyOf":[{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]}},"required":["id","status"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","status","customer","date","dueDate","branchId","currency","subtotal","discount","tax","total","paid","balance","pendingApproval","createdAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"}},"/v1/invoice/receipts":{"get":{"operationId":"invoice.receipts.list","summary":"List receipts","tags":["ZiloInvoice"],"parameters":[{"name":"customer","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"from","in":"query","required":false,"description":"A calendar date, YYYY-MM-DD.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":false,"description":"A calendar date, YYYY-MM-DD.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"currency":{"type":"string"},"mode":{"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"account":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"allocations":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"number":{"type":"string"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"}},"required":["invoiceId","number","amount"],"additionalProperties":false}},"status":{"type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","customer","date","amount","currency","mode","reference","account","allocations","status","createdAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"},"post":{"operationId":"invoice.receipts.create","summary":"Record a receipt","description":"Money received from a customer, set against their invoices (or kept as an advance). Posted to the books under the right branch.","tags":["ZiloInvoice"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"customer":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"currency":{"type":"string"},"mode":{"type":"string"},"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"account":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false},"allocations":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"number":{"type":"string"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"}},"required":["invoiceId","number","amount"],"additionalProperties":false}},"status":{"type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","customer","date","amount","currency","mode","reference","account","allocations","status","createdAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.write"]},{"token":[]}],"x-scope":"invoice.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string"},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"amount":{"type":"number","exclusiveMinimum":0},"accountId":{"description":"The cash or bank account it went into (GET /v1/invoice/accounts).","type":"string"},"mode":{"default":"BANK_TRANSFER","type":"string","enum":["CASH","BANK_TRANSFER","CHEQUE","UPI","CARD","OTHER"]},"reference":{"type":"string","maxLength":80},"notes":{"type":"string","maxLength":500},"allocations":{"description":"Settle these invoices; default: none (an advance).","maxItems":200,"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"amount":{"type":"number","exclusiveMinimum":0}},"required":["invoiceId","amount"]}}},"required":["customerId","date","amount","accountId"]},"example":{"customerId":"<customer id>","date":"2026-10-17","amount":5000,"accountId":"<account id>","mode":"UPI","reference":"UTR 4410020931","allocations":[{"invoiceId":"<invoice id>","amount":5000}]}}}}}},"/v1/invoice/units":{"get":{"operationId":"invoice.units.list","summary":"Units","description":"Units of measure (a product's unitId).","tags":["ZiloInvoice"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","code"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"}},"/v1/invoice/tax-codes":{"get":{"operationId":"invoice.hsn.list","summary":"HSN/SAC codes","description":"A product's hsnId: the code and its tax.","tags":["ZiloInvoice"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"kind":{"type":"string"},"taxPercent":{"type":"number"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","code","kind","taxPercent","description"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"}},"/v1/invoice/accounts":{"get":{"operationId":"invoice.accounts.list","summary":"Cash and bank accounts","description":"Where receipts go (a receipt's accountId).","tags":["ZiloInvoice"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"kind":{"type":"string"},"branchId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","kind","branchId"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"}},"/v1/invoice/branches":{"get":{"operationId":"invoice.branches.list","summary":"Branches","description":"The organisation's branches (GST registrations) the person works in.","tags":["ZiloInvoice"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"taxId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","name","state","taxId"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["invoice.read"]},{"token":[]}],"x-scope":"invoice.read"}},"/v1/inventory/warehouses":{"get":{"operationId":"inventory.warehouses.list","summary":"Warehouses","description":"The warehouses the person works in.","tags":["ZiloInventory"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"},"branchId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","code","name","branchId"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["inventory.read"]},{"token":[]}],"x-scope":"inventory.read"}},"/v1/inventory/stock":{"get":{"operationId":"inventory.stock.list","summary":"Stock on hand","description":"Quantities in base units, per product and warehouse (only the person's warehouses). Give `product` (one or more ids) for just those.","tags":["ZiloInventory"],"parameters":[{"name":"product","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},{"name":"warehouse","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"productId":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"unit":{"type":"string"},"warehouseId":{"type":"string"},"warehouse":{"type":"string"},"quantity":{"type":"number"}},"required":["productId","code","name","unit","warehouseId","warehouse","quantity"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["inventory.read"]},{"token":[]}],"x-scope":"inventory.read"}},"/v1/hr/employees":{"get":{"operationId":"hr.employees.list","summary":"List employees","description":"Needs the person's role to allow Employees: view.","tags":["ZiloHR"],"parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"status","in":"query","required":false,"schema":{"type":"string","maxLength":20}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"description":"The employee id (e.g. EMP-0001).","type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"designation":{"anyOf":[{"type":"string"},{"type":"null"}]},"department":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"joinedOn":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"managerId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","code","name","email","phone","designation","department","status","joinedOn","managerId"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.read"]},{"token":[]}],"x-scope":"hr.read"}},"/v1/hr/employees/{id}":{"get":{"operationId":"hr.employees.get","summary":"Get an employee","description":"By id or employee code, or `me`. Anyone may read their own record (as in the ESS app); others need Employees: view.","tags":["ZiloHR"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"code":{"description":"The employee id (e.g. EMP-0001).","type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"designation":{"anyOf":[{"type":"string"},{"type":"null"}]},"department":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"type":"string"},"joinedOn":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"managerId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","code","name","email","phone","designation","department","status","joinedOn","managerId"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.read"]},{"token":[]}],"x-scope":"hr.read"}},"/v1/hr/attendance":{"get":{"operationId":"hr.attendance.list","summary":"Attendance","description":"Days from `from` to `to` (at most 62). Without `employee`, the person's own; others need Attendance: view.","tags":["ZiloHR"],"parameters":[{"name":"from","in":"query","required":true,"description":"A calendar date, YYYY-MM-DD.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"to","in":"query","required":true,"description":"A calendar date, YYYY-MM-DD.","schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},{"name":"employee","in":"query","required":false,"schema":{"type":"string","maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"employeeId":{"type":"string"},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"status":{"description":"PRESENT, ABSENT, HALF_DAY, LEAVE, HOLIDAY, WEEKLY_OFF…","type":"string"},"source":{"type":"string"},"checkIn":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"checkOut":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["employeeId","date","status","source","checkIn","checkOut","notes"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.read"]},{"token":[]}],"x-scope":"hr.read"}},"/v1/hr/attendance/check-in":{"post":{"operationId":"hr.attendance.check-in","summary":"Check in","description":"The person checks in now (their own attendance, as in the ESS app); location optional.","tags":["ZiloHR"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string"},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"status":{"description":"PRESENT, ABSENT, HALF_DAY, LEAVE, HOLIDAY, WEEKLY_OFF…","type":"string"},"source":{"type":"string"},"checkIn":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"checkOut":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["employeeId","date","status","source","checkIn","checkOut","notes"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.attendance"]},{"token":[]}],"x-scope":"hr.attendance","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lng":{"type":"number","minimum":-180,"maximum":180}}}}}}}},"/v1/hr/attendance/check-out":{"post":{"operationId":"hr.attendance.check-out","summary":"Check out","tags":["ZiloHR"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"employeeId":{"type":"string"},"date":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"status":{"description":"PRESENT, ABSENT, HALF_DAY, LEAVE, HOLIDAY, WEEKLY_OFF…","type":"string"},"source":{"type":"string"},"checkIn":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"checkOut":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["employeeId","date","status","source","checkIn","checkOut","notes"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.attendance"]},{"token":[]}],"x-scope":"hr.attendance","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lng":{"type":"number","minimum":-180,"maximum":180}}}}}}}},"/v1/hr/leave/types":{"get":{"operationId":"hr.leave-types.list","summary":"Leave types","description":"With the person's balance for this year.","tags":["ZiloHR"],"parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"paid":{"type":"boolean"},"halfDay":{"type":"boolean"},"available":{"description":"Days left; null: no limit.","anyOf":[{"type":"number"},{"type":"null"}]}},"required":["id","name","paid","halfDay","available"],"additionalProperties":false}}},"required":["data"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.read"]},{"token":[]}],"x-scope":"hr.read"}},"/v1/hr/leave":{"get":{"operationId":"hr.leave.list","summary":"Leave requests","description":"The person's own requests, newest first.","tags":["ZiloHR"],"parameters":[{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"employeeId":{"type":"string"},"type":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"paid":{"type":"boolean"}},"required":["id","name","paid"],"additionalProperties":false},"from":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"halfDay":{"type":"boolean"},"days":{"type":"number"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"description":"PENDING_APPROVAL, APPROVED, REJECTED or CANCELLED.","type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","employeeId","type","from","to","halfDay","days","reason","status","createdAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.read"]},{"token":[]}],"x-scope":"hr.read"},"post":{"operationId":"hr.leave.create","summary":"Apply for leave","description":"For the person themselves. It goes to their approvers like any request; working days only are counted.","tags":["ZiloHR"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"employeeId":{"type":"string"},"type":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"paid":{"type":"boolean"}},"required":["id","name","paid"],"additionalProperties":false},"from":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"halfDay":{"type":"boolean"},"days":{"type":"number"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"description":"PENDING_APPROVAL, APPROVED, REJECTED or CANCELLED.","type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","employeeId","type","from","to","halfDay","days","reason","status","createdAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["hr.leave"]},{"token":[]}],"x-scope":"hr.leave","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"typeId":{"type":"string"},"from":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"description":"Default: the same day.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"halfDay":{"default":false,"type":"boolean"},"reason":{"type":"string","maxLength":500}},"required":["typeId","from"]}}}}}},"/v1/crm/leads":{"get":{"operationId":"crm.leads.list","summary":"List leads","description":"Newest first; the person's territory decides which.","tags":["ZiloCRM"],"parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"stage","in":"query","required":false,"schema":{"type":"string","maxLength":30}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"contactName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string"},"stage":{"description":"NEW, CONTACTED, QUALIFIED, PROPOSAL, WON or LOST.","type":"string"},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedValue":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"nextFollowUp":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"customerId":{"description":"Set once it became a customer.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","contactName","phone","email","source","stage","lostReason","expectedValue","expectedCloseDate","nextFollowUp","owner","city","state","country","notes","customerId","createdAt","updatedAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.read"]},{"token":[]}],"x-scope":"crm.read"},"post":{"operationId":"crm.leads.create","summary":"Add a lead","tags":["ZiloCRM"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"contactName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string"},"stage":{"description":"NEW, CONTACTED, QUALIFIED, PROPOSAL, WON or LOST.","type":"string"},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedValue":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"nextFollowUp":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"customerId":{"description":"Set once it became a customer.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","contactName","phone","email","source","stage","lostReason","expectedValue","expectedCloseDate","nextFollowUp","owner","city","state","country","notes","customerId","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.write"]},{"token":[]}],"x-scope":"crm.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"contactName":{"type":"string","maxLength":120},"phone":{"type":"string","maxLength":30},"email":{"type":"string","maxLength":254},"source":{"description":"WEB, REFERRAL, WALK_IN, CALL, CAMPAIGN, EXHIBITION or OTHER.","type":"string","maxLength":30},"stage":{"type":"string","maxLength":30},"lostReason":{"type":"string","maxLength":500},"expectedValue":{"type":"number","minimum":0},"expectedCloseDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"nextFollowUp":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"owner":{"description":"A colleague: their ZiloOne user id or email address.","type":"string","maxLength":320},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"country":{"type":"string","maxLength":2},"address":{"type":"string","maxLength":500},"notes":{"type":"string","maxLength":4000}},"required":["name"]},"example":{"name":"Sharma Stores","contactName":"Anil Sharma","phone":"+91 98640 11223","source":"WEB","expectedValue":45000,"nextFollowUp":"2026-10-20"}}}}}},"/v1/crm/leads/{id}":{"get":{"operationId":"crm.leads.get","summary":"Get a lead","tags":["ZiloCRM"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"contactName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string"},"stage":{"description":"NEW, CONTACTED, QUALIFIED, PROPOSAL, WON or LOST.","type":"string"},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedValue":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"nextFollowUp":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"customerId":{"description":"Set once it became a customer.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","contactName","phone","email","source","stage","lostReason","expectedValue","expectedCloseDate","nextFollowUp","owner","city","state","country","notes","customerId","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.read"]},{"token":[]}],"x-scope":"crm.read"},"patch":{"operationId":"crm.leads.update","summary":"Change a lead","description":"Only the fields sent change (moving `stage` to LOST needs `lostReason`).","tags":["ZiloCRM"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"contactName":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"string"},"stage":{"description":"NEW, CONTACTED, QUALIFIED, PROPOSAL, WON or LOST.","type":"string"},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"expectedValue":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"nextFollowUp":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"city":{"anyOf":[{"type":"string"},{"type":"null"}]},"state":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]},"notes":{"anyOf":[{"type":"string"},{"type":"null"}]},"customerId":{"description":"Set once it became a customer.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","contactName","phone","email","source","stage","lostReason","expectedValue","expectedCloseDate","nextFollowUp","owner","city","state","country","notes","customerId","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.write"]},{"token":[]}],"x-scope":"crm.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"contactName":{"type":"string","maxLength":120},"phone":{"type":"string","maxLength":30},"email":{"type":"string","maxLength":254},"source":{"description":"WEB, REFERRAL, WALK_IN, CALL, CAMPAIGN, EXHIBITION or OTHER.","type":"string","maxLength":30},"stage":{"type":"string","maxLength":30},"lostReason":{"type":"string","maxLength":500},"expectedValue":{"type":"number","minimum":0},"expectedCloseDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"nextFollowUp":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"owner":{"description":"A colleague: their ZiloOne user id or email address.","type":"string","maxLength":320},"city":{"type":"string","maxLength":100},"state":{"type":"string","maxLength":100},"country":{"type":"string","maxLength":2},"address":{"type":"string","maxLength":500},"notes":{"type":"string","maxLength":4000}}}}}}}},"/v1/crm/leads/{id}/activities":{"post":{"operationId":"crm.activities.create","summary":"Log an activity","description":"A call, meeting, email or task on a lead. A planned one (not done, with `due`) becomes the lead's next follow-up.","tags":["ZiloCRM"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"ok":{"type":"boolean","const":true}},"required":["ok"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.write"]},{"token":[]}],"x-scope":"crm.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"type":"string","enum":["CALL","MEETING","VISIT","EMAIL","NOTE","TASK"]},"subject":{"type":"string","minLength":1,"maxLength":200},"details":{"type":"string","maxLength":4000},"due":{"description":"ISO date or date and time.","type":"string"},"done":{"default":false,"type":"boolean"}},"required":["type","subject"]}}}}}},"/v1/crm/deals":{"get":{"operationId":"crm.deals.list","summary":"List deals","tags":["ZiloCRM"],"parameters":[{"name":"stage","in":"query","required":false,"schema":{"type":"string","maxLength":30}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"stage":{"description":"QUALIFY, PROPOSAL, NEGOTIATION, WON or LOST.","type":"string"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"accountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"leadId":{"anyOf":[{"type":"string"},{"type":"null"}]},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","stage","amount","probability","source","expectedCloseDate","owner","accountId","leadId","lostReason","createdAt","updatedAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.read"]},{"token":[]}],"x-scope":"crm.read"},"post":{"operationId":"crm.deals.create","summary":"Add a deal","tags":["ZiloCRM"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"stage":{"description":"QUALIFY, PROPOSAL, NEGOTIATION, WON or LOST.","type":"string"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"accountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"leadId":{"anyOf":[{"type":"string"},{"type":"null"}]},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","stage","amount","probability","source","expectedCloseDate","owner","accountId","leadId","lostReason","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.write"]},{"token":[]}],"x-scope":"crm.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"stage":{"type":"string","maxLength":30},"amount":{"type":"number","minimum":0},"probability":{"type":"integer","minimum":0,"maximum":100},"source":{"type":"string","maxLength":30},"expectedCloseDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"owner":{"description":"A colleague: their ZiloOne user id or email address.","type":"string","maxLength":320},"accountId":{"type":"string"},"lostReason":{"type":"string","maxLength":500}},"required":["name"]}}}}}},"/v1/crm/deals/{id}":{"get":{"operationId":"crm.deals.get","summary":"Get a deal","tags":["ZiloCRM"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"stage":{"description":"QUALIFY, PROPOSAL, NEGOTIATION, WON or LOST.","type":"string"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"accountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"leadId":{"anyOf":[{"type":"string"},{"type":"null"}]},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","stage","amount","probability","source","expectedCloseDate","owner","accountId","leadId","lostReason","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.read"]},{"token":[]}],"x-scope":"crm.read"},"patch":{"operationId":"crm.deals.update","summary":"Change a deal","description":"Only the fields sent change; its lines stay.","tags":["ZiloCRM"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"stage":{"description":"QUALIFY, PROPOSAL, NEGOTIATION, WON or LOST.","type":"string"},"amount":{"description":"An amount as a string with its decimals, e.g. \"1250.50\" (never a float).","type":"string"},"probability":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"source":{"type":"string"},"expectedCloseDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"owner":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"accountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"leadId":{"anyOf":[{"type":"string"},{"type":"null"}]},"lostReason":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","stage","amount","probability","source","expectedCloseDate","owner","accountId","leadId","lostReason","createdAt","updatedAt"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"description":"Why it was rejected.","anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}},"required":["status","message","approval"],"additionalProperties":false}]}}}},"202":{"description":"Waiting for approval: nothing changes until it's approved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PendingApproval"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["crm.write"]},{"token":[]}],"x-scope":"crm.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":160},"stage":{"type":"string","maxLength":30},"amount":{"type":"number","minimum":0},"probability":{"type":"integer","minimum":0,"maximum":100},"source":{"type":"string","maxLength":30},"expectedCloseDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"owner":{"description":"A colleague: their ZiloOne user id or email address.","type":"string","maxLength":320},"accountId":{"type":"string"},"lostReason":{"type":"string","maxLength":500}}}}}}}},"/v1/projects/projects":{"get":{"operationId":"projects.projects.list","summary":"List projects","tags":["ZiloProjects"],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","maxLength":30}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"code":{"type":"string"},"name":{"type":"string"},"status":{"type":"string"},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"manager":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"startDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"endDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","code","name","status","customerId","manager","startDate","endDate","createdAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["projects.read"]},{"token":[]}],"x-scope":"projects.read"}},"/v1/projects/tasks":{"get":{"operationId":"projects.tasks.list","summary":"List tasks","description":"`mine=true`: given to the person. Open first by due date.","tags":["ZiloProjects"],"parameters":[{"name":"project","in":"query","required":false,"schema":{"type":"string","maxLength":64}},{"name":"mine","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","maxLength":30}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"description":"TODO, IN_PROGRESS, REVIEW, DONE…","type":"string"},"priority":{"description":"LOW, NORMAL, HIGH or URGENT.","type":"string"},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"dueDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","title","description","status","priority","projectId","assignee","dueDate","completedAt","createdAt","updatedAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["projects.read"]},{"token":[]}],"x-scope":"projects.read"},"post":{"operationId":"projects.tasks.create","summary":"Add a task","description":"The assignee is told (the bell in every app).","tags":["ZiloProjects"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"description":"TODO, IN_PROGRESS, REVIEW, DONE…","type":"string"},"priority":{"description":"LOW, NORMAL, HIGH or URGENT.","type":"string"},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"dueDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","title","description","status","priority","projectId","assignee","dueDate","completedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["projects.write"]},{"token":[]}],"x-scope":"projects.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"description":{"type":"string","maxLength":8000},"projectId":{"type":"string"},"assignee":{"description":"Default: the person themselves when there's no project.","type":"string","maxLength":320},"dueDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"status":{"type":"string","maxLength":30}},"required":["title"]},"example":{"title":"Call Sharma Stores about the order","dueDate":"2026-10-21","priority":"HIGH"}}}}}},"/v1/projects/tasks/{id}":{"get":{"operationId":"projects.tasks.get","summary":"Get a task","tags":["ZiloProjects"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"description":"TODO, IN_PROGRESS, REVIEW, DONE…","type":"string"},"priority":{"description":"LOW, NORMAL, HIGH or URGENT.","type":"string"},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"dueDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","title","description","status","priority","projectId","assignee","dueDate","completedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["projects.read"]},{"token":[]}],"x-scope":"projects.read"},"patch":{"operationId":"projects.tasks.update","summary":"Change a task","description":"Its assignee may change its status; other changes need Tasks: edit.","tags":["ZiloProjects"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"title":{"type":"string"},"description":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"description":"TODO, IN_PROGRESS, REVIEW, DONE…","type":"string"},"priority":{"description":"LOW, NORMAL, HIGH or URGENT.","type":"string"},"projectId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"dueDate":{"anyOf":[{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"completedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"updatedAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","number","title","description","status","priority","projectId","assignee","dueDate","completedAt","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["projects.write"]},{"token":[]}],"x-scope":"projects.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":300},"description":{"type":"string","maxLength":8000},"projectId":{"type":"string"},"assignee":{"description":"Default: the person themselves when there's no project.","type":"string","maxLength":320},"dueDate":{"description":"A calendar date, YYYY-MM-DD.","type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"status":{"type":"string","maxLength":30}}}}}}}},"/v1/desk/tickets":{"get":{"operationId":"desk.tickets.list","summary":"List tickets","description":"Latest activity first.","tags":["ZiloDesk"],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","maxLength":30}},{"name":"mine","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200}},{"name":"limit","in":"query","required":false,"description":"How many to return (1–200).","schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"description":"The `next` value from the previous page.","schema":{"type":"string","maxLength":500}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"subject":{"type":"string"},"status":{"description":"NEW, OPEN, PENDING, RESOLVED or CLOSED.","type":"string"},"priority":{"type":"string"},"requester":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"channel":{"type":"string"},"firstResponseDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"resolveDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"lastMessageAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"messages":{"description":"On GET /v1/desk/tickets/{id}.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["CUSTOMER","AGENT","NOTE"]},{"type":"string"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"at":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","kind","from","text","at"],"additionalProperties":false}}},"required":["id","number","subject","status","priority","requester","customerId","assignee","tags","channel","firstResponseDue","resolveDue","lastMessageAt","createdAt"],"additionalProperties":false}},"next":{"description":"Pass as `cursor` for the next page; null on the last.","anyOf":[{"type":"string"},{"type":"null"}]}},"required":["data","next"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["desk.read"]},{"token":[]}],"x-scope":"desk.read"},"post":{"operationId":"desk.tickets.create","summary":"Open a ticket","description":"A request that didn't come by mail (a call, a visit, your own form).","tags":["ZiloDesk"],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"subject":{"type":"string"},"status":{"description":"NEW, OPEN, PENDING, RESOLVED or CLOSED.","type":"string"},"priority":{"type":"string"},"requester":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"channel":{"type":"string"},"firstResponseDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"resolveDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"lastMessageAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"messages":{"description":"On GET /v1/desk/tickets/{id}.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["CUSTOMER","AGENT","NOTE"]},{"type":"string"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"at":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","kind","from","text","at"],"additionalProperties":false}}},"required":["id","number","subject","status","priority","requester","customerId","assignee","tags","channel","firstResponseDue","resolveDue","lastMessageAt","createdAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["desk.write"]},{"token":[]}],"x-scope":"desk.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string","minLength":1,"maxLength":300},"email":{"description":"The customer's email: replies go there.","type":"string","maxLength":254},"name":{"type":"string","maxLength":120},"body":{"type":"string","minLength":1,"maxLength":20000},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"assignToMe":{"default":false,"type":"boolean"}},"required":["subject","email","body"]}}}}}},"/v1/desk/tickets/{id}":{"get":{"operationId":"desk.tickets.get","summary":"Get a ticket","description":"With its conversation (notes included).","tags":["ZiloDesk"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"subject":{"type":"string"},"status":{"description":"NEW, OPEN, PENDING, RESOLVED or CLOSED.","type":"string"},"priority":{"type":"string"},"requester":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"channel":{"type":"string"},"firstResponseDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"resolveDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"lastMessageAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"messages":{"description":"On GET /v1/desk/tickets/{id}.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["CUSTOMER","AGENT","NOTE"]},{"type":"string"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"at":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","kind","from","text","at"],"additionalProperties":false}}},"required":["id","number","subject","status","priority","requester","customerId","assignee","tags","channel","firstResponseDue","resolveDue","lastMessageAt","createdAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["desk.read"]},{"token":[]}],"x-scope":"desk.read"},"patch":{"operationId":"desk.tickets.update","summary":"Change a ticket","tags":["ZiloDesk"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"subject":{"type":"string"},"status":{"description":"NEW, OPEN, PENDING, RESOLVED or CLOSED.","type":"string"},"priority":{"type":"string"},"requester":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"channel":{"type":"string"},"firstResponseDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"resolveDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"lastMessageAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"messages":{"description":"On GET /v1/desk/tickets/{id}.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["CUSTOMER","AGENT","NOTE"]},{"type":"string"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"at":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","kind","from","text","at"],"additionalProperties":false}}},"required":["id","number","subject","status","priority","requester","customerId","assignee","tags","channel","firstResponseDue","resolveDue","lastMessageAt","createdAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["desk.write"]},{"token":[]}],"x-scope":"desk.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","maxLength":20},"priority":{"type":"string","maxLength":20},"assignee":{"anyOf":[{"description":"A colleague: their ZiloOne user id or email address.","type":"string","maxLength":320},{"type":"null"}]},"tags":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":40}}}}}}}}},"/v1/desk/tickets/{id}/replies":{"post":{"operationId":"desk.tickets.reply","summary":"Reply","description":"Mailed to the customer from the support mailbox, in the ticket's thread. `note: true` keeps it inside the team.","tags":["ZiloDesk"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"number":{"type":"string"},"subject":{"type":"string"},"status":{"description":"NEW, OPEN, PENDING, RESOLVED or CLOSED.","type":"string"},"priority":{"type":"string"},"requester":{"type":"object","properties":{"email":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["email","name"],"additionalProperties":false},"customerId":{"anyOf":[{"type":"string"},{"type":"null"}]},"assignee":{"anyOf":[{"type":"object","properties":{"id":{"description":"Their ZiloOne user id.","anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"name":{"type":"string"}},"required":["id","email","name"],"additionalProperties":false},{"type":"null"}]},"tags":{"type":"array","items":{"type":"string"}},"channel":{"type":"string"},"firstResponseDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"resolveDue":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]},"lastMessageAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"messages":{"description":"On GET /v1/desk/tickets/{id}.","type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"anyOf":[{"type":"string","enum":["CUSTOMER","AGENT","NOTE"]},{"type":"string"}]},"from":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"at":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"}},"required":["id","kind","from","text","at"],"additionalProperties":false}}},"required":["id","number","subject","status","priority","requester","customerId","assignee","tags","channel","firstResponseDue","resolveDue","lastMessageAt","createdAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":["desk.write"]},{"token":[]}],"x-scope":"desk.write","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":20000},"note":{"default":false,"type":"boolean"},"status":{"description":"The ticket's status after a reply (default PENDING).","type":"string","enum":["OPEN","PENDING","RESOLVED","CLOSED"]}},"required":["body"]}}}}}},"/v1/approvals/{id}":{"get":{"operationId":"approvals.get","summary":"Get an approval","description":"Where a change that waits for approval stands. Only the person who asked (or their approvers) can see it. The approval.decided webhook says the same when it's decided.","tags":["Approvals"],"parameters":[{"name":"id","in":"path","required":true,"description":"An id this API gave out.","schema":{"type":"string","minLength":1,"maxLength":64}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["pending","approved","rejected"]},"module":{"type":"string"},"action":{"type":"string"},"recordId":{"anyOf":[{"type":"string"},{"type":"null"}]},"summary":{"anyOf":[{"type":"string"},{"type":"null"}]},"currentLevel":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"levels":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},"decidedAt":{"anyOf":[{"description":"ISO 8601 date and time, UTC, e.g. 2026-10-17T09:30:00.000Z.","type":"string"},{"type":"null"}]}},"required":["id","status","module","action","recordId","summary","currentLevel","levels","reason","createdAt","decidedAt"],"additionalProperties":false}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"security":[{"ziloOne":[]},{"token":[]}]}}},"components":{"securitySchemes":{"ziloOne":{"type":"oauth2","description":"Sign in with ZiloOne (authorization code with PKCE). Apps with API permissions get rotating refresh tokens.","flows":{"authorizationCode":{"authorizationUrl":"https://accounts.zilomail.in/oidc/auth","tokenUrl":"https://accounts.zilomail.in/oidc/token","refreshUrl":"https://accounts.zilomail.in/oidc/token","scopes":{"offline_access":"Stay connected (refresh tokens).","mail.read":"ZiloMail: Read mail. Mailboxes, folders, messages, attachments and what changed.","mail.write":"ZiloMail: Organise mail. Mark read or starred, move, delete, folders and drafts.","mail.send":"ZiloMail: Send mail. Send email and check delivery status.","calendar.read":"Calendar: Read calendar. Events in their calendar.","calendar.write":"Calendar: Manage calendar. Add, change and remove events (guests are invited by mail).","contacts.read":"Contacts: Read contacts. Their address book.","contacts.write":"Contacts: Manage contacts. Add, change and remove contacts.","drive.read":"ZiloDrive: Read ZiloDrive. List, search and download files and folders.","drive.write":"ZiloDrive: Write ZiloDrive. Upload files (virus-scanned), make folders, rename, move and move to Trash.","users.read":"People: Read people. The organisation's people: names, addresses, job titles.","users.write":"People: Manage people. Add people (with a mailbox on your own domain) and turn them off or on. Organisation keys only.","invoice.read":"ZiloInvoice: Read sales. Customers, products, invoices and receipts.","invoice.write":"ZiloInvoice: Record sales. Add and change customers and products, make invoices, record receipts.","inventory.read":"ZiloInventory: Read stock. Warehouses and stock on hand.","hr.read":"ZiloHR: Read HR. Employees, attendance and leave.","hr.attendance":"ZiloHR: Mark attendance. Mark attendance and record check-in / check-out.","hr.leave":"ZiloHR: Ask for leave. Apply for leave (it goes through the usual approvals).","crm.read":"ZiloCRM: Read CRM. Leads, deals and activities.","crm.write":"ZiloCRM: Manage CRM. Add and change leads and deals, log activities.","projects.read":"ZiloProjects: Read projects. Projects and tasks.","projects.write":"ZiloProjects: Manage tasks. Add and change tasks.","desk.read":"ZiloDesk: Read tickets. Support tickets and their conversations.","desk.write":"ZiloDesk: Work on tickets. Open tickets, reply, change status, priority and who has them."}}}},"token":{"type":"http","scheme":"bearer","description":"A personal token (zo_pat_…) or an organisation key (zm_live_…); it acts as the person it names."}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry safely: the same key within 24 hours gets the first answer again.","schema":{"type":"string","maxLength":200}},"IfMatch":{"name":"If-Match","in":"header","required":false,"description":"The ETag you read: refused with 412 if it changed since.","schema":{"type":"string"}}},"responses":{"Error":{"description":"An error (see the code list).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error","requestId"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string","enum":["invalid_request","invalid_json","unauthorized","token_expired","insufficient_scope","forbidden","api_disabled","app_not_allowed","ip_not_allowed","not_found","method_not_allowed","conflict","cursor_expired","precondition_failed","payload_too_large","unsupported_media_type","unprocessable","rate_limited","internal_error","unavailable"]},"message":{"type":"string"},"details":{"type":"object"}}},"requestId":{"type":"string"}}},"PendingApproval":{"type":"object","required":["status","approval"],"properties":{"status":{"const":"pending_approval"},"message":{"type":"string"},"approval":{"type":"object","properties":{"id":{"type":"string"},"status":{"enum":["pending","approved","rejected"]},"module":{"type":"string"},"recordId":{"type":["string","null"]},"summary":{"type":["string","null"]}}}}}}},"x-rate-limits":{"perMinute":600,"writesPerMinute":120,"organisationPerMinute":3000}}