{"components":{"schemas":{"AccountItem":{"properties":{"auth_type":{"description":"Authentication type","title":"Auth Type","type":"string"},"email":{"description":"Email address","title":"Email","type":"string"},"id":{"description":"Account ID","title":"Id","type":"integer"}},"required":["id","email","auth_type"],"title":"AccountItem","type":"object"},"AccountListResponse":{"properties":{"data":{"description":"List of accounts","items":{"$ref":"#/components/schemas/AccountItem"},"title":"Data","type":"array"}},"required":["data"],"title":"AccountListResponse","type":"object"},"BulkDeleteBody":{"properties":{"items":{"description":"Array of {message_id}","items":{"additionalProperties":true,"type":"object"},"title":"Items","type":"array"}},"required":["items"],"title":"BulkDeleteBody","type":"object"},"BulkDeleteContactsBody":{"properties":{"items":{"description":"Array of {contact_id}","items":{"additionalProperties":true,"type":"object"},"title":"Items","type":"array"}},"required":["items"],"title":"BulkDeleteContactsBody","type":"object"},"BulkFlagBody":{"properties":{"items":{"description":"Array of {message_id, flags{read?, flagged?}}","items":{"additionalProperties":true,"type":"object"},"title":"Items","type":"array"}},"required":["items"],"title":"BulkFlagBody","type":"object"},"BulkMoveBody":{"properties":{"destination":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Alias for folder_id","title":"Destination"},"folder_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Destination folder","title":"Folder Id"},"items":{"description":"Array of {message_id}","items":{"additionalProperties":true,"type":"object"},"title":"Items","type":"array"}},"required":["items"],"title":"BulkMoveBody","type":"object"},"BulkResponse":{"properties":{"failed":{"description":"Failed items with error details","items":{},"title":"Failed","type":"array"},"succeeded":{"description":"Successfully processed items","items":{},"title":"Succeeded","type":"array"}},"title":"BulkResponse","type":"object"},"BusyEntry":{"properties":{"calendar_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Calendar ID of the conflicting event","title":"Calendar Id"},"end":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Busy period end (ISO 8601)","title":"End"},"start":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Busy period start (ISO 8601)","title":"Start"},"summary":{"default":"","description":"Event summary during the busy period","title":"Summary","type":"string"}},"title":"BusyEntry","type":"object"},"CalendarItem":{"properties":{"color":{"default":"#4285f4","description":"Hex color code","title":"Color","type":"string"},"id":{"description":"Unique calendar ID","title":"Id","type":"integer"},"is_default":{"default":false,"description":"Whether this is the default calendar","title":"Is Default","type":"boolean"},"name":{"default":"","description":"Calendar display name","title":"Name","type":"string"},"uid":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"CalDAV calendar UID","title":"Uid"}},"required":["id"],"title":"CalendarItem","type":"object"},"CalendarListResponse":{"properties":{"data":{"description":"List of calendars","items":{"$ref":"#/components/schemas/CalendarItem"},"title":"Data","type":"array"}},"required":["data"],"title":"CalendarListResponse","type":"object"},"ContactDetail":{"properties":{"email_home":{"default":"","description":"Home email address","title":"Email Home","type":"string"},"email_work":{"default":"","description":"Work email address","title":"Email Work","type":"string"},"fn":{"default":"","description":"Formatted name","title":"Fn","type":"string"},"id":{"description":"Unique contact ID","title":"Id","type":"integer"},"note":{"default":"","description":"Free-form note","title":"Note","type":"string"},"organization":{"default":"","description":"Organization name","title":"Organization","type":"string"},"phone_cell":{"default":"","description":"Mobile phone number","title":"Phone Cell","type":"string"},"phone_home":{"default":"","description":"Home phone number","title":"Phone Home","type":"string"},"phone_work":{"default":"","description":"Work phone number","title":"Phone Work","type":"string"},"title":{"default":"","description":"Job title","title":"Title","type":"string"},"uid":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"vCard UID","title":"Uid"},"vcard_raw":{"default":"","description":"Raw vCard source","title":"Vcard Raw","type":"string"}},"required":["id"],"title":"ContactDetail","type":"object"},"ContactDetailResponse":{"properties":{"data":{"$ref":"#/components/schemas/ContactDetail","description":"Contact details"}},"required":["data"],"title":"ContactDetailResponse","type":"object"},"ContactItem":{"properties":{"email_home":{"default":"","description":"Home email address","title":"Email Home","type":"string"},"email_work":{"default":"","description":"Work email address","title":"Email Work","type":"string"},"fn":{"default":"","description":"Formatted name","title":"Fn","type":"string"},"id":{"description":"Unique contact ID","title":"Id","type":"integer"},"note":{"default":"","description":"Free-form note","title":"Note","type":"string"},"organization":{"default":"","description":"Organization name","title":"Organization","type":"string"},"phone_cell":{"default":"","description":"Mobile phone number","title":"Phone Cell","type":"string"},"phone_home":{"default":"","description":"Home phone number","title":"Phone Home","type":"string"},"phone_work":{"default":"","description":"Work phone number","title":"Phone Work","type":"string"},"title":{"default":"","description":"Job title","title":"Title","type":"string"},"uid":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"vCard UID","title":"Uid"}},"required":["id"],"title":"ContactItem","type":"object"},"ContactListResponse":{"properties":{"data":{"description":"List of contacts","items":{"$ref":"#/components/schemas/ContactItem"},"title":"Data","type":"array"},"pagination":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Pagination metadata (next_cursor, has_more)","title":"Pagination"}},"required":["data"],"title":"ContactListResponse","type":"object"},"ContactSearchResponse":{"properties":{"data":{"description":"Search results","items":{"$ref":"#/components/schemas/ContactSearchResultItem"},"title":"Data","type":"array"}},"required":["data"],"title":"ContactSearchResponse","type":"object"},"ContactSearchResultItem":{"properties":{"email":{"description":"Primary email address","title":"Email","type":"string"},"name":{"description":"Contact display name","title":"Name","type":"string"}},"required":["name","email"],"title":"ContactSearchResultItem","type":"object"},"ContentResponse":{"properties":{"data":{"additionalProperties":true,"description":"Document content and format","title":"Data","type":"object"}},"required":["data"],"title":"ContentResponse","type":"object"},"ConvertResponse":{"properties":{"data":{"$ref":"#/components/schemas/DocumentItem","description":"Converted document"}},"required":["data"],"title":"ConvertResponse","type":"object"},"CreateCalendarBody":{"properties":{"color":{"default":"#4285f4","description":"Hex color code","title":"Color","type":"string"},"name":{"description":"Calendar display name","title":"Name","type":"string"}},"required":["name"],"title":"CreateCalendarBody","type":"object"},"CreateContactBody":{"properties":{"email_home":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Home email address","title":"Email Home"},"email_work":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Work email address","title":"Email Work"},"fn":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Formatted name","title":"Fn"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Free-form note","title":"Note"},"organization":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Organization name","title":"Organization"},"phone_cell":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Mobile phone number","title":"Phone Cell"},"phone_home":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Home phone number","title":"Phone Home"},"phone_work":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Work phone number","title":"Phone Work"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Job title","title":"Title"}},"title":"CreateContactBody","type":"object"},"CreateDocumentBody":{"properties":{"folder":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Folder path to create the document in (empty/omitted = root)","title":"Folder"},"name":{"default":"Untitled Document","description":"Document name","title":"Name","type":"string"},"type":{"default":"odt","description":"Document type: odt, ods, or odp","title":"Type","type":"string"}},"title":"CreateDocumentBody","type":"object"},"CreateDraftBody":{"properties":{"content":{"default":"","description":"Draft content","title":"Content","type":"string"},"format":{"default":"markdown","description":"Content format","title":"Format","type":"string"},"summary":{"default":"AI modification","description":"Change description","title":"Summary","type":"string"}},"title":"CreateDraftBody","type":"object"},"CreateEventBody":{"properties":{"attendees":{"description":"Attendee list with email and optional name","items":{"additionalProperties":true,"type":"object"},"title":"Attendees","type":"array"},"calendar_id":{"description":"Calendar to create event in","title":"Calendar Id","type":"integer"},"description":{"default":"","description":"Event description","title":"Description","type":"string"},"end":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"End datetime (ISO 8601)","title":"End"},"is_all_day":{"default":false,"description":"Whether this is an all-day event","title":"Is All Day","type":"boolean"},"location":{"default":"","description":"Event location","title":"Location","type":"string"},"recurrence":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"RRULE string","title":"Recurrence"},"reminders":{"description":"Reminders (type + trigger_minutes)","items":{"additionalProperties":true,"type":"object"},"title":"Reminders","type":"array"},"start":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Start datetime (ISO 8601)","title":"Start"},"summary":{"description":"Event title","title":"Summary","type":"string"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"IANA timezone (e.g. America/New_York)","title":"Timezone"}},"required":["summary","calendar_id"],"title":"CreateEventBody","type":"object"},"CreateFolderBody":{"properties":{"name":{"description":"Folder name (leaf segment)","title":"Name","type":"string"},"parent":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Parent folder path (empty/omitted = top-level)","title":"Parent"}},"required":["name"],"title":"CreateFolderBody","type":"object"},"DeleteCalendarBody":{"properties":{"confirm":{"description":"Must be true to confirm deletion","title":"Confirm","type":"boolean"}},"required":["confirm"],"title":"DeleteCalendarBody","type":"object"},"DeleteFolderBody":{"properties":{"path":{"description":"Folder path to delete (contents move to parent)","title":"Path","type":"string"}},"required":["path"],"title":"DeleteFolderBody","type":"object"},"DocumentDetailResponse":{"properties":{"data":{"$ref":"#/components/schemas/DocumentItem","description":"Document details"}},"required":["data"],"title":"DocumentDetailResponse","type":"object"},"DocumentItem":{"properties":{"created_at":{"default":"","description":"Creation timestamp (ISO 8601)","title":"Created At","type":"string"},"folder_path":{"default":"","description":"Slash-separated folder path relative to account root (empty string = root)","title":"Folder Path","type":"string"},"id":{"description":"Document UUID","title":"Id","type":"string"},"name":{"default":"","description":"Document name","title":"Name","type":"string"},"size":{"default":0,"description":"File size in bytes","title":"Size","type":"integer"},"tags":{"description":"Document tags","items":{"type":"string"},"title":"Tags","type":"array"},"type":{"default":"","description":"Document type: odt, ods, or odp","title":"Type","type":"string"},"updated_at":{"default":"","description":"Last update timestamp (ISO 8601)","title":"Updated At","type":"string"}},"required":["id"],"title":"DocumentItem","type":"object"},"DocumentListResponse":{"properties":{"data":{"description":"List of documents","items":{"$ref":"#/components/schemas/DocumentItem"},"title":"Data","type":"array"},"pagination":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Pagination metadata (next_cursor, has_more)","title":"Pagination"}},"required":["data"],"title":"DocumentListResponse","type":"object"},"DraftItem":{"properties":{"created_at":{"default":"","description":"Creation timestamp (ISO 8601)","title":"Created At","type":"string"},"folder_path":{"default":"","description":"Slash-separated folder path relative to account root (empty string = root)","title":"Folder Path","type":"string"},"id":{"description":"Document UUID","title":"Id","type":"string"},"name":{"default":"","description":"Document name","title":"Name","type":"string"},"size":{"default":0,"description":"File size in bytes","title":"Size","type":"integer"},"source_document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"UUID of the source document this draft was created from","title":"Source Document Id"},"summary":{"default":"","description":"Human-readable description of draft changes","title":"Summary","type":"string"},"tags":{"description":"Document tags","items":{"type":"string"},"title":"Tags","type":"array"},"type":{"default":"","description":"Document type: odt, ods, or odp","title":"Type","type":"string"},"updated_at":{"default":"","description":"Last update timestamp (ISO 8601)","title":"Updated At","type":"string"}},"required":["id"],"title":"DraftItem","type":"object"},"DraftListResponse":{"properties":{"data":{"description":"List of drafts","items":{"$ref":"#/components/schemas/DraftItem"},"title":"Data","type":"array"}},"required":["data"],"title":"DraftListResponse","type":"object"},"EmptyResponse":{"properties":{},"title":"EmptyResponse","type":"object"},"ErrorDetail":{"properties":{"code":{"description":"Machine-readable error code","title":"Code","type":"string"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Optional field-level errors","title":"Details"},"message":{"description":"Human-readable error description","title":"Message","type":"string"}},"required":["code","message"],"title":"ErrorDetail","type":"object"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ErrorDetail","description":"Error details"}},"required":["error"],"title":"ErrorResponse","type":"object"},"EventDetailResponse":{"properties":{"data":{"$ref":"#/components/schemas/EventItem","description":"Event details"}},"required":["data"],"title":"EventDetailResponse","type":"object"},"EventItem":{"properties":{"calendar_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Calendar ID this event belongs to","title":"Calendar Id"},"description":{"default":"","description":"Event description","title":"Description","type":"string"},"end":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"End datetime (ISO 8601)","title":"End"},"id":{"description":"Unique event ID","title":"Id","type":"integer"},"is_all_day":{"default":false,"description":"Whether this is an all-day event","title":"Is All Day","type":"boolean"},"location":{"default":"","description":"Event location","title":"Location","type":"string"},"start":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Start datetime (ISO 8601)","title":"Start"},"status":{"default":"","description":"Event status (e.g. CONFIRMED, TENTATIVE, CANCELLED)","title":"Status","type":"string"},"summary":{"default":"","description":"Event title","title":"Summary","type":"string"},"uid":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"CalDAV event UID","title":"Uid"}},"required":["id"],"title":"EventItem","type":"object"},"EventListResponse":{"properties":{"data":{"description":"List of events","items":{"$ref":"#/components/schemas/EventItem"},"title":"Data","type":"array"},"pagination":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Pagination metadata (next_cursor, has_more)","title":"Pagination"}},"required":["data"],"title":"EventListResponse","type":"object"},"FolderItem":{"properties":{"count":{"default":0,"description":"Number of documents directly in this folder","title":"Count","type":"integer"},"name":{"description":"Leaf folder name","title":"Name","type":"string"},"parent":{"default":"","description":"Parent folder path (empty for top-level)","title":"Parent","type":"string"},"path":{"description":"Full slash-separated folder path","title":"Path","type":"string"}},"required":["path","name"],"title":"FolderItem","type":"object"},"FolderListResponse":{"properties":{"data":{"description":"Folders","items":{"$ref":"#/components/schemas/FolderItem"},"title":"Data","type":"array"}},"required":["data"],"title":"FolderListResponse","type":"object"},"FolderMutationResponse":{"properties":{"data":{"additionalProperties":true,"description":"Result of the folder operation","title":"Data","type":"object"}},"required":["data"],"title":"FolderMutationResponse","type":"object"},"FreeBusyBody":{"properties":{"account_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"},"calendar_ids":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"default":null,"description":"Specific calendar IDs to check (defaults to all)","title":"Calendar Ids"},"end":{"description":"Range end (ISO 8601)","title":"End","type":"string"},"start":{"description":"Range start (ISO 8601)","title":"Start","type":"string"}},"required":["start","end"],"title":"FreeBusyBody","type":"object"},"FreeBusyResponse":{"properties":{"data":{"description":"Busy time entries","items":{"$ref":"#/components/schemas/BusyEntry"},"title":"Data","type":"array"}},"required":["data"],"title":"FreeBusyResponse","type":"object"},"MessageDetail":{"properties":{"body_html":{"default":"","description":"HTML body","title":"Body Html","type":"string"},"body_plain":{"default":"","description":"Plain-text body","title":"Body Plain","type":"string"},"cc":{"default":"","description":"CC addresses (comma-separated)","title":"Cc","type":"string"},"date":{"default":"","description":"Message date (RFC 2822)","title":"Date","type":"string"},"flagged":{"default":false,"description":"Whether the message is flagged","title":"Flagged","type":"boolean"},"flags":{"default":"","description":"IMAP flags (JSON-encoded list)","title":"Flags","type":"string"},"folder":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Folder containing the message","title":"Folder"},"from":{"default":"","description":"Sender address","title":"From","type":"string"},"id":{"description":"Unique message ID","title":"Id","type":"integer"},"snippet":{"default":"","description":"Short preview of the message body","title":"Snippet","type":"string"},"subject":{"default":"","description":"Email subject line","title":"Subject","type":"string"},"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Conversation thread ID","title":"Thread Id"},"to":{"default":"","description":"Recipient addresses (comma-separated)","title":"To","type":"string"},"unread":{"default":false,"description":"Whether the message is unread","title":"Unread","type":"boolean"}},"required":["id"],"title":"MessageDetail","type":"object"},"MessageDetailResponse":{"properties":{"data":{"$ref":"#/components/schemas/MessageDetail","description":"Message details"}},"required":["data"],"title":"MessageDetailResponse","type":"object"},"MessageItem":{"properties":{"cc":{"default":"","description":"CC addresses (comma-separated)","title":"Cc","type":"string"},"date":{"default":"","description":"Message date (RFC 2822)","title":"Date","type":"string"},"flagged":{"default":false,"description":"Whether the message is flagged","title":"Flagged","type":"boolean"},"flags":{"default":"","description":"IMAP flags (JSON-encoded list)","title":"Flags","type":"string"},"folder":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Folder containing the message","title":"Folder"},"from":{"default":"","description":"Sender address","title":"From","type":"string"},"id":{"description":"Unique message ID","title":"Id","type":"integer"},"snippet":{"default":"","description":"Short preview of the message body","title":"Snippet","type":"string"},"subject":{"default":"","description":"Email subject line","title":"Subject","type":"string"},"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Conversation thread ID","title":"Thread Id"},"to":{"default":"","description":"Recipient addresses (comma-separated)","title":"To","type":"string"},"unread":{"default":false,"description":"Whether the message is unread","title":"Unread","type":"boolean"}},"required":["id"],"title":"MessageItem","type":"object"},"MessageListResponse":{"properties":{"data":{"description":"List of messages","items":{"$ref":"#/components/schemas/MessageItem"},"title":"Data","type":"array"},"pagination":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"Pagination metadata (next_cursor, has_more)","title":"Pagination"}},"required":["data"],"title":"MessageListResponse","type":"object"},"MoveDocumentBody":{"properties":{"folder":{"default":"","description":"Target folder path (empty string = root)","title":"Folder","type":"string"}},"title":"MoveDocumentBody","type":"object"},"MoveMessageBody":{"properties":{"destination":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Alias for folder_id","title":"Destination"},"folder_id":{"description":"Destination folder name","title":"Folder Id","type":"string"}},"required":["folder_id"],"title":"MoveMessageBody","type":"object"},"RenameDocumentBody":{"properties":{"name":{"description":"New document name","title":"Name","type":"string"}},"required":["name"],"title":"RenameDocumentBody","type":"object"},"RenameFolderBody":{"properties":{"name":{"description":"New leaf folder name","title":"Name","type":"string"},"path":{"description":"Existing folder path to rename","title":"Path","type":"string"}},"required":["path","name"],"title":"RenameFolderBody","type":"object"},"SendMessageBody":{"properties":{"bcc":{"description":"BCC address(es)","items":{"type":"string"},"title":"Bcc","type":"array"},"body_html":{"default":"","description":"HTML body","title":"Body Html","type":"string"},"body_plain":{"default":"","description":"Plain-text body","title":"Body Plain","type":"string"},"cc":{"description":"CC address(es)","items":{"type":"string"},"title":"Cc","type":"array"},"draft_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Draft UID to delete after send","title":"Draft Id"},"draft_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Alias for draft_id","title":"Draft Uid"},"subject":{"default":"","description":"Email subject line","title":"Subject","type":"string"},"to":{"description":"Recipient address(es)","items":{"type":"string"},"title":"To","type":"array"}},"title":"SendMessageBody","type":"object"},"TagListResponse":{"properties":{"data":{"description":"Distinct tags in use across the account (sorted, case-insensitive)","items":{"type":"string"},"title":"Data","type":"array"}},"required":["data"],"title":"TagListResponse","type":"object"},"TagsResponse":{"properties":{"data":{"additionalProperties":true,"description":"Document tags","title":"Data","type":"object"}},"required":["data"],"title":"TagsResponse","type":"object"},"TokenItem":{"properties":{"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Creation timestamp (ISO 8601)","title":"Created At"},"id":{"description":"Token ID","title":"Id","type":"integer"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Last usage timestamp (ISO 8601)","title":"Last Used At"},"name":{"description":"Human-readable token name","title":"Name","type":"string"},"scopes":{"description":"Authorized scopes (e.g. mail:read, contacts:write)","items":{"type":"string"},"title":"Scopes","type":"array"}},"required":["id","name","scopes"],"title":"TokenItem","type":"object"},"TokenListResponse":{"properties":{"data":{"description":"List of API tokens","items":{"$ref":"#/components/schemas/TokenItem"},"title":"Data","type":"array"}},"required":["data"],"title":"TokenListResponse","type":"object"},"UpdateCalendarBody":{"properties":{"color":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Hex color code","title":"Color"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Calendar display name","title":"Name"}},"title":"UpdateCalendarBody","type":"object"},"UpdateContactBody":{"properties":{"email_home":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Home email address","title":"Email Home"},"email_work":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Work email address","title":"Email Work"},"fn":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Formatted name","title":"Fn"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Free-form note","title":"Note"},"organization":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Organization name","title":"Organization"},"phone_cell":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Mobile phone number","title":"Phone Cell"},"phone_home":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Home phone number","title":"Phone Home"},"phone_work":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Work phone number","title":"Phone Work"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Job title","title":"Title"}},"title":"UpdateContactBody","type":"object"},"UpdateEventBody":{"properties":{"attendees":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Attendee list with email and optional name","title":"Attendees"},"calendar_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Calendar ID to move event to","title":"Calendar Id"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Event description","title":"Description"},"end":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"End datetime (ISO 8601)","title":"End"},"is_all_day":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":null,"description":"Whether this is an all-day event","title":"Is All Day"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Event location","title":"Location"},"recurrence":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"RRULE string","title":"Recurrence"},"reminders":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"default":null,"description":"Reminders (type + trigger_minutes)","title":"Reminders"},"start":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Start datetime (ISO 8601)","title":"Start"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Event title","title":"Summary"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"IANA timezone (e.g. America/New_York)","title":"Timezone"}},"title":"UpdateEventBody","type":"object"},"UpdateFlagsBody":{"properties":{"flags":{"additionalProperties":{"type":"boolean"},"description":"Flags to update, e.g. {\"read\": true, \"flagged\": false, \"locked\": true}","title":"Flags","type":"object"}},"required":["flags"],"title":"UpdateFlagsBody","type":"object"},"UpdateTagsBody":{"properties":{"add":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Tags to add","title":"Add"},"remove":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Tags to remove","title":"Remove"},"set":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"default":null,"description":"Replace the full tag list with this list (takes precedence over add/remove)","title":"Set"}},"title":"UpdateTagsBody","type":"object"},"ValidationErrorModel":{"properties":{"ctx":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"default":null,"description":"An optional object which contains values required to render the error message.","title":"Error context"},"input":{"description":"The input provided for validation.","title":"Input"},"loc":{"description":"The error's location as a list.","items":{},"title":"Location","type":"array"},"msg":{"description":"A human readable explanation of the error.","title":"Message","type":"string"},"type":{"description":"A computer-readable identifier of the error type.","title":"Error Type","type":"string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"The URL to further information about the error.","title":"URL"}},"required":["type","loc","msg","input"],"title":"ValidationErrorModel","type":"object"}},"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT or API key (lr_...)","description":"Bearer token authentication. Use an API key (lr_...) or OAuth 2.1 JWT.","scheme":"bearer","type":"http"}}},"info":{"description":"REST API for LocoRoomail \u2014 mail, contacts, calendar, and docs.","title":"LocoRoomail API","version":"1.0.0"},"openapi":"3.1.0","paths":{"/v1/accounts":{"get":{"description":"Returns all active mail accounts for the authenticated customer.","operationId":"accounts_list_accounts_accounts_get","parameters":[{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List accounts","tags":["accounts"]}},"/v1/calendar/calendars":{"get":{"description":"Returns all calendars for the authenticated account. Requires `calendar:read` scope.","operationId":"calendar_api_list_calendars_calendar_calendars_get","parameters":[{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List calendars","tags":["calendar"]},"post":{"description":"Creates a new calendar via CalDAV and caches it locally. Requires `calendar:write` scope.","operationId":"calendar_api_create_calendar_calendar_calendars_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCalendarBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarListResponse"}}},"description":"Created"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create calendar","tags":["calendar"]}},"/v1/calendar/calendars/{calendar_id}":{"delete":{"description":"Deletes a calendar by ID from the local cache. Confirmation body `{\"confirm\": true}` is required. Requires `calendar:write` scope.","operationId":"calendar_api_delete_calendar_calendar_calendars__int_calendar_id__delete","parameters":[{"description":"Calendar ID","in":"path","name":"calendar_id","required":true,"schema":{"description":"Calendar ID","title":"Calendar Id","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteCalendarBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete calendar","tags":["calendar"]},"put":{"description":"Updates a calendar's display name and/or color. Changes are synced to CalDAV. Requires `calendar:write` scope.","operationId":"calendar_api_update_calendar_calendar_calendars__int_calendar_id__put","parameters":[{"description":"Calendar ID","in":"path","name":"calendar_id","required":true,"schema":{"description":"Calendar ID","title":"Calendar Id","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCalendarBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update calendar","tags":["calendar"]}},"/v1/calendar/calendars/{calendar_id}/events":{"get":{"description":"Returns events for a specific calendar, optionally filtered by date range. Requires `calendar:read` scope.","operationId":"calendar_api_list_events_calendar_calendars__int_calendar_id__events_get","parameters":[{"description":"Calendar ID","in":"path","name":"calendar_id","required":true,"schema":{"description":"Calendar ID","title":"Calendar Id","type":"integer"}},{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Maximum results (1-200)","in":"query","name":"max_results","required":false,"schema":{"default":50,"description":"Maximum results (1-200)","maximum":200,"minimum":1.0,"title":"Max Results","type":"integer"}},{"description":"Start of date range (ISO 8601)","in":"query","name":"since","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Start of date range (ISO 8601)","title":"Since"}},{"description":"End of date range (ISO 8601)","in":"query","name":"until","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"End of date range (ISO 8601)","title":"Until"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List calendar events","tags":["calendar"]}},"/v1/calendar/events":{"post":{"description":"Creates a new calendar event via CalDAV and caches it locally. Supports attendees, reminders, and recurrence rules. Requires `calendar:write` scope.","operationId":"calendar_api_create_event_calendar_events_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateEventBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventDetailResponse"}}},"description":"Created"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create event","tags":["calendar"]}},"/v1/calendar/events/{event_id}":{"delete":{"description":"Deletes an event from both the CalDAV server and the local cache. Requires `calendar:write` scope.","operationId":"calendar_api_delete_event_calendar_events__int_event_id__delete","parameters":[{"description":"Event ID","in":"path","name":"event_id","required":true,"schema":{"description":"Event ID","title":"Event Id","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete event","tags":["calendar"]},"get":{"description":"Returns a single calendar event by ID. Requires `calendar:read` scope.","operationId":"calendar_api_get_event_calendar_events__int_event_id__get","parameters":[{"description":"Event ID","in":"path","name":"event_id","required":true,"schema":{"description":"Event ID","title":"Event Id","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get event detail","tags":["calendar"]},"put":{"description":"Updates an existing event by merging provided fields with existing iCalendar data. Only non-null fields are updated. Changes are synced via CalDAV. Requires `calendar:write` scope.","operationId":"calendar_api_update_event_calendar_events__int_event_id__put","parameters":[{"description":"Event ID","in":"path","name":"event_id","required":true,"schema":{"description":"Event ID","title":"Event Id","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateEventBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update event","tags":["calendar"]}},"/v1/calendar/free-busy":{"post":{"description":"Returns busy time slots within a date range. Optionally filter by specific calendar IDs. Requires `calendar:read` scope.","operationId":"calendar_api_free_busy_calendar_free_busy_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreeBusyBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FreeBusyResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Check free/busy","tags":["calendar"]}},"/v1/calendar/search":{"get":{"description":"Full-text search across all calendar events. Returns matching events sorted by relevance. Requires `calendar:read` scope.","operationId":"calendar_api_search_events_calendar_search_get","parameters":[{"description":"Search query","in":"query","name":"q","required":true,"schema":{"description":"Search query","title":"Q","type":"string"}},{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Maximum results (1-200)","in":"query","name":"max_results","required":false,"schema":{"default":50,"description":"Maximum results (1-200)","maximum":200,"minimum":1.0,"title":"Max Results","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Search events","tags":["calendar"]}},"/v1/contacts":{"get":{"description":"Returns paginated contacts for the authenticated account. Supports optional search filtering and page-based pagination. Requires `contacts:read` scope.","operationId":"contacts_api_list_contacts_contacts_get","parameters":[{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Maximum results (1-200)","in":"query","name":"max_results","required":false,"schema":{"default":50,"description":"Maximum results (1-200)","maximum":200,"minimum":1.0,"title":"Max Results","type":"integer"}},{"description":"Page number (1-based)","in":"query","name":"page","required":false,"schema":{"default":1,"description":"Page number (1-based)","minimum":1.0,"title":"Page","type":"integer"}},{"description":"Search filter","in":"query","name":"q","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Search filter","title":"Q"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List contacts","tags":["contacts"]},"post":{"description":"Creates a new contact via CardDAV and caches it locally. At least a formatted name (fn) or work email is required. Requires `contacts:write` scope.","operationId":"contacts_api_create_contact_contacts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateContactBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactDetailResponse"}}},"description":"Created"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create contact","tags":["contacts"]}},"/v1/contacts/bulk/delete":{"post":{"description":"Permanently deletes up to 100 contacts by ID from both the CardDAV server and the local cache. Requires `contacts:write` scope.","operationId":"contacts_api_bulk_delete_contacts_contacts_bulk_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDeleteContactsBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk delete contacts","tags":["contacts"]}},"/v1/contacts/search":{"get":{"description":"Searches contacts by name, email, or phone number. Returns simplified results with name and primary email. Requires `contacts:read` scope.","operationId":"contacts_api_search_contacts_contacts_search_get","parameters":[{"description":"Search query (name, email, or phone)","in":"query","name":"q","required":true,"schema":{"description":"Search query (name, email, or phone)","title":"Q","type":"string"}},{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Maximum results (1-200)","in":"query","name":"max_results","required":false,"schema":{"default":50,"description":"Maximum results (1-200)","maximum":200,"minimum":1.0,"title":"Max Results","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSearchResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Search contacts","tags":["contacts"]}},"/v1/contacts/{contact_id}":{"delete":{"description":"Permanently deletes a contact by ID from both the CardDAV server and the local cache. Requires `contacts:write` scope.","operationId":"contacts_api_delete_contact_contacts__int_contact_id__delete","parameters":[{"description":"Contact ID","in":"path","name":"contact_id","required":true,"schema":{"description":"Contact ID","title":"Contact Id","type":"integer"}}],"responses":{"204":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmptyResponse"}}},"description":"No Content"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete contact","tags":["contacts"]},"get":{"description":"Returns a single contact by ID, including the raw vCard source. Requires `contacts:read` scope.","operationId":"contacts_api_get_contact_contacts__int_contact_id__get","parameters":[{"description":"Contact ID","in":"path","name":"contact_id","required":true,"schema":{"description":"Contact ID","title":"Contact Id","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get contact detail","tags":["contacts"]},"put":{"description":"Updates an existing contact by merging provided fields with the existing vCard data, then syncs via CardDAV. Only non-null fields are updated. Requires `contacts:write` scope.","operationId":"contacts_api_update_contact_contacts__int_contact_id__put","parameters":[{"description":"Contact ID","in":"path","name":"contact_id","required":true,"schema":{"description":"Contact ID","title":"Contact Id","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateContactBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update contact","tags":["contacts"]}},"/v1/docs/documents":{"get":{"description":"Returns all active documents for the authenticated account. Requires `docs:read` scope.","operationId":"docs_api_list_documents_docs_documents_get","parameters":[{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Maximum results (1-200)","in":"query","name":"max_results","required":false,"schema":{"default":50,"description":"Maximum results (1-200)","maximum":200,"minimum":1.0,"title":"Max Results","type":"integer"}},{"description":"Filter to documents directly in this folder path (exact match)","in":"query","name":"folder","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter to documents directly in this folder path (exact match)","title":"Folder"}},{"description":"Filter to documents carrying this tag","in":"query","name":"tag","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter to documents carrying this tag","title":"Tag"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List documents","tags":["docs"]},"post":{"description":"Creates a new empty document from a template (odt, ods, or odp). Requires `docs:write` scope.","operationId":"docs_api_create_document_docs_documents_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDocumentBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"Created"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create document","tags":["docs"]}},"/v1/docs/documents/upload":{"post":{"description":"Uploads a file as a new document. Supports ODF, Office, PDF, and pandoc-compatible formats. Non-ODF files are converted to ODF automatically. Requires `docs:write` scope.","operationId":"docs_api_upload_document_docs_documents_upload_post","responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"Created"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Upload document","tags":["docs"]}},"/v1/docs/documents/{doc_id}":{"delete":{"description":"Soft-deletes a document by UUID. The document is moved to trash and can be restored. Requires `docs:write` scope.","operationId":"docs_api_delete_document_docs_documents__doc_id__delete","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"204":{"description":"No Content"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete document","tags":["docs"]},"get":{"description":"Returns metadata for a single active document by UUID. Requires `docs:read` scope.","operationId":"docs_api_get_active_document_docs_documents__doc_id__get","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get document detail","tags":["docs"]},"put":{"description":"Renames a document. The new name must be non-empty. Requires `docs:write` scope.","operationId":"docs_api_rename_document_docs_documents__doc_id__put","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameDocumentBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Rename document","tags":["docs"]}},"/v1/docs/documents/{doc_id}/content":{"get":{"description":"Extracts and returns the text content of a document. Supports text and markdown output formats. Requires `docs:read` scope.","operationId":"docs_api_read_content_docs_documents__doc_id__content_get","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}},{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Output format: text or markdown","in":"query","name":"format","required":false,"schema":{"default":"text","description":"Output format: text or markdown","title":"Format","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Read document content","tags":["docs"]},"put":{"description":"Replaces the content of a document. Accepts multipart file upload (ODF) or JSON with markdown/text content. Requires `docs:write` scope.","operationId":"docs_api_update_content_docs_documents__doc_id__content_put","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update document content","tags":["docs"]}},"/v1/docs/documents/{doc_id}/convert":{"post":{"description":"Converts a non-editable document (e.g. docx, pdf) to its editable ODF equivalent (odt, ods, odp). Creates a new document; the original is preserved. Requires `docs:write` scope.","operationId":"docs_api_convert_document_docs_documents__doc_id__convert_post","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConvertResponse"}}},"description":"Created"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Convert document to editable format","tags":["docs"]}},"/v1/docs/documents/{doc_id}/download":{"get":{"description":"Downloads the document file as a binary attachment. Requires `docs:read` scope.","operationId":"docs_api_download_document_docs_documents__doc_id__download_get","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Download document","tags":["docs"]}},"/v1/docs/documents/{doc_id}/download/pdf":{"get":{"description":"Converts a document to PDF and returns it as a download. Requires `docs:read` scope.","operationId":"docs_api_export_pdf_docs_documents__doc_id__download_pdf_get","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"200":{"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"},"502":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Gateway"}},"summary":"Export document as PDF","tags":["docs"]}},"/v1/docs/documents/{doc_id}/drafts":{"get":{"description":"Returns all AI draft documents for a source document. Drafts are identified by '(AI Draft)' in their name. Requires `docs:read` scope.","operationId":"docs_api_list_drafts_docs_documents__doc_id__drafts_get","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List drafts","tags":["docs"]},"post":{"description":"Creates an AI draft document from markdown or text content. The draft is stored as a separate document linked to the source. Requires `docs:write` scope.","operationId":"docs_api_create_draft_docs_documents__doc_id__drafts_post","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDraftBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"Created"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create draft","tags":["docs"]}},"/v1/docs/documents/{doc_id}/drafts/{draft_id}":{"delete":{"description":"Permanently deletes a draft document and its file. Requires `docs:write` scope.","operationId":"docs_api_discard_draft_docs_documents__doc_id__drafts__draft_id__delete","parameters":[{"description":"Source document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Source document UUID","title":"Doc Id","type":"string"}},{"description":"Draft document UUID","in":"path","name":"draft_id","required":true,"schema":{"description":"Draft document UUID","title":"Draft Id","type":"string"}}],"responses":{"204":{"description":"No Content"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Discard draft","tags":["docs"]}},"/v1/docs/documents/{doc_id}/drafts/{draft_id}/apply":{"post":{"description":"Replaces the source document content with the draft content, then deletes the draft. Requires `docs:write` scope.","operationId":"docs_api_apply_draft_docs_documents__doc_id__drafts__draft_id__apply_post","parameters":[{"description":"Source document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Source document UUID","title":"Doc Id","type":"string"}},{"description":"Draft document UUID","in":"path","name":"draft_id","required":true,"schema":{"description":"Draft document UUID","title":"Draft Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Apply draft","tags":["docs"]}},"/v1/docs/documents/{doc_id}/move":{"post":{"description":"Moves a document to a folder (empty/omitted folder = root). Requires `docs:write` scope.","operationId":"docs_api_move_document_docs_documents__doc_id__move_post","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveDocumentBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentDetailResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Move document","tags":["docs"]}},"/v1/docs/documents/{doc_id}/tags":{"get":{"description":"Returns the tags applied to a document. Requires `docs:read` scope.","operationId":"docs_api_get_tags_docs_documents__doc_id__tags_get","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get document tags","tags":["docs"]},"put":{"description":"Add and/or remove tags, or replace the full tag list with `set`. Each tag is max 50 chars. Requires `docs:write` scope.","operationId":"docs_api_update_tags_docs_documents__doc_id__tags_put","parameters":[{"description":"Document UUID","in":"path","name":"doc_id","required":true,"schema":{"description":"Document UUID","title":"Doc Id","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTagsBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update document tags","tags":["docs"]}},"/v1/docs/folders":{"get":{"description":"Returns the flat folder list (paths inferred from documents plus explicit empty folders). Requires `docs:read` scope.","operationId":"docs_api_list_folders_docs_folders_get","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List folders","tags":["docs"]},"post":{"description":"Creates a folder (and any missing ancestor segments). Idempotent: creating an existing path succeeds. Requires `docs:write` scope.","operationId":"docs_api_create_folder_docs_folders_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFolderBody"}}},"required":true},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderItem"}}},"description":"Created"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create folder","tags":["docs"]}},"/v1/docs/folders/delete":{"post":{"description":"Deletes a folder subtree. Contained documents are moved to the deleted folder's parent (flattened). Requires `docs:write` scope.","operationId":"docs_api_delete_folder_docs_folders_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteFolderBody"}}},"required":true},"responses":{"200":{"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete folder","tags":["docs"]}},"/v1/docs/folders/rename":{"post":{"description":"Renames a folder and its entire subtree, rewriting document folder paths. Requires `docs:write` scope.","operationId":"docs_api_rename_folder_docs_folders_rename_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameFolderBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderItem"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Rename folder","tags":["docs"]}},"/v1/docs/tags":{"get":{"description":"Returns the distinct tags in use across the account's active documents (sorted, case-insensitive). Requires `docs:read` scope.","operationId":"docs_api_list_tags_docs_tags_get","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List tags","tags":["docs"]}},"/v1/mail/bulk/delete":{"post":{"description":"Moves up to 100 messages to the Trash folder and removes them from the cache. Creates the Trash folder if it does not exist. Requires `mail:write` scope.","operationId":"mail_api_bulk_delete_mail_bulk_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkDeleteBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk delete messages","tags":["mail"]}},"/v1/mail/bulk/flag":{"post":{"description":"Updates read/flagged status for up to 100 messages in a single request. Changes are synced to the IMAP server. Requires `mail:write` scope.","operationId":"mail_api_bulk_flag_mail_bulk_flag_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkFlagBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk update message flags","tags":["mail"]}},"/v1/mail/bulk/move":{"post":{"description":"Moves up to 100 messages to a destination folder. Messages are moved via IMAP and expunged. Requires `mail:write` scope.","operationId":"mail_api_bulk_move_mail_bulk_move_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkMoveBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Bulk move messages","tags":["mail"]}},"/v1/mail/drafts":{"post":{"description":"Creates a new draft in the Drafts folder via IMAP. If a replace_uid is provided, the existing draft is deleted first. Requires `mail:write` scope.","operationId":"mail_api_mail_create_draft_mail_drafts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDraftBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create draft","tags":["mail"]}},"/v1/mail/drafts/{uid}":{"delete":{"description":"Deletes a draft from the Drafts folder by UID via IMAP. Requires `mail:write` scope.","operationId":"mail_api_mail_delete_draft_mail_drafts__uid__delete","parameters":[{"description":"Draft UID","in":"path","name":"uid","required":true,"schema":{"description":"Draft UID","title":"Uid","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete draft","tags":["mail"]}},"/v1/mail/folders":{"get":{"description":"Returns all mail folders for the authenticated account with unread message counts. Requires `mail:read` scope.","operationId":"mail_api_list_folders_mail_folders_get","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List mail folders","tags":["mail"]},"post":{"description":"Creates a new mail folder (IMAP CREATE). Idempotent: creating an existing mailbox returns success with created=false. An optional `parent` nests the folder using the server hierarchy delimiter. Requires `mail:write` scope.","operationId":"mail_api_create_folder_mail_folders_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFolderBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderMutationResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create mail folder","tags":["mail"]}},"/v1/mail/folders/{folder}":{"delete":{"description":"Deletes a mail folder (IMAP DELETE). System folders and folders the customer has marked protected cannot be deleted. Requires `mail:write` scope.","operationId":"mail_api_delete_folder_mail_folders__path_folder__delete","parameters":[{"description":"Folder name","in":"path","name":"folder","required":true,"schema":{"description":"Folder name","title":"Folder","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderMutationResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Conflict"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete mail folder","tags":["mail"]}},"/v1/mail/folders/{folder}/messages":{"get":{"description":"Returns paginated messages from the specified folder, newest first. Supports filtering by unread/flagged status and cursor-based pagination. Requires `mail:read` scope.","operationId":"mail_api_list_messages_mail_folders__path_folder__messages_get","parameters":[{"description":"Folder name","in":"path","name":"folder","required":true,"schema":{"description":"Folder name","title":"Folder","type":"string"}},{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Maximum results (1-200)","in":"query","name":"max_results","required":false,"schema":{"default":50,"description":"Maximum results (1-200)","maximum":200,"minimum":1.0,"title":"Max Results","type":"integer"}},{"description":"Pagination cursor (message ID)","in":"query","name":"cursor","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Pagination cursor (message ID)","title":"Cursor"}},{"description":"Filter: 'true' for unread only","in":"query","name":"unread","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter: 'true' for unread only","title":"Unread"}},{"description":"Filter: 'true' for flagged only","in":"query","name":"flagged","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Filter: 'true' for flagged only","title":"Flagged"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List messages in folder","tags":["mail"]}},"/v1/mail/folders/{folder}/rename":{"post":{"description":"Renames a mail folder (IMAP RENAME). System folders (INBOX, Sent, Drafts, Trash, Junk, Bookings) cannot be renamed. Requires `mail:write` scope.","operationId":"mail_api_rename_folder_mail_folders__path_folder__rename_post","parameters":[{"description":"Folder name","in":"path","name":"folder","required":true,"schema":{"description":"Folder name","title":"Folder","type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameFolderBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FolderMutationResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"409":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Conflict"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Rename mail folder","tags":["mail"]}},"/v1/mail/messages":{"post":{"description":"Sends an email via SMTP and stores a copy in the Sent folder. If a draft_id is provided, the corresponding draft is deleted after sending. At least one recipient and one body (plain or HTML) are required. Requires `mail:write` scope.","operationId":"mail_api_send_message_mail_messages_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Send message","tags":["mail"]}},"/v1/mail/messages/{message_id}":{"delete":{"description":"Moves a message to the Trash folder via IMAP and removes it from the cache. Creates the Trash folder if it does not exist. Requires `mail:write` scope.","operationId":"mail_api_delete_message_mail_messages__int_message_id__delete","parameters":[{"description":"Message ID","in":"path","name":"message_id","required":true,"schema":{"description":"Message ID","title":"Message Id","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Delete message","tags":["mail"]},"get":{"description":"Returns the full message including plain-text and HTML bodies. Optionally marks the message as read via IMAP. Requires `mail:read` scope.","operationId":"mail_api_get_message_mail_messages__int_message_id__get","parameters":[{"description":"Message ID","in":"path","name":"message_id","required":true,"schema":{"description":"Message ID","title":"Message Id","type":"integer"}},{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Set to 'true' to mark as read","in":"query","name":"mark_read","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"Set to 'true' to mark as read","title":"Mark Read"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get message detail","tags":["mail"]},"patch":{"description":"Updates read/flagged status of a message. Changes are synced to the IMAP server. Requires `mail:write` scope.","operationId":"mail_api_update_flags_mail_messages__int_message_id__patch","parameters":[{"description":"Message ID","in":"path","name":"message_id","required":true,"schema":{"description":"Message ID","title":"Message Id","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFlagsBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Update message flags","tags":["mail"]}},"/v1/mail/messages/{message_id}/attachments/{attachment_index}":{"get":{"description":"Downloads an attachment from a message by its zero-based index. Returns the file as a binary download with appropriate Content-Type and Content-Disposition headers. Requires `mail:read` scope.","operationId":"mail_api_download_attachment_mail_messages__int_message_id__attachments__int_attachment_index__get","parameters":[{"description":"Message ID","in":"path","name":"message_id","required":true,"schema":{"description":"Message ID","title":"Message Id","type":"integer"}},{"description":"Zero-based attachment index","in":"path","name":"attachment_index","required":true,"schema":{"description":"Zero-based attachment index","title":"Attachment Index","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Download attachment","tags":["mail"]}},"/v1/mail/messages/{message_id}/attachments/{attachment_index}/view":{"get":{"description":"Converts a message attachment to HTML for inline viewing. Uses pandoc for supported document types. Returns an error for unsupported file types. Requires `mail:read` scope.","operationId":"mail_api_view_attachment_mail_messages__int_message_id__attachments__int_attachment_index__view_get","parameters":[{"description":"Message ID","in":"path","name":"message_id","required":true,"schema":{"description":"Message ID","title":"Message Id","type":"integer"}},{"description":"Zero-based attachment index","in":"path","name":"attachment_index","required":true,"schema":{"description":"Zero-based attachment index","title":"Attachment Index","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"View attachment as HTML","tags":["mail"]}},"/v1/mail/messages/{message_id}/move":{"post":{"description":"Moves a single message to a destination folder via IMAP. Requires `mail:write` scope.","operationId":"mail_api_move_message_mail_messages__int_message_id__move_post","parameters":[{"description":"Message ID","in":"path","name":"message_id","required":true,"schema":{"description":"Message ID","title":"Message Id","type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveMessageBody"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Move message","tags":["mail"]}},"/v1/mail/messages/{message_id}/raw":{"get":{"description":"Fetches the raw RFC 822 message source (.eml) from the IMAP server. Requires `mail:read` scope.","operationId":"mail_api_raw_message_mail_messages__int_message_id__raw_get","parameters":[{"description":"Message ID","in":"path","name":"message_id","required":true,"schema":{"description":"Message ID","title":"Message Id","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageDetailResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get raw message source","tags":["mail"]}},"/v1/mail/search":{"get":{"description":"Full-text search across all folders in the account cache. Returns matching messages sorted by relevance. Requires `mail:read` scope.","operationId":"mail_api_search_messages_mail_search_get","parameters":[{"description":"Search query string","in":"query","name":"q","required":true,"schema":{"description":"Search query string","title":"Q","type":"string"}},{"description":"Mail account ID (defaults to primary account)","in":"query","name":"account_id","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"default":null,"description":"Mail account ID (defaults to primary account)","title":"Account Id"}},{"description":"Maximum results (1-200)","in":"query","name":"max_results","required":false,"schema":{"default":50,"description":"Maximum results (1-200)","maximum":200,"minimum":1.0,"title":"Max Results","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageListResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad Request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Search messages","tags":["mail"]}},"/v1/mail/threads/{thread_id}":{"get":{"description":"Returns all messages in a conversation thread, ordered chronologically. Requires `mail:read` scope.","operationId":"mail_api_get_thread_mail_threads__thread_id__get","parameters":[{"description":"Thread ID","in":"path","name":"thread_id","required":true,"schema":{"description":"Thread ID","title":"Thread Id","type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Get message thread","tags":["mail"]}},"/v1/tokens":{"get":{"description":"Returns all API tokens for the authenticated customer, including scopes and usage timestamps. Requires `mail:read` scope.","operationId":"tokens_list_tokens_tokens_get","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenListResponse"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"List API tokens","tags":["tokens"]}},"/v1/tokens/{token_id}":{"delete":{"description":"Permanently revokes an API token by ID. The token can no longer be used for authentication after revocation. Requires `mail:write` scope.","operationId":"tokens_revoke_token_tokens__int_token_id__delete","parameters":[{"description":"Token ID to revoke","in":"path","name":"token_id","required":true,"schema":{"description":"Token ID to revoke","title":"Token Id","type":"integer"}}],"responses":{"204":{"description":"No Content"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Unauthorized"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Not Found"},"422":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ValidationErrorModel"},"type":"array"}}},"description":"Unprocessable Entity"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Too Many Requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Revoke API token","tags":["tokens"]}}},"tags":[{"description":"Account management","name":"accounts"},{"description":"API token management","name":"tokens"},{"description":"Mail operations","name":"mail"},{"description":"Contacts management","name":"contacts"},{"description":"Calendar management","name":"calendar"},{"description":"Document management","name":"docs"}]}
