{"openapi":"3.1.0","info":{"title":"DoneWell API v1","version":"1.0.0","description":"Read and write a company’s DoneWell data. Authenticate with `Authorization: Bearer <token>` — a scoped company API key (`dw_live_…`, created under Settings → Developer → API Keys) or a user access token. Human-readable guide: /developers."},"servers":[{"url":"https://donewellapp.com/api/v1"}],"security":[{"bearer":[]}],"paths":{"/auth/mobile/login":{"post":{"operationId":"postAuthMobileLogin","summary":"Sign in with email and password; returns an access and refresh token","description":"Sign in with email and password; returns an access and refresh token.","security":[],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","minLength":1,"maxLength":254},"password":{"type":"string","minLength":1,"maxLength":1024},"deviceId":{"type":"string","minLength":1,"maxLength":128},"deviceName":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"totp":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]}},"required":["email","password","deviceId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/mobile/google":{"post":{"operationId":"postAuthMobileGoogle","summary":"Sign in with a Google ID token","description":"Sign in with a Google ID token.","security":[],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"idToken":{"type":"string","minLength":1,"maxLength":4096},"deviceId":{"type":"string","minLength":1,"maxLength":128},"deviceName":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"totp":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]}},"required":["idToken","deviceId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/mobile/refresh":{"post":{"operationId":"postAuthMobileRefresh","summary":"Rotate a refresh token","description":"Rotate a refresh token.","security":[],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string","minLength":1,"maxLength":256}},"required":["refreshToken"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/mobile/logout":{"post":{"operationId":"postAuthMobileLogout","summary":"Revoke a refresh token","description":"Revoke a refresh token.","security":[],"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"refreshToken":{"type":"string","minLength":1,"maxLength":256}},"required":["refreshToken"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/mobile/switch-company":{"post":{"operationId":"postAuthMobileSwitchCompany","summary":"Switch the session to another company the user belongs to","description":"Switch the session to another company the user belongs to. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"companyId":{"type":"string","minLength":1,"maxLength":64}},"required":["companyId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers":{"get":{"operationId":"getCustomers","summary":"List customers","description":"List customers. Requires the API key scope `clients:view` (or a user token whose role grants it).","x-required-scope":"clients:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"status","in":"query","required":false,"description":"Only rows in this status. An unknown value is ignored.","schema":{"type":"string","enum":["LEAD","ACTIVE","INACTIVE"]}},{"name":"search","in":"query","required":false,"description":"Case-insensitive substring of first name, last name or company name.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postCustomers","summary":"Create a customer","description":"Create a customer. Requires the API key scope `clients:create` (or a user token whose role grants it).","x-required-scope":"clients:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":["string","null"]},"title":{"type":["string","null"]},"lastName":{"type":["string","null"]},"companyName":{"type":["string","null"]},"useCompanyAsName":{"type":"boolean"},"status":{"type":"string","enum":["LEAD","ACTIVE","INACTIVE"]},"source":{"type":"string","enum":["WEBSITE","YELP","GOOGLE","REFERRAL","PHONE","OTHER"]},"notes":{"type":["string","null"]},"leadSourceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"emailOptIn":{"type":"boolean"},"smsOptIn":{"type":"boolean"},"billingAddressSource":{"type":["string","null"]},"billingAddressLine1":{"type":["string","null"]},"billingAddressLine2":{"type":["string","null"]},"billingCity":{"type":["string","null"]},"billingState":{"type":["string","null"]},"billingZipCode":{"type":["string","null"]},"billingCountry":{"type":["string","null"]},"phones":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":5},"label":{"type":["string","null"]},"isPrimary":{"type":"boolean"}},"required":["phone"],"additionalProperties":false}},"emails":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+.-]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$"},"label":{"type":["string","null"]},"isPrimary":{"type":"boolean"}},"required":["email"],"additionalProperties":false}},"properties":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"addressLine1":{"type":"string","minLength":1},"addressLine2":{"type":["string","null"]},"city":{"type":["string","null"]},"state":{"type":["string","null"]},"zipCode":{"type":["string","null"]},"country":{"type":["string","null"]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["addressLine1"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}":{"get":{"operationId":"getCustomersById","summary":"Get a customer","description":"Get a customer. Requires the API key scope `clients:view` (or a user token whose role grants it).","x-required-scope":"clients:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchCustomersById","summary":"Update a customer","description":"Update a customer. Requires the API key scope `clients:edit` (or a user token whose role grants it).","x-required-scope":"clients:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"firstName":{"type":["string","null"]},"title":{"type":["string","null"]},"lastName":{"type":["string","null"]},"companyName":{"type":["string","null"]},"useCompanyAsName":{"type":"boolean"},"status":{"type":"string","enum":["LEAD","ACTIVE","INACTIVE"]},"source":{"type":"string","enum":["WEBSITE","YELP","GOOGLE","REFERRAL","PHONE","OTHER"]},"notes":{"type":["string","null"]},"leadSourceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"emailOptIn":{"type":"boolean"},"smsOptIn":{"type":"boolean"},"billingAddressSource":{"type":["string","null"]},"billingAddressLine1":{"type":["string","null"]},"billingAddressLine2":{"type":["string","null"]},"billingCity":{"type":["string","null"]},"billingState":{"type":["string","null"]},"billingZipCode":{"type":["string","null"]},"billingCountry":{"type":["string","null"]},"phones":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","minLength":5},"label":{"type":["string","null"]},"isPrimary":{"type":"boolean"}},"required":["phone"],"additionalProperties":false}},"emails":{"maxItems":10,"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+.-]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$"},"label":{"type":["string","null"]},"isPrimary":{"type":"boolean"}},"required":["email"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteCustomersById","summary":"Delete a customer","description":"Delete a customer. Requires the API key scope `clients:delete` (or a user token whose role grants it).","x-required-scope":"clients:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}/blocks/{block}":{"patch":{"operationId":"patchCustomersByIdBlocksByBlock","summary":"Update one block of a customer","description":"Update one block of a customer. Requires the API key scope `clients:edit` (or a user token whose role grants it).","x-required-scope":"clients:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"block","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"title":"identity","type":"object","properties":{"title":{"default":"","type":"string"},"firstName":{"default":"","type":"string","maxLength":100},"lastName":{"default":"","type":"string","maxLength":100},"companyName":{"default":"","type":"string","maxLength":200},"useCompanyAsName":{"type":"boolean"},"status":{"type":"string","enum":["LEAD","ACTIVE","INACTIVE"]}}},{"title":"contact-info","type":"object","properties":{"phones":{"default":[],"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"phone":{"default":"","type":"string"},"label":{"default":"Main","type":"string"},"isPrimary":{"default":false,"type":"boolean"}}}},"emails":{"default":[],"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"default":"","anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+.-]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$"},{"type":"string","const":""}]},"label":{"default":"Main","type":"string"},"isPrimary":{"default":false,"type":"boolean"}}}},"emailOptIn":{"default":true,"type":"boolean"},"smsOptIn":{"default":true,"type":"boolean"},"marketingPhotoConsent":{"default":false,"type":"boolean"}}},{"title":"classification","type":"object","properties":{"leadSourceId":{"type":["string","null"]},"referralCustomerId":{"type":["string","null"]},"tagIds":{"default":[],"type":"array","items":{"type":"string"}},"notes":{"default":"","type":"string"}}},{"title":"billing","type":"object","properties":{"billingAddressSource":{"default":"property_0","type":"string"},"billingAddressLine1":{"default":"","type":"string"},"billingAddressLine2":{"default":"","type":"string"},"billingCity":{"default":"","type":"string"},"billingState":{"default":"","type":"string"},"billingZipCode":{"default":"","type":"string"},"billingCountry":{"default":"CA","type":"string"}}},{"title":"pricing","type":"object","properties":{"priceLevelId":{"type":["string","null"]}}},{"title":"social-links","type":"object","properties":{"socialLinks":{"default":[],"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"platform":{"type":"string","enum":["TIKTOK","INSTAGRAM","FACEBOOK","YOUTUBE","WEBSITE"]},"url":{"type":"string","format":"uri"}},"required":["platform","url"]}}}}],"description":"The schema depends on the `{block}` path segment: pick the `anyOf` branch whose `title` equals it."}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}/properties":{"post":{"operationId":"postCustomersByIdProperties","summary":"Add a property to a customer","description":"Add a property to a customer. Requires the API key scope `clients:edit` (or a user token whose role grants it).","x-required-scope":"clients:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"addressLine1":{"type":"string","minLength":1},"addressLine2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zipCode":{"type":"string"},"country":{"type":"string"},"notes":{"type":"string"},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"contacts":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"default":"","type":"string"},"phone":{"default":"","type":"string"},"role":{"default":"","type":"string"}},"required":["name"],"additionalProperties":false}}},"required":["addressLine1"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/customers/{id}/properties/{propertyId}":{"patch":{"operationId":"patchCustomersByIdPropertiesByPropertyId","summary":"Update a customer property","description":"Update a customer property. Requires the API key scope `clients:edit` (or a user token whose role grants it).","x-required-scope":"clients:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"addressLine1":{"type":"string","minLength":1},"addressLine2":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zipCode":{"type":"string"},"country":{"type":"string"},"notes":{"type":"string"},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"latitude":{"type":["number","null"]},"longitude":{"type":["number","null"]},"contacts":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1},"email":{"default":"","type":"string"},"phone":{"default":"","type":"string"},"role":{"default":"","type":"string"}},"required":["name"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteCustomersByIdPropertiesByPropertyId","summary":"Remove a customer property","description":"Remove a customer property. Requires the API key scope `clients:edit` (or a user token whose role grants it).","x-required-scope":"clients:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"propertyId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/requests":{"get":{"operationId":"getRequests","summary":"List requests","description":"List requests. Requires the API key scope `requests:view` (or a user token whose role grants it).","x-required-scope":"requests:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"status","in":"query","required":false,"description":"Only rows in this status. An unknown value is ignored.","schema":{"type":"string","enum":["NEW","IN_PROGRESS","QUOTED","CONVERTED","CLOSED"]}},{"name":"customerId","in":"query","required":false,"description":"Only rows of this customer.","schema":{"type":"string"}},{"name":"search","in":"query","required":false,"description":"Free text; a number (`1042` / `#1042`) matches the document number.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postRequests","summary":"Create a request","description":"Create a request. Requires the API key scope `requests:create` (or a user token whose role grants it).","x-required-scope":"requests:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":["string","null"]},"source":{"type":"string","enum":["WEBSITE","YELP","GOOGLE","REFERRAL","PHONE","OTHER"]},"status":{"type":"string","enum":["NEW","IN_PROGRESS","QUOTED","CONVERTED","CLOSED"]},"customerId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"contactName":{"type":["string","null"]},"contactPhone":{"type":["string","null"]},"contactEmail":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+.-]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$"},{"type":"null"}]},"preferredDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"alternateDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]}},"required":["title"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/requests/{id}":{"get":{"operationId":"getRequestsById","summary":"Get a request","description":"Get a request. Requires the API key scope `requests:view` (or a user token whose role grants it).","x-required-scope":"requests:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchRequestsById","summary":"Update a request","description":"Update a request. Requires the API key scope `requests:edit` (or a user token whose role grants it).","x-required-scope":"requests:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":["string","null"]},"source":{"type":"string","enum":["WEBSITE","YELP","GOOGLE","REFERRAL","PHONE","OTHER"]},"status":{"type":"string","enum":["NEW","IN_PROGRESS","QUOTED","CONVERTED","CLOSED"]},"customerId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"contactName":{"type":["string","null"]},"contactPhone":{"type":["string","null"]},"contactEmail":{"anyOf":[{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+.-]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$"},{"type":"null"}]},"preferredDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"alternateDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteRequestsById","summary":"Delete a request","description":"Delete a request. Requires the API key scope `requests:delete` (or a user token whose role grants it).","x-required-scope":"requests:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/requests/{id}/blocks/{block}":{"patch":{"operationId":"patchRequestsByIdBlocksByBlock","summary":"Update one block of a request","description":"Update one block of a request. Requires the API key scope `requests:edit` (or a user token whose role grants it).","x-required-scope":"requests:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"block","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"title":"details","type":"object","properties":{"title":{"default":"","type":"string","maxLength":200},"requestNumber":{"anyOf":[{"type":"integer","minimum":1,"maximum":2147483647},{"type":"null"}]},"customerId":{"type":["string","null"]},"propertyId":{"type":["string","null"]}}},{"title":"assessment","type":"object","properties":{"preferredDate":{"type":["string","null"]},"alternateDate":{"type":["string","null"]},"preferredArrivalTimes":{"default":[],"type":"array","items":{"type":"string","enum":["ANY_TIME","MORNING","AFTERNOON","EVENING"]}},"bookedStartTime":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"},{"type":"null"}]},"bookedEndTime":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"},{"type":"null"}]},"assessment":{"anyOf":[{"type":"object","properties":{"instructions":{"default":"","type":"string"},"startDate":{"type":["string","null"]},"startTime":{"type":["string","null"]},"endTime":{"type":["string","null"]},"scheduleLater":{"default":false,"type":"boolean"},"anytime":{"default":false,"type":"boolean"},"assignedToId":{"type":["string","null"]},"helpers":{"default":[],"maxItems":20,"type":"array","items":{"type":"object","properties":{"userId":{"type":"string","minLength":1}},"required":["userId"]}},"crewId":{"type":["string","null"]}},"required":["startDate"]},{"type":"null"}]}},"required":["preferredDate","alternateDate"]},{"title":"line-items","type":"object","properties":{"items":{"default":[],"type":"array","items":{"type":"object","properties":{"productServiceId":{"type":"string"},"lineItemId":{"type":"string","maxLength":64},"name":{"type":"string","minLength":1},"description":{"default":"","type":"string","maxLength":1000},"qty":{"type":"number","minimum":0},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"unitCost":{"default":0,"type":"number","minimum":0,"maximum":9999999999.99},"isTaxable":{"default":true,"type":"boolean"},"isTextOnly":{"default":false,"type":"boolean"},"total":{"default":0,"type":"number","minimum":0}},"required":["name","qty","unitPrice"]}},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"cityId":{"type":["string","null"]},"priceListId":{"type":["string","null"]},"taxRateId":{"type":["string","null"]},"taxInclusive":{"type":"boolean"},"promoCodeId":{"type":["string","null"]},"feeOverride":{"type":"object","properties":{"fees":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"feeId":{"type":"string","minLength":1},"amount":{"type":"number","minimum":0,"maximum":1000000}},"required":["feeId","amount"]}},"minimumCharge":{"type":"number","minimum":0,"maximum":1000000}},"required":["fees","minimumCharge"]}}},{"title":"notes","type":"object","properties":{"notes":{"default":"","type":"string"},"flags":{"default":{"linkToQuotes":true,"linkToJobs":true,"linkToInvoices":true},"type":"object","properties":{"linkToQuotes":{"default":true,"type":"boolean"},"linkToJobs":{"default":true,"type":"boolean"},"linkToInvoices":{"default":true,"type":"boolean"}}}}}],"description":"The schema depends on the `{block}` path segment: pick the `anyOf` branch whose `title` equals it."}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/requests/{id}/convert":{"post":{"operationId":"postRequestsByIdConvert","summary":"Convert a request into a quote or job (`target: \"quote\"` also needs `quotes:create`, `target: \"job\"` also needs `jobs:create`)","description":"Convert a request into a quote or job (`target: \"quote\"` also needs `quotes:create`, `target: \"job\"` also needs `jobs:create`). Requires the API key scope `requests:edit` (or a user token whose role grants it). Depending on the request body it also requires one of `quotes:create`, `jobs:create` (403 `insufficient_scope` otherwise).","x-required-scope":"requests:edit","x-also-requires-one-of":["quotes:create","jobs:create"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"target":{"type":"string","enum":["quote","job"]}},"required":["target"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/booking/slots":{"get":{"operationId":"getBookingSlots","summary":"Free booking starts per day for a set of services — the grid the public booking page shows","description":"Free booking starts per day for a set of services — the grid the public booking page shows. Requires the API key scope `requests:create` (or a user token whose role grants it).","x-required-scope":"requests:create","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/bookings":{"post":{"operationId":"postBookings","summary":"Book a free start; nothing is sent to the client. Field service: a NEW request with the booked window. Salon: an appointment with a stylist (staffId, default \"any\"); `data.deposit` is null, or `pending_approval` (a person approves the charge to the client's saved card in Approvals — never charged by this call), or `not_requested` with a reason","description":"Book a free start; nothing is sent to the client. Field service: a NEW request with the booked window. Salon: an appointment with a stylist (staffId, default \"any\"); `data.deposit` is null, or `pending_approval` (a person approves the charge to the client's saved card in Approvals — never charged by this call), or `not_requested` with a reason. Requires the API key scope `requests:create` (or a user token whose role grants it).","x-required-scope":"requests:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"serviceIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"startTime":{"type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"},"customerId":{"type":"string","minLength":1},"propertyId":{"type":"string","minLength":1},"contactName":{"type":"string","minLength":1,"maxLength":120},"contactPhone":{"type":"string"},"contactEmail":{"type":"string","maxLength":200,"format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Z0-9_'+.-]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-]*\\.)+[A-Z]{2,}$"},"cityId":{"type":"string","minLength":1},"staffId":{"anyOf":[{"type":"string","const":"any"},{"type":"string","minLength":1}]},"details":{"type":"string","maxLength":2000}},"required":["serviceIds","date","startTime"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes":{"get":{"operationId":"getQuotes","summary":"List quotes","description":"List quotes. Requires the API key scope `quotes:view` (or a user token whose role grants it).","x-required-scope":"quotes:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"status","in":"query","required":false,"description":"Only rows in this status. An unknown value is ignored.","schema":{"type":"string","enum":["DRAFT","DECLINED","AWAITING_RESPONSE","APPROVED","CONVERTED","ARCHIVED"]}},{"name":"customerId","in":"query","required":false,"description":"Only rows of this customer.","schema":{"type":"string"}},{"name":"search","in":"query","required":false,"description":"Free text; a number (`1042` / `#1042`) matches the document number.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postQuotes","summary":"Create a quote","description":"Create a quote. Requires the API key scope `quotes:create` (or a user token whose role grants it).","x-required-scope":"quotes:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"title":{"type":["string","null"]},"notes":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","DECLINED","AWAITING_RESPONSE","APPROVED","CONVERTED","ARCHIVED"]},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"taxInclusive":{"type":"boolean"},"lineItems":{"default":[],"type":"array","items":{"type":"object","properties":{"productServiceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"qty":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"isTaxable":{"default":true,"type":"boolean"}},"required":["name","qty","unitPrice"],"additionalProperties":false}}},"required":["customerId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes/{id}":{"get":{"operationId":"getQuotesById","summary":"Get a quote","description":"Get a quote. Requires the API key scope `quotes:view` (or a user token whose role grants it).","x-required-scope":"quotes:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchQuotesById","summary":"Update a quote","description":"Update a quote. Requires the API key scope `quotes:edit` (or a user token whose role grants it).","x-required-scope":"quotes:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"title":{"type":["string","null"]},"notes":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","DECLINED","AWAITING_RESPONSE","APPROVED","CONVERTED","ARCHIVED"]},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"taxInclusive":{"type":"boolean"},"lineItems":{"type":"array","items":{"type":"object","properties":{"productServiceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"qty":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"isTaxable":{"default":true,"type":"boolean"}},"required":["name","qty","unitPrice"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteQuotesById","summary":"Delete a quote","description":"Delete a quote. Requires the API key scope `quotes:delete` (or a user token whose role grants it).","x-required-scope":"quotes:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes/{id}/blocks/{block}":{"patch":{"operationId":"patchQuotesByIdBlocksByBlock","summary":"Update one block of a quote","description":"Update one block of a quote. Requires the API key scope `quotes:edit` (or a user token whose role grants it).","x-required-scope":"quotes:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"block","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"title":"details","type":"object","properties":{"title":{"default":"","type":"string","maxLength":200},"quoteNumber":{"anyOf":[{"type":"integer","minimum":1,"maximum":2147483647},{"type":"null"}]},"customerId":{"type":["string","null"]},"propertyId":{"type":["string","null"]},"validUntil":{"type":["string","null"]}},"required":["validUntil"]},{"title":"line-items","type":"object","properties":{"items":{"default":[],"type":"array","items":{"type":"object","properties":{"productServiceId":{"type":"string"},"lineItemId":{"type":"string","maxLength":64},"name":{"type":"string","minLength":1},"description":{"default":"","type":"string"},"qty":{"type":"number","minimum":0},"unit":{"default":"","type":"string"},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"unitCost":{"default":0,"type":"number","minimum":0,"maximum":9999999999.99},"isTaxable":{"default":true,"type":"boolean"},"isOptional":{"default":false,"type":"boolean"},"isTextOnly":{"default":false,"type":"boolean"},"total":{"default":0,"type":"number","minimum":0}},"required":["name","qty","unitPrice"]}},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"cityId":{"type":["string","null"]},"priceListId":{"type":["string","null"]},"taxRateId":{"type":["string","null"]},"taxInclusive":{"type":"boolean"},"promoCodeId":{"type":["string","null"]},"feeOverride":{"type":"object","properties":{"fees":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"feeId":{"type":"string","minLength":1},"amount":{"type":"number","minimum":0,"maximum":1000000}},"required":["feeId","amount"]}},"minimumCharge":{"type":"number","minimum":0,"maximum":1000000}},"required":["fees","minimumCharge"]},"extras":{"anyOf":[{"type":"object","properties":{"mode":{"type":"string","enum":["deposit","schedule"]},"depositType":{"default":"FIXED","type":"string","enum":["PERCENT","FIXED"]},"depositAmount":{"default":"","type":"string"},"schedule":{"default":[],"type":"array","items":{"type":"object","properties":{"installmentNumber":{"type":"integer","minimum":1,"maximum":9007199254740991},"amountType":{"default":"PERCENT","type":"string","enum":["PERCENT","FIXED"]},"amountValue":{"default":"","type":"string"},"dueDescription":{"default":"","type":"string"}},"required":["installmentNumber"]}}},"required":["mode"]},{"type":"null"}]}}},{"title":"message","type":"object","properties":{"clientMessage":{"default":"","type":"string"}}},{"title":"contract","type":"object","properties":{"contractDisclaimer":{"default":"","type":"string"},"applyToFuture":{"default":false,"type":"boolean"}}},{"title":"notes","type":"object","properties":{"notes":{"default":"","type":"string"}}}],"description":"The schema depends on the `{block}` path segment: pick the `anyOf` branch whose `title` equals it."}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes/{id}/send":{"post":{"operationId":"postQuotesByIdSend","summary":"Send a quote to the customer","description":"Send a quote to the customer. Requires the API key scope `quotes:edit` (or a user token whose role grants it).","x-required-scope":"quotes:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","enum":["email","sms"]},"attachPdf":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes/{id}/mark-sent":{"post":{"operationId":"postQuotesByIdMarkSent","summary":"Mark a quote as sent without emailing it","description":"Mark a quote as sent without emailing it. Requires the API key scope `quotes:edit` (or a user token whose role grants it).","x-required-scope":"quotes:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes/{id}/approve":{"post":{"operationId":"postQuotesByIdApprove","summary":"Approve a quote","description":"Approve a quote. Requires the API key scope `quotes:edit` (or a user token whose role grants it).","x-required-scope":"quotes:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes/{id}/decline":{"post":{"operationId":"postQuotesByIdDecline","summary":"Decline a quote","description":"Decline a quote. Requires the API key scope `quotes:edit` (or a user token whose role grants it).","x-required-scope":"quotes:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quotes/{id}/convert":{"post":{"operationId":"postQuotesByIdConvert","summary":"Convert a quote into a job or an invoice (`target: \"job\"` also needs `jobs:create`, `target: \"invoice\"` also needs `invoices:create`)","description":"Convert a quote into a job or an invoice (`target: \"job\"` also needs `jobs:create`, `target: \"invoice\"` also needs `invoices:create`). Requires the API key scope `quotes:edit` (or a user token whose role grants it). Depending on the request body it also requires one of `jobs:create`, `invoices:create` (403 `insufficient_scope` otherwise).","x-required-scope":"quotes:edit","x-also-requires-one-of":["jobs:create","invoices:create"],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"target":{"type":"string","enum":["job","invoice"]}},"required":["target"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs":{"get":{"operationId":"getJobs","summary":"List jobs","description":"List jobs. Requires the API key scope `jobs:view` (or a user token whose role grants it).","x-required-scope":"jobs:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"status","in":"query","required":false,"description":"Only rows in this status. An unknown value is ignored.","schema":{"type":"string","enum":["SCHEDULED","IN_PROGRESS","DONE","CANCELED","REQUIRES_INVOICING"]}},{"name":"customerId","in":"query","required":false,"description":"Only rows of this customer.","schema":{"type":"string"}},{"name":"order","in":"query","required":false,"description":"`start`: earliest visit first, undated jobs last; `created`: newest first (default). Anything else is 422.","schema":{"type":"string","enum":["start","created"]}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postJobs","summary":"Create a job","description":"Create a job. Requires the API key scope `jobs:create` (or a user token whose role grants it).","x-required-scope":"jobs:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"quoteId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"notes":{"type":["string","null"]},"status":{"type":"string","enum":["SCHEDULED","IN_PROGRESS","DONE","CANCELED","REQUIRES_INVOICING"]},"startAt":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"endAt":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"assignedToId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"taxInclusive":{"type":"boolean"},"lineItems":{"default":[],"type":"array","items":{"type":"object","properties":{"productServiceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"qty":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"isTaxable":{"default":true,"type":"boolean"}},"required":["name","qty","unitPrice"],"additionalProperties":false}},"jobNumber":{"type":"integer","minimum":1,"maximum":2147483647},"instructions":{"type":"string"},"anytime":{"type":"boolean"},"scheduleLater":{"type":"boolean"},"helperUserIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"crewId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"recurrencePattern":{"type":"string","enum":["DOES_NOT_REPEAT","DAILY","WEEKLY","BIWEEKLY","MONTHLY","YEARLY","EVERY_WEEKDAY","CUSTOM"]},"recurrenceEndType":{"anyOf":[{"type":"string","enum":["NEVER","AFTER_COUNT","ON_DATE"]},{"type":"null"}]},"recurrenceEndCount":{"anyOf":[{"type":"integer","minimum":1,"maximum":520},{"type":"null"}]},"recurrenceEndDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"recurrenceInterval":{"anyOf":[{"type":"integer","minimum":1,"maximum":99},{"type":"null"}]},"recurrenceUnit":{"anyOf":[{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},{"type":"null"}]},"recurrenceDaysOfWeek":{"type":"string","pattern":"^[0-6](,[0-6])*$"},"recurrenceMonthlyMode":{"anyOf":[{"type":"string","enum":["DAY_OF_MONTH","NTH_WEEKDAY"]},{"type":"null"}]},"recurrenceMonthlyDays":{"type":"string","pattern":"^(\\d{1,2}|LAST)(,(\\d{1,2}|LAST))*$"},"recurrenceMonthlyWeekdays":{"type":"string","pattern":"^(-?\\d|L):[0-6](,(-?\\d|L):[0-6])*$"}},"required":["customerId","title"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}":{"get":{"operationId":"getJobsById","summary":"Get a job","description":"Get a job. Requires the API key scope `jobs:view` (or a user token whose role grants it).","x-required-scope":"jobs:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchJobsById","summary":"Update a job","description":"Update a job. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"title":{"type":"string","minLength":1},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"quoteId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"notes":{"type":["string","null"]},"status":{"type":"string","enum":["SCHEDULED","IN_PROGRESS","DONE","CANCELED","REQUIRES_INVOICING"]},"startAt":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"endAt":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"assignedToId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"taxInclusive":{"type":"boolean"},"lineItems":{"type":"array","items":{"type":"object","properties":{"productServiceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"qty":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"isTaxable":{"default":true,"type":"boolean"}},"required":["name","qty","unitPrice"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteJobsById","summary":"Delete a job","description":"Delete a job. Requires the API key scope `jobs:delete` (or a user token whose role grants it).","x-required-scope":"jobs:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}/details":{"patch":{"operationId":"patchJobsByIdDetails","summary":"Update a job’s details block","description":"Update a job’s details block. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"default":"","type":"string","maxLength":200},"jobNumber":{"type":"integer","minimum":1,"maximum":2147483647},"customerId":{"type":["string","null"]},"propertyId":{"type":["string","null"]},"marketingPhotoExcluded":{"default":false,"type":"boolean"}},"required":["jobNumber"]}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}/billing":{"patch":{"operationId":"patchJobsByIdBilling","summary":"Update a job’s billing block","description":"Update a job’s billing block. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoicingFrequency":{"default":"ON_COMPLETION","type":"string","enum":["PER_VISIT","ON_COMPLETION","MONTHLY"]},"billingType":{"type":"string","enum":["VISIT_BASED","FIXED_PRICE"]},"remindToInvoice":{"default":false,"type":"boolean"},"splitIntoSchedule":{"default":false,"type":"boolean"},"confirmPerVisitExit":{"type":"boolean"},"paymentSchedule":{"default":[],"type":"array","items":{"type":"object","properties":{"installmentNumber":{"type":"integer","minimum":1,"maximum":9007199254740991},"amountType":{"default":"PERCENT","type":"string","enum":["PERCENT","FIXED"]},"amountValue":{"default":0,"type":"number","minimum":0,"maximum":9999999999.99},"dueDescription":{"default":"","type":"string"}},"required":["installmentNumber"]}}}}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}/notes":{"patch":{"operationId":"patchJobsByIdNotes","summary":"Update a job’s notes block","description":"Update a job’s notes block. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"notes":{"default":"","type":"string"}}}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}/line-items":{"patch":{"operationId":"patchJobsByIdLineItems","summary":"Replace a job’s line items","description":"Replace a job’s line items. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"default":[],"type":"array","items":{"type":"object","properties":{"productServiceId":{"type":"string"},"lineItemId":{"type":"string","maxLength":64},"name":{"type":"string","minLength":1},"description":{"default":"","type":"string"},"qty":{"type":"number","minimum":0},"unit":{"default":"","type":"string"},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"unitCost":{"default":0,"type":"number","minimum":0,"maximum":9999999999.99},"isTaxable":{"default":true,"type":"boolean"},"isTextOnly":{"default":false,"type":"boolean"},"total":{"default":0,"type":"number","minimum":0}},"required":["name","qty","unitPrice"]}},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"cityId":{"type":["string","null"]},"priceListId":{"type":["string","null"]},"taxRateId":{"type":["string","null"]},"taxInclusive":{"type":"boolean"},"promoCodeId":{"type":["string","null"]},"feeOverride":{"type":"object","properties":{"fees":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"feeId":{"type":"string","minLength":1},"amount":{"type":"number","minimum":0,"maximum":1000000}},"required":["feeId","amount"]}},"minimumCharge":{"type":"number","minimum":0,"maximum":1000000}},"required":["fees","minimumCharge"]}}}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}/schedule":{"patch":{"operationId":"patchJobsByIdSchedule","summary":"Update a job’s schedule","description":"Update a job’s schedule. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"type":{"default":"ONE_OFF","type":"string","enum":["ONE_OFF","RECURRING"]},"scheduleLater":{"default":false,"type":"boolean"},"anytime":{"default":false,"type":"boolean"},"startDate":{"default":"","type":"string"},"startTime":{"default":"","type":"string"},"endTime":{"default":"","type":"string"},"assignedToId":{"type":["string","null"]},"crewId":{"type":["string","null"]},"emailOnAssign":{"default":false,"type":"boolean"},"instructions":{"default":"","type":"string"},"helpers":{"default":[],"type":"array","items":{"type":"object","properties":{"userId":{"type":"string","minLength":1}},"required":["userId"]}},"recurrencePattern":{"default":"DOES_NOT_REPEAT","type":"string","enum":["DOES_NOT_REPEAT","DAILY","WEEKLY","BIWEEKLY","MONTHLY","YEARLY","EVERY_WEEKDAY","CUSTOM"]},"recurrenceEndType":{"type":"string","enum":["NEVER","AFTER_COUNT","ON_DATE"]},"recurrenceEndCount":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"recurrenceEndPeriod":{"type":["string","null"]},"recurrenceEndDate":{"type":["string","null"]},"recurrenceInterval":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"recurrenceUnit":{"type":"string","enum":["DAY","WEEK","MONTH","YEAR"]},"recurrenceDaysOfWeek":{"default":"","type":"string"},"recurrenceMonthlyMode":{"type":"string","enum":["DAY_OF_MONTH","NTH_WEEKDAY"]},"recurrenceMonthlyDays":{"default":"","type":"string"},"recurrenceMonthlyWeekdays":{"default":"","type":"string"},"confirmVisitRemoval":{"type":"boolean"},"confirmPerVisitExit":{"type":"boolean"}},"required":["recurrenceEndDate"]}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/jobs/{id}/invoices":{"post":{"operationId":"postJobsByIdInvoices","summary":"Create an invoice from a job","description":"Create an invoice from a job. Requires the API key scope `invoices:create` (or a user token whose role grants it).","x-required-scope":"invoices:create","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"visitId":{"type":"string","minLength":1},"month":{"type":"string"},"acknowledgedInvoiceIds":{"maxItems":200,"type":"array","items":{"type":"string","minLength":1}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices":{"get":{"operationId":"getInvoices","summary":"List invoices","description":"List invoices. Requires the API key scope `invoices:view` (or a user token whose role grants it).","x-required-scope":"invoices:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},{"name":"status","in":"query","required":false,"description":"Only rows in this status. An unknown value is ignored.","schema":{"type":"string","enum":["DRAFT","SENT","PAID","OVERDUE","AWAITING_PAYMENT","PARTIAL","BAD_DEBT","VOID"]}},{"name":"customerId","in":"query","required":false,"description":"Only rows of this customer.","schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postInvoices","summary":"Create an invoice","description":"Create an invoice. Requires the API key scope `invoices:create` (or a user token whose role grants it).","x-required-scope":"invoices:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"jobId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"quoteId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"title":{"type":["string","null"]},"notes":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SENT","PAID","OVERDUE","AWAITING_PAYMENT","PARTIAL","BAD_DEBT","VOID"]},"issueDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"dueDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"paymentTerms":{"type":["string","null"]},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"taxInclusive":{"type":"boolean"},"lineItems":{"default":[],"type":"array","items":{"type":"object","properties":{"productServiceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"qty":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"isTaxable":{"default":true,"type":"boolean"}},"required":["name","qty","unitPrice"],"additionalProperties":false}},"clientMessage":{"type":["string","null"]}},"required":["customerId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}":{"get":{"operationId":"getInvoicesById","summary":"Get an invoice","description":"Get an invoice. Requires the API key scope `invoices:view` (or a user token whose role grants it).","x-required-scope":"invoices:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchInvoicesById","summary":"Update an invoice (`status: \"VOID\"` voids it like the web — sent alone, refused 409 while payments are applied; POST cannot create a VOID invoice)","description":"Update an invoice (`status: \"VOID\"` voids it like the web — sent alone, refused 409 while payments are applied; POST cannot create a VOID invoice). Requires the API key scope `invoices:edit` (or a user token whose role grants it).","x-required-scope":"invoices:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1},"jobId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"quoteId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"propertyId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"title":{"type":["string","null"]},"notes":{"type":["string","null"]},"status":{"type":"string","enum":["DRAFT","SENT","PAID","OVERDUE","AWAITING_PAYMENT","PARTIAL","BAD_DEBT","VOID"]},"issueDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"dueDate":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"paymentTerms":{"type":["string","null"]},"number":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"taxRateId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"taxInclusive":{"type":"boolean"},"lineItems":{"type":"array","items":{"type":"object","properties":{"productServiceId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"name":{"type":"string","minLength":1},"description":{"type":["string","null"]},"qty":{"type":"number","exclusiveMinimum":0},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"isTaxable":{"default":true,"type":"boolean"}},"required":["name","qty","unitPrice"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteInvoicesById","summary":"Delete an invoice","description":"Delete an invoice. Requires the API key scope `invoices:delete` (or a user token whose role grants it).","x-required-scope":"invoices:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}/blocks/{block}":{"patch":{"operationId":"patchInvoicesByIdBlocksByBlock","summary":"Update one block of an invoice","description":"Update one block of an invoice. Requires the API key scope `invoices:edit` (or a user token whose role grants it).","x-required-scope":"invoices:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"block","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"title":"details","type":"object","properties":{"title":{"default":"","type":"string"},"invoiceNumber":{"anyOf":[{"type":"integer","minimum":1,"maximum":2147483647},{"type":"null"}]},"customerId":{"type":["string","null"]},"propertyId":{"type":["string","null"]},"issueDate":{"type":["string","null"]},"paymentTerms":{"anyOf":[{"type":"string","enum":["DUE_ON_RECEIPT","NET_15","NET_30","NET_45","NET_60","CUSTOM"]},{"type":"null"}]},"dueDate":{"type":["string","null"]},"customFields":{"default":[],"type":"array","items":{"type":"object","properties":{"id":{"default":"","type":"string"},"title":{"default":"","type":"string"},"value":{"default":"","type":"string"}}}}},"required":["issueDate","dueDate"]},{"title":"line-items","type":"object","properties":{"items":{"default":[],"type":"array","items":{"type":"object","properties":{"productServiceId":{"type":"string"},"name":{"type":"string","minLength":1},"description":{"default":"","type":"string"},"qty":{"type":"number","minimum":0},"unit":{"default":"","type":"string"},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"unitCost":{"default":0,"type":"number","minimum":0,"maximum":9999999999.99},"isTaxable":{"default":true,"type":"boolean"},"isOptional":{"default":false,"type":"boolean"},"isTextOnly":{"default":false,"type":"boolean"},"total":{"default":0,"type":"number","minimum":0},"performedById":{"type":["string","null"]}},"required":["name","qty","unitPrice"]}},"discountType":{"anyOf":[{"type":"string","enum":["PERCENT","FIXED"]},{"type":"null"}]},"discountValue":{"anyOf":[{"type":"number","minimum":0,"maximum":9999999999.99},{"type":"null"}]},"cityId":{"type":["string","null"]},"priceListId":{"type":["string","null"]},"taxRateId":{"type":["string","null"]},"taxInclusive":{"type":"boolean"},"promoCodeId":{"type":["string","null"]},"feeOverride":{"type":"object","properties":{"fees":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"feeId":{"type":"string","minLength":1},"amount":{"type":"number","minimum":0,"maximum":1000000}},"required":["feeId","amount"]}},"minimumCharge":{"type":"number","minimum":0,"maximum":1000000}},"required":["fees","minimumCharge"]}}},{"title":"message","type":"object","properties":{"clientMessage":{"default":"","type":"string"}}},{"title":"contract","type":"object","properties":{"contractDisclaimer":{"default":"","type":"string"}}},{"title":"notes","type":"object","properties":{"notes":{"default":"","type":"string"}}}],"description":"The schema depends on the `{block}` path segment: pick the `anyOf` branch whose `title` equals it."}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}/send":{"post":{"operationId":"postInvoicesByIdSend","summary":"Send an invoice to the customer","description":"Send an invoice to the customer. Requires the API key scope `invoices:edit` (or a user token whose role grants it).","x-required-scope":"invoices:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"channel":{"type":"string","enum":["email","sms"]},"attachPdf":{"type":"boolean"},"recipients":{"minItems":1,"maxItems":10,"type":"array","items":{"type":"string","minLength":1}},"subject":{"type":"string"},"body":{"type":"string"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/invoices/{id}/mark-sent":{"post":{"operationId":"postInvoicesByIdMarkSent","summary":"Mark an invoice as sent without emailing it","description":"Mark an invoice as sent without emailing it. Requires the API key scope `invoices:edit` (or a user token whose role grants it).","x-required-scope":"invoices:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payments":{"get":{"operationId":"getPayments","summary":"List payments","description":"List payments. Requires the API key scope `payments:view` (or a user token whose role grants it).","x-required-scope":"payments:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postPayments","summary":"Record a payment","description":"Record a payment. Requires the API key scope `payments:edit` (or a user token whose role grants it).","x-required-scope":"payments:edit","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"invoiceId":{"type":"string","minLength":1},"amount":{"type":"number","minimum":0.01,"maximum":1000000},"tipAmount":{"type":"number","minimum":0,"maximum":1000000},"method":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"walletId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"paidAt":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"checkNumber":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}]},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}]},"giftCardCode":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]}},"required":["invoiceId","amount"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payments/{id}":{"get":{"operationId":"getPaymentsById","summary":"Get a payment","description":"Get a payment. Requires the API key scope `payments:view` (or a user token whose role grants it).","x-required-scope":"payments:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payments/{id}/receipt":{"post":{"operationId":"postPaymentsByIdReceipt","summary":"Send a payment receipt","description":"Send a payment receipt. Requires the API key scope `payments:edit` (or a user token whose role grants it).","x-required-scope":"payments:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"boolean"},"sms":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gift-cards/lookup":{"post":{"operationId":"postGiftCardsLookup","summary":"Look up a gift card by code","description":"Look up a gift card by code. Requires the API key scope `payments:edit` (or a user token whose role grants it).","x-required-scope":"payments:edit","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":1,"maxLength":64}},"required":["code"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payment-methods":{"get":{"operationId":"getPaymentMethods","summary":"List payment methods","description":"List payment methods. Requires the API key scope `payments:view` (or a user token whose role grants it).","x-required-scope":"payments:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/payment-settings":{"get":{"operationId":"getPaymentSettings","summary":"Read the company’s payment settings","description":"Read the company’s payment settings. Requires the API key scope `payments:view` (or a user token whose role grants it).","x-required-scope":"payments:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wallets":{"get":{"operationId":"getWallets","summary":"List wallets","description":"List wallets. Requires the API key scope `wallets:view` (or a user token whose role grants it).","x-required-scope":"wallets:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/expenses":{"get":{"operationId":"getExpenses","summary":"List expenses","description":"List expenses. Requires the API key scope `expenses:view` (or a user token whose role grants it).","x-required-scope":"expenses:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postExpenses","summary":"Book an expense (JSON or multipart with receipts)","description":"Book an expense (JSON or multipart with receipts). Requires a user access token whose role grants `expenses:create`; a company API key is refused (403 `user_token_required`).","x-required-scope":"expenses:create","x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"walletId":{"type":"string","maxLength":64},"amount":{"type":["string","number"]},"category":{"type":"string","maxLength":64},"note":{"type":"string","maxLength":2000},"title":{"type":"string","maxLength":200},"date":{"type":"string","maxLength":10},"jobId":{"type":"string","maxLength":64},"taxRateId":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}]},"taxAmounts":{"type":"object","propertyNames":{"type":"string","maxLength":64},"additionalProperties":{"anyOf":[{"type":"string","maxLength":20},{"type":"number"}]}},"vendor":{"type":"string","maxLength":200},"isReimbursable":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/expense-categories":{"get":{"operationId":"getExpenseCategories","summary":"List expense categories","description":"List expense categories. Requires the API key scope `expenses:view` (or a user token whose role grants it).","x-required-scope":"expenses:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits":{"get":{"operationId":"getVisits","summary":"List visits","description":"List visits. Requires the API key scope `visits:view` (or a user token whose role grants it).","x-required-scope":"visits:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postVisits","summary":"Create a visit","description":"Create a visit. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"jobId":{"type":"string","minLength":1},"title":{"type":"string","maxLength":200},"scheduledStart":{"type":"string","minLength":1},"scheduledEnd":{"type":"string","minLength":1},"scheduleLater":{"type":"boolean"},"instructions":{"type":"string"},"trackMileage":{"type":"boolean"},"assignedUserIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"leadUserId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"crewId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"required":["jobId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}":{"get":{"operationId":"getVisitsById","summary":"Get a visit","description":"Get a visit. Requires the API key scope `visits:view` (or a user token whose role grants it).","x-required-scope":"visits:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchVisitsById","summary":"Update a visit","description":"Update a visit. Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","maxLength":200},"scheduledStart":{"type":"string","minLength":1},"scheduledEnd":{"type":"string","minLength":1},"instructions":{"type":"string"},"trackMileage":{"type":"boolean"},"assignedUserIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"leadUserId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"crewId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteVisitsById","summary":"Delete a visit","description":"Delete a visit. Requires the API key scope `jobs:edit` (or a user token whose role grants it).","x-required-scope":"jobs:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}/start":{"post":{"operationId":"postVisitsByIdStart","summary":"Start a visit","description":"Start a visit. Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}/complete":{"post":{"operationId":"postVisitsByIdComplete","summary":"Complete a visit","description":"Complete a visit. Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}/reopen":{"post":{"operationId":"postVisitsByIdReopen","summary":"Reopen a completed visit","description":"Reopen a completed visit. Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}/line-items":{"put":{"operationId":"putVisitsByIdLineItems","summary":"Replace a visit’s line items","description":"Replace a visit’s line items. Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lineItems":{"maxItems":500,"type":"array","items":{"type":"object","properties":{"productServiceId":{"type":"string"},"lineItemId":{"type":"string","maxLength":64},"name":{"type":"string","minLength":1},"description":{"default":"","type":"string"},"qty":{"type":"number","minimum":0},"unit":{"default":"","type":"string"},"unitPrice":{"type":"number","minimum":0,"maximum":1000000},"unitCost":{"default":0,"type":"number","minimum":0,"maximum":9999999999.99},"isTaxable":{"default":true,"type":"boolean"},"isTextOnly":{"default":false,"type":"boolean"},"total":{"default":0,"type":"number","minimum":0}},"required":["name","qty","unitPrice"]}},"itemsSplit":{"type":"boolean"},"seenLineItemIds":{"maxItems":500,"type":"array","items":{"type":"string","minLength":1,"maxLength":64}}},"required":["lineItems"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}/notes":{"post":{"operationId":"postVisitsByIdNotes","summary":"Add a note to a visit","description":"Add a note to a visit. Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}/notes/{noteId}":{"delete":{"operationId":"deleteVisitsByIdNotesByNoteId","summary":"Delete a visit note","description":"Delete a visit note. Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"noteId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/visits/{id}/photos":{"post":{"operationId":"postVisitsByIdPhotos","summary":"Upload photos to a visit (multipart)","description":"Upload photos to a visit (multipart). Requires the API key scope `visits:edit` (or a user token whose role grants it).","x-required-scope":"visits:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/crews":{"get":{"operationId":"getCrews","summary":"List crews","description":"List crews. Requires the API key scope `visits:view` (or a user token whose role grants it).","x-required-scope":"visits:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/team":{"get":{"operationId":"getTeam","summary":"List team members","description":"List team members. Requires the API key scope `visits:view` (or a user token whose role grants it).","x-required-scope":"visits:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gps/settings":{"get":{"operationId":"getGpsSettings","summary":"Read GPS tracking settings","description":"Read GPS tracking settings. Requires the API key scope `visits:view` (or a user token whose role grants it).","x-required-scope":"visits:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gps/latest":{"get":{"operationId":"getGpsLatest","summary":"Latest GPS positions of the team","description":"Latest GPS positions of the team. Requires the API key scope `visits:view` (or a user token whose role grants it).","x-required-scope":"visits:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gps/batches":{"post":{"operationId":"postGpsBatches","summary":"Upload a batch of the caller’s own location points","description":"Upload a batch of the caller’s own location points. Requires a user access token of any active member (no role permission is checked); a company API key is refused (403 `user_token_required`).","x-role-grants-any-of":[],"x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"points":{"minItems":1,"maxItems":500,"type":"array","items":{"type":"object","properties":{"lat":{"type":"number","minimum":-90,"maximum":90},"lng":{"type":"number","minimum":-180,"maximum":180},"accuracy":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"speed":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}]},"heading":{"anyOf":[{"type":"number","minimum":0,"maximum":360},{"type":"null"}]},"batteryLevel":{"anyOf":[{"type":"number","minimum":0,"maximum":1},{"type":"null"}]},"activity":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]},"recordedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]}},"required":["lat","lng","recordedAt"],"additionalProperties":false}}},"required":["points"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/gps/geofence-events":{"post":{"operationId":"postGpsGeofenceEvents","summary":"Report geofence enter/exit events","description":"Report geofence enter/exit events. Requires a user access token whose role grants one of `jobs:edit`, `schedule:edit`; a company API key is refused (403 `user_token_required`).","x-role-grants-any-of":["jobs:edit","schedule:edit"],"x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"visitId":{"type":"string","minLength":1},"kind":{"type":"string","enum":["enter","exit"]},"at":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]}},"required":["visitId","kind","at"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks":{"get":{"operationId":"getTasks","summary":"List tasks","description":"List tasks. Requires the API key scope `tasks:view` (or a user token whose role grants it).","x-required-scope":"tasks:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postTasks","summary":"Create a task","description":"Create a task. Requires the API key scope `tasks:create` (or a user token whose role grants it).","x-required-scope":"tasks:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":["string","null"]},"dueDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"dueTime":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},{"type":"null"}]},"remindAt":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","COMPLETED"]},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"assignedToId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"relatedJobId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"relatedCustomerId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"parentId":{"type":"string","minLength":1},"boardId":{"type":"string","minLength":1},"column":{"type":"string","minLength":1}},"required":["title"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}":{"get":{"operationId":"getTasksById","summary":"Get a task","description":"Get a task. Requires the API key scope `tasks:view` (or a user token whose role grants it).","x-required-scope":"tasks:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchTasksById","summary":"Update a task","description":"Update a task. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1},"description":{"type":["string","null"]},"dueDate":{"anyOf":[{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},{"type":"null"}]},"dueTime":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},{"type":"null"}]},"remindAt":{"anyOf":[{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},{"type":"null"}]},"status":{"type":"string","enum":["PENDING","COMPLETED"]},"priority":{"type":"string","enum":["LOW","NORMAL","HIGH","URGENT"]},"assignedToId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"relatedJobId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"relatedCustomerId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"columnId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"column":{"type":"string","minLength":1},"boardId":{"type":"string","minLength":1},"labelIds":{"type":"array","items":{"type":"string","minLength":1}},"labels":{"type":"array","items":{"type":"string","minLength":1}},"dependsOnIds":{"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"relations":{"maxItems":50,"type":"array","items":{"type":"object","properties":{"taskId":{"type":"string","minLength":1},"kind":{"type":"string","enum":["RELATES","DUPLICATES"]}},"required":["taskId","kind"]}},"parentId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"checklist":{"maxItems":200,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"text":{"type":"string","minLength":1,"maxLength":500},"done":{"type":"boolean"}},"additionalProperties":false}},"blocks":{"maxItems":100,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"title":{"type":"string","maxLength":200},"type":{"type":"string","enum":["TEXT","CHECKLIST","ATTACHMENTS"]},"content":{"type":"string","maxLength":100000},"remove":{"type":"boolean","const":true}},"additionalProperties":false}},"blockOrder":{"maxItems":100,"type":"array","items":{"type":"string","minLength":1}},"customFields":{"type":"object","propertyNames":{"type":"string","minLength":1},"additionalProperties":{"anyOf":[{"type":"string","maxLength":2048},{"type":"number"},{"type":"boolean"},{"type":"null"}]}},"archived":{"type":"boolean"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteTasksById","summary":"Delete a task","description":"Delete a task. Requires the API key scope `tasks:delete` (or a user token whose role grants it).","x-required-scope":"tasks:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/comments":{"get":{"operationId":"getTasksByIdComments","summary":"List task comments","description":"List task comments. Requires the API key scope `tasks:view` (or a user token whose role grants it).","x-required-scope":"tasks:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postTasksByIdComments","summary":"Add a task comment","description":"Add a task comment. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1,"maxLength":5000}},"required":["body"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/activity":{"get":{"operationId":"getTasksByIdActivity","summary":"Task activity log","description":"Task activity log. Requires the API key scope `tasks:view` (or a user token whose role grants it).","x-required-scope":"tasks:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/claim":{"post":{"operationId":"postTasksByIdClaim","summary":"Claim (lease) a task — or renew your own claim","description":"Claim (lease) a task — or renew your own claim. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"holder":{"type":"string","minLength":1,"maxLength":100},"ttlMinutes":{"default":90,"type":"integer","minimum":5,"maximum":480}},"required":["holder"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteTasksByIdClaim","summary":"Release a task claim — JSON body {holder} or {force: true}","description":"Release a task claim — JSON body {holder} or {force: true}. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/attachments":{"post":{"operationId":"postTasksByIdAttachments","summary":"Attach a file to a task (multipart)","description":"Attach a file to a task (multipart). Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tasks/{id}/attachments/{attachmentId}":{"delete":{"operationId":"deleteTasksByIdAttachmentsByAttachmentId","summary":"Remove a task attachment","description":"Remove a task attachment. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"attachmentId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards":{"get":{"operationId":"getBoards","summary":"List boards","description":"List boards. Requires the API key scope `tasks:view` (or a user token whose role grants it).","x-required-scope":"tasks:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postBoards","summary":"Create a board","description":"Create a board. Requires the API key scope `tasks:create` (or a user token whose role grants it).","x-required-scope":"tasks:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"visibility":{}},"required":["name"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}":{"get":{"operationId":"getBoardsById","summary":"Get a board","description":"Get a board. Requires the API key scope `tasks:view` (or a user token whose role grants it).","x-required-scope":"tasks:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchBoardsById","summary":"Update a board","description":"Update a board. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"numberPrefix":{"type":"string","maxLength":50},"autoArchiveDoneAfterDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":365},{"type":"null"}]},"fieldSettings":{"type":"object","properties":{"properties":{"maxItems":60,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80},"hidden":{"type":"boolean"},"pinned":{"type":"boolean"},"required":{"type":"boolean"}},"required":["key"],"additionalProperties":false}},"tile":{"type":"object","properties":{"cover":{"type":"boolean"},"elements":{"maxItems":60,"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":80},"hidden":{"type":"boolean"}},"required":["key"],"additionalProperties":false}}},"additionalProperties":false}},"additionalProperties":false},"sectionTemplate":{"maxItems":12,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"title":{"type":"string","minLength":1,"maxLength":200},"type":{"type":"string","enum":["TEXT","CHECKLIST","ATTACHMENTS"]},"visible":{"type":"boolean"},"required":{"type":"boolean"},"placeholder":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]}},"required":["title","type"],"additionalProperties":false}},"visibility":{}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}/access":{"get":{"operationId":"getBoardsByIdAccess","summary":"Who can see a board","description":"Who can see a board. Requires the API key scope `tasks:view` (or a user token whose role grants it).","x-required-scope":"tasks:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}/columns":{"post":{"operationId":"postBoardsByIdColumns","summary":"Add a column","description":"Add a column. Requires the API key scope `tasks:create` (or a user token whose role grants it).","x-required-scope":"tasks:create","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"color":{"anyOf":[{"type":"string","maxLength":30},{"type":"null"}]},"isDone":{"type":"boolean"},"category":{"type":"string","enum":["BACKLOG","UNSTARTED","STARTED","COMPLETED","CANCELED"]},"requiresComplete":{"type":"boolean"}},"required":["name"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}/columns/{columnId}":{"patch":{"operationId":"patchBoardsByIdColumnsByColumnId","summary":"Update a column","description":"Update a column. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"columnId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"color":{"anyOf":[{"type":"string","maxLength":30},{"type":"null"}]},"isDone":{"type":"boolean"},"category":{"type":"string","enum":["BACKLOG","UNSTARTED","STARTED","COMPLETED","CANCELED"]},"requiresComplete":{"type":"boolean"},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteBoardsByIdColumnsByColumnId","summary":"Delete a column","description":"Delete a column. Requires the API key scope `tasks:delete` (or a user token whose role grants it).","x-required-scope":"tasks:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"columnId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}/labels":{"post":{"operationId":"postBoardsByIdLabels","summary":"Add a label","description":"Add a label. Requires the API key scope `tasks:create` (or a user token whose role grants it).","x-required-scope":"tasks:create","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"color":{"anyOf":[{"type":"string","enum":["green","yellow","orange","red","purple","blue","sky","lime","pink","gray","teal","cyan","indigo","violet","fuchsia","rose","amber","emerald","brown","charcoal"]},{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"}]}},"required":["name","color"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}/labels/{labelId}":{"patch":{"operationId":"patchBoardsByIdLabelsByLabelId","summary":"Update a label","description":"Update a label. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"labelId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"color":{"anyOf":[{"type":"string","enum":["green","yellow","orange","red","purple","blue","sky","lime","pink","gray","teal","cyan","indigo","violet","fuchsia","rose","amber","emerald","brown","charcoal"]},{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"}]},"position":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteBoardsByIdLabelsByLabelId","summary":"Delete a label","description":"Delete a label. Requires the API key scope `tasks:delete` (or a user token whose role grants it).","x-required-scope":"tasks:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"labelId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}/fields":{"post":{"operationId":"postBoardsByIdFields","summary":"Add a custom field","description":"Add a custom field. Requires the API key scope `tasks:create` (or a user token whose role grants it).","x-required-scope":"tasks:create","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"type":{"type":"string","enum":["text","number","date","checkbox","url","select"]},"options":{"maxItems":40,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":40},"color":{"anyOf":[{"type":"string","maxLength":30},{"type":"null"}]},"archived":{"type":"boolean"}},"required":["name"],"additionalProperties":false}}},"required":["name","type"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/boards/{id}/fields/{fieldId}":{"patch":{"operationId":"patchBoardsByIdFieldsByFieldId","summary":"Update a custom field","description":"Update a custom field. Requires the API key scope `tasks:edit` (or a user token whose role grants it).","x-required-scope":"tasks:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"fieldId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":40},"type":{"type":"string","enum":["text","number","date","checkbox","url","select"]},"options":{"maxItems":40,"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"name":{"type":"string","minLength":1,"maxLength":40},"color":{"anyOf":[{"type":"string","maxLength":30},{"type":"null"}]},"archived":{"type":"boolean"}},"required":["name"],"additionalProperties":false}}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteBoardsByIdFieldsByFieldId","summary":"Delete a custom field","description":"Delete a custom field. Requires the API key scope `tasks:delete` (or a user token whose role grants it).","x-required-scope":"tasks:delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"fieldId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/catalog":{"get":{"operationId":"getCatalog","summary":"List products and services","description":"List products and services. Requires the API key scope `catalog:view` (or a user token whose role grants it).","x-required-scope":"catalog:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tax-rates":{"get":{"operationId":"getTaxRates","summary":"List tax rates","description":"List tax rates. Requires the API key scope `catalog:view` (or a user token whose role grants it).","x-required-scope":"catalog:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/tags":{"get":{"operationId":"getTags","summary":"List customer tags","description":"List customer tags. Requires the API key scope `clients:view` (or a user token whose role grants it).","x-required-scope":"clients:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/search":{"get":{"operationId":"getSearch","summary":"Search across records","description":"Search across records. Requires the API key scope `clients:view` (or a user token whose role grants it).","x-required-scope":"clients:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/recent":{"get":{"operationId":"getRecent","summary":"Recently opened records","description":"Recently opened records. Requires the API key scope `clients:view` (or a user token whose role grants it).","x-required-scope":"clients:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/quick-links":{"get":{"operationId":"getQuickLinks","summary":"Public quick links","description":"Public quick links. Requires the API key scope `public:view` (or a user token whose role grants it).","x-required-scope":"public:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/review-links":{"get":{"operationId":"getReviewLinks","summary":"Review-funnel links","description":"Review-funnel links. Requires the API key scope `public:view` (or a user token whose role grants it).","x-required-scope":"public:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls":{"post":{"operationId":"postCalls","summary":"Place a call","description":"Place a call. Requires a user access token whose role grants `inbox:create`; a company API key is refused (403 `user_token_required`).","x-required-scope":"inbox:create","x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1,"maxLength":64},"toNumber":{"anyOf":[{"type":"string","minLength":1,"maxLength":32},{"type":"null"}]},"conversationId":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"fromNumberId":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]}},"required":["customerId"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls/start":{"post":{"operationId":"postCallsStart","summary":"Start a call from the phone","description":"Start a call from the phone. Requires a user access token whose role grants `inbox:create`; a company API key is refused (403 `user_token_required`).","x-required-scope":"inbox:create","x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"number":{"anyOf":[{"type":"string","minLength":1,"maxLength":32},{"type":"null"}]},"conversationId":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]},"fromNumberId":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls/softphone-token":{"post":{"operationId":"postCallsSoftphoneToken","summary":"Mint a softphone token","description":"Mint a softphone token. Requires a user access token whose role grants one of `calls:receive`; a company API key is refused (403 `user_token_required`).","x-role-grants-any-of":["calls:receive"],"x-user-token-only":true,"parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/calls/{id}/recording":{"get":{"operationId":"getCallsByIdRecording","summary":"Stream a call recording","description":"Stream a call recording. Requires a user access token whose role grants `inbox:view`; a company API key is refused (403 `user_token_required`).","x-required-scope":"inbox:view","x-user-token-only":true,"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/threads":{"get":{"operationId":"getInboxThreads","summary":"List inbox threads","description":"List inbox threads. Requires the API key scope `inbox:view` (or a user token whose role grants it).","x-required-scope":"inbox:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postInboxThreads","summary":"Start an inbox thread","description":"Start an inbox thread. Requires the API key scope `inbox:create` (or a user token whose role grants it).","x-required-scope":"inbox:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"customerId":{"type":"string","minLength":1,"maxLength":64},"toNumber":{"type":"string","minLength":1,"maxLength":40},"text":{"type":"string","minLength":1,"maxLength":10000}},"required":["customerId","toNumber","text"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/threads/{id}/messages":{"get":{"operationId":"getInboxThreadsByIdMessages","summary":"List messages of a thread","description":"List messages of a thread. Requires the API key scope `inbox:view` (or a user token whose role grants it).","x-required-scope":"inbox:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postInboxThreadsByIdMessages","summary":"Send a message in a thread","description":"Send a message in a thread. Requires the API key scope `inbox:create` (or a user token whose role grants it).","x-required-scope":"inbox:create","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":10000},"subject":{"type":"string","maxLength":200}},"required":["text"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/threads/{id}/owner":{"post":{"operationId":"postInboxThreadsByIdOwner","summary":"Assign a thread owner","description":"Assign a thread owner. Requires the API key scope `inbox:edit` (or a user token whose role grants it).","x-required-scope":"inbox:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"anyOf":[{"type":"string","minLength":1,"maxLength":64},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/threads/{id}/read":{"post":{"operationId":"postInboxThreadsByIdRead","summary":"Mark a thread read","description":"Mark a thread read. Requires the API key scope `inbox:view` (or a user token whose role grants it).","x-required-scope":"inbox:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/threads/{id}/handled":{"post":{"operationId":"postInboxThreadsByIdHandled","summary":"Mark a thread handled","description":"Mark a thread handled. Requires the API key scope `inbox:edit` (or a user token whose role grants it).","x-required-scope":"inbox:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"handled":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/threads/{id}/archive":{"post":{"operationId":"postInboxThreadsByIdArchive","summary":"Archive or unarchive a thread","description":"Archive or unarchive a thread. Requires the API key scope `inbox:edit` (or a user token whose role grants it).","x-required-scope":"inbox:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"archived":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/threads/{id}/spam":{"post":{"operationId":"postInboxThreadsByIdSpam","summary":"Mark a thread as spam or not spam","description":"Mark a thread as spam or not spam. Requires the API key scope `inbox:edit` (or a user token whose role grants it).","x-required-scope":"inbox:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"spam":{"type":"boolean"},"blockDomain":{"type":"boolean"}},"required":["spam"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/scripts":{"get":{"operationId":"getInboxScripts","summary":"List message scripts","description":"List message scripts. Requires the API key scope `inbox:view` (or a user token whose role grants it).","x-required-scope":"inbox:view","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/inbox/attachments/{id}":{"get":{"operationId":"getInboxAttachmentsById","summary":"Download an inbox attachment","description":"Download an inbox attachment. Requires the API key scope `inbox:view` (or a user token whose role grants it).","x-required-scope":"inbox:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/approvals":{"post":{"operationId":"postApprovals","summary":"Ask a person to approve sending an invoice or a quote, recording a payment (`COLLECT_PAYMENT`) or refunding one (`REFUND_PAYMENT`) — nothing happens until approved (also needs `invoices:view` / `quotes:view`, money types `invoices:view` + `payments:view`; a company API key only, a user token gets 403 `api_key_required`; a live PENDING identical request answers 200)","description":"Ask a person to approve sending an invoice or a quote, recording a payment (`COLLECT_PAYMENT`) or refunding one (`REFUND_PAYMENT`) — nothing happens until approved (also needs `invoices:view` / `quotes:view`, money types `invoices:view` + `payments:view`; a company API key only, a user token gets 403 `api_key_required`; a live PENDING identical request answers 200). Requires the API key scope `approvals:create` (or a user token whose role grants it).","x-required-scope":"approvals:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"actionType":{"type":"string","const":"SEND_INVOICE"},"entityId":{"type":"string","minLength":1}},"required":["actionType","entityId"],"additionalProperties":false},{"type":"object","properties":{"actionType":{"type":"string","const":"SEND_QUOTE"},"entityId":{"type":"string","minLength":1}},"required":["actionType","entityId"],"additionalProperties":false},{"type":"object","properties":{"actionType":{"type":"string","const":"COLLECT_PAYMENT"},"entityId":{"type":"string","minLength":1},"amount":{"type":"number","exclusiveMinimum":0,"maximum":10000000},"tipAmount":{"type":"number","minimum":0,"maximum":10000000},"method":{"type":"string","minLength":1,"maxLength":64},"walletId":{"type":"string","minLength":1,"maxLength":100},"notes":{"type":"string","maxLength":2000}},"required":["actionType","entityId","amount","method"],"additionalProperties":false},{"type":"object","properties":{"actionType":{"type":"string","const":"REFUND_PAYMENT"},"entityId":{"type":"string","minLength":1},"amount":{"type":"number","exclusiveMinimum":0,"maximum":10000000},"reason":{"type":"string","maxLength":2000},"walletId":{"type":"string","minLength":1,"maxLength":100},"refundPortion":{"type":"string","enum":["BOTH","BILL","TIP"]}},"required":["actionType","entityId","amount"],"additionalProperties":false}]}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/approvals/{id}":{"get":{"operationId":"getApprovalsById","summary":"Where an approval request stands (also needs `invoices:view` / `quotes:view`, money types `invoices:view` + `payments:view`; a company API key only; a card refund Stripe did not confirm stays EXECUTING with `result.refundUnansweredAt` until a person retries — never ask again)","description":"Where an approval request stands (also needs `invoices:view` / `quotes:view`, money types `invoices:view` + `payments:view`; a company API key only; a card refund Stripe did not confirm stays EXECUTING with `result.refundUnansweredAt` until a person retries — never ask again). Requires the API key scope `approvals:view` (or a user token whose role grants it).","x-required-scope":"approvals:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wiki/pages":{"get":{"operationId":"getWikiPages","summary":"List wiki pages","description":"List wiki pages. Requires the API key scope `wiki:view` (or a user token whose role grants it).","x-required-scope":"wiki:view","parameters":[{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque cursor from the previous page’s `pagination.nextCursor`."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":25}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"postWikiPages","summary":"Create a wiki page","description":"Create a wiki page. Requires the API key scope `wiki:create` (or a user token whose role grants it).","x-required-scope":"wiki:create","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"parentId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"contentJson":{}},"required":["title"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/wiki/pages/{id}":{"get":{"operationId":"getWikiPagesById","summary":"Get a wiki page","description":"Get a wiki page. Requires the API key scope `wiki:view` (or a user token whose role grants it).","x-required-scope":"wiki:view","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchWikiPagesById","summary":"Update or archive a wiki page (setting `archived` also needs `wiki:delete`; a body with only `archived` needs `wiki:delete` alone)","description":"Update or archive a wiki page (setting `archived` also needs `wiki:delete`; a body with only `archived` needs `wiki:delete` alone). Requires the API key scope `wiki:edit` (or a user token whose role grants it).","x-required-scope":"wiki:edit","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"parentId":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}]},"contentJson":{},"expectedUpdatedAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"}]},"archived":{"type":"boolean"}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"operationId":"getOpenapi.json","summary":"This API as an OpenAPI 3.1 document","description":"This API as an OpenAPI 3.1 document.","security":[],"parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mcp":{"post":{"operationId":"postMcp","summary":"MCP endpoint (Streamable HTTP, JSON-RPC)","description":"MCP endpoint (Streamable HTTP, JSON-RPC). Requires a company API key; a user token is refused.","parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"getMcp","summary":"Not supported: the MCP server is stateless (405)","description":"Not supported: the MCP server is stateless (405).","security":[],"parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteMcp","summary":"Not supported: the MCP server is stateless (405)","description":"Not supported: the MCP server is stateless (405).","security":[],"parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mobile/session":{"get":{"operationId":"getMobileSession","summary":"Current session, role and enabled modules","description":"Current session, role and enabled modules. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mobile/version":{"get":{"operationId":"getMobileVersion","summary":"Minimum supported app version","description":"Minimum supported app version.","security":[],"parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mobile/shift":{"put":{"operationId":"putMobileShift","summary":"Go on or off shift","description":"Go on or off shift. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"onShift":{"type":"boolean"}},"required":["onShift"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mobile/devices":{"put":{"operationId":"putMobileDevices","summary":"Register a push device","description":"Register a push device. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"string","minLength":1,"maxLength":128},"platform":{"type":"string","enum":["ios","android"]},"expoPushToken":{"type":"string","maxLength":256}},"required":["deviceId","platform","expoPushToken"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mobile/devices/{deviceId}":{"delete":{"operationId":"deleteMobileDevicesByDeviceId","summary":"Unregister a push device","description":"Unregister a push device. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[{"name":"deviceId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mobile/devices/{deviceId}/call-receiver":{"put":{"operationId":"putMobileDevicesByDeviceIdCallReceiver","summary":"Enable incoming calls on a device","description":"Enable incoming calls on a device. Requires a user access token whose role grants one of `calls:receive`; a company API key is refused (403 `user_token_required`).","x-role-grants-any-of":["calls:receive"],"x-user-token-only":true,"parameters":[{"name":"deviceId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"voipPushToken":{"type":"string","minLength":1,"maxLength":512},"platform":{"type":"string","enum":["ios","android"]}},"required":["voipPushToken"],"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteMobileDevicesByDeviceIdCallReceiver","summary":"Disable incoming calls on a device","description":"Disable incoming calls on a device. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[{"name":"deviceId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/mobile/notification-settings":{"get":{"operationId":"getMobileNotificationSettings","summary":"The caller's own daily agenda: company default plus personal override and mute","description":"The caller's own daily agenda: company default plus personal override and mute. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[],"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"patchMobileNotificationSettings","summary":"Set the caller's own daily agenda time override or mute it","description":"Set the caller's own daily agenda time override or mute it. Requires a user access token; a company API key is refused (403 `user_token_required`).","x-user-token-only":true,"parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"dailyAgendaEnabled":{"type":"boolean"},"dailyAgendaTimingOverride":{"anyOf":[{"type":"string","enum":["SAME_DAY","DAY_BEFORE"]},{"type":"null"}]},"dailyAgendaMinuteOverride":{"anyOf":[{"type":"integer","minimum":0,"maximum":1425},{"type":"null"}]}},"additionalProperties":false}}}},"responses":{"200":{"description":"Success. Single resources answer `{ data }`, lists `{ data, pagination }`."},"default":{"description":"Error envelope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}