{"openapi":"3.1.0","info":{"title":"trustmy API","description":"Queue SMS and let Android gateway phones claim and send them. Admin token for operators (Phase 1); device token for gateway phones.","version":"0.1.0"},"components":{"securitySchemes":{"adminToken":{"type":"http","scheme":"bearer","description":"Operator token (ADMIN_TOKEN)"},"deviceToken":{"type":"http","scheme":"bearer","description":"Per-device token from createDevice"},"session":{"type":"apiKey","in":"cookie","name":"__Secure-better-auth.session_token","description":"Customer session from sign-in"},"partnerKey":{"type":"http","scheme":"bearer","description":"A partner platform's key (PARTNER_KEYS, D39)"},"apiKey":{"type":"http","scheme":"bearer","description":"Organisation API key (`tmk_...`), made under Settings → API keys. For sending from other systems."}}},"paths":{"/v1/devices":{"post":{"operationId":"createDevice","tags":["Devices"],"summary":"Register a gateway phone","description":"Creates a device and returns its bearer token once. Enter the token in the gateway app.","security":[{"adminToken":[]}],"responses":{"201":{"description":"Device created","content":{"application/json":{"schema":{"type":"object","properties":{"device":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"orgId":{"description":"Owning organisation for a customer's own phone; null for a trustmy phone (D23)","type":["string","null"]},"phoneNumber":{"description":"The SIM's number in E.164, when the owner entered it","type":["string","null"]},"dailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Max messages claimed per rolling 24 h. 0 means unlimited."},"nextSendAt":{"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))$"},{"type":"null"}]},"lastSeenAt":{"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))$"},{"type":"null"}]},"createdAt":{"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":["id","name","orgId","phoneNumber","dailyCap","nextSendAt","lastSeenAt","createdAt"]},"token":{"type":"string","description":"Device bearer token. Shown once; only its hash is stored."}},"required":["device","token"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"dailyCap":{"default":200,"type":"integer","minimum":0,"maximum":100000}},"required":["name"]}}}}},"get":{"operationId":"listDevices","tags":["Devices"],"summary":"List gateway phones","security":[{"adminToken":[]}],"responses":{"200":{"description":"Devices, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"devices":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"orgId":{"description":"Owning organisation for a customer's own phone; null for a trustmy phone (D23)","type":["string","null"]},"phoneNumber":{"description":"The SIM's number in E.164, when the owner entered it","type":["string","null"]},"dailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Max messages claimed per rolling 24 h. 0 means unlimited."},"nextSendAt":{"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))$"},{"type":"null"}]},"lastSeenAt":{"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))$"},{"type":"null"}]},"createdAt":{"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":["id","name","orgId","phoneNumber","dailyCap","nextSendAt","lastSeenAt","createdAt"]}}},"required":["devices"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/devices/pair":{"post":{"operationId":"pairDevice","tags":["Gateway"],"summary":"Pair a customer's phone with a one-time code","description":"Called by the trustmy app with a code from `createPairingCode`. No auth: the code is the credential. Returns the device and its bearer token once. Wrong, used and expired codes all give `pairing_code_invalid`.","responses":{"201":{"description":"Phone paired","content":{"application/json":{"schema":{"type":"object","properties":{"device":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"orgId":{"description":"Owning organisation for a customer's own phone; null for a trustmy phone (D23)","type":["string","null"]},"phoneNumber":{"description":"The SIM's number in E.164, when the owner entered it","type":["string","null"]},"dailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Max messages claimed per rolling 24 h. 0 means unlimited."},"nextSendAt":{"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))$"},{"type":"null"}]},"lastSeenAt":{"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))$"},{"type":"null"}]},"createdAt":{"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":["id","name","orgId","phoneNumber","dailyCap","nextSendAt","lastSeenAt","createdAt"]},"token":{"type":"string","description":"Device bearer token. Shown once; only its hash is stored."}},"required":["device","token"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","minLength":8,"maxLength":16,"description":"Pairing code from the dashboard, e.g. `ABCD-EFGH`; case and dashes are ignored"},"name":{"type":"string","minLength":1,"maxLength":80,"description":"Shown in the dashboard, e.g. the phone model"},"phoneNumber":{"description":"The SIM's number, so the dashboard can show who messages come from","type":"string","maxLength":32}},"required":["code","name"]}}}}}},"/v1/devices/{id}/heartbeat":{"post":{"operationId":"deviceHeartbeat","tags":["Gateway"],"summary":"Report that the phone is alive","description":"Updates `lastSeenAt`. Claims also count as heartbeats.","security":[{"deviceToken":[]}],"responses":{"200":{"description":"Heartbeat recorded","content":{"application/json":{"schema":{"type":"object","properties":{"device":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"orgId":{"description":"Owning organisation for a customer's own phone; null for a trustmy phone (D23)","type":["string","null"]},"phoneNumber":{"description":"The SIM's number in E.164, when the owner entered it","type":["string","null"]},"dailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Max messages claimed per rolling 24 h. 0 means unlimited."},"nextSendAt":{"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))$"},{"type":"null"}]},"lastSeenAt":{"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))$"},{"type":"null"}]},"createdAt":{"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":["id","name","orgId","phoneNumber","dailyCap","nextSendAt","lastSeenAt","createdAt"]},"serverTime":{"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":["device","serverTime"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/devices/{id}/claim":{"post":{"operationId":"claimMessages","tags":["Gateway"],"summary":"Pull queued messages to send","description":"Atomically claims up to `limit` queued messages for this device. Each comes with a `sendAfter`; the device must not send earlier. When the server withholds work for carrier safety (quiet hours, pacing, daily cap) `holdReason` says why. Always wait `pollAfterMs` before the next claim.","security":[{"deviceToken":[]}],"responses":{"200":{"description":"Claimed messages, possibly none","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"to":{"type":"string"},"body":{"type":"string"},"sendAfter":{"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))$","description":"Do not send before this time. Compare against `serverTime`, not the phone clock."}},"required":["id","to","body","sendAfter"]}},"serverTime":{"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))$"},"pollAfterMs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"How long the device should wait before claiming again"},"holdReason":{"anyOf":[{"type":"string","enum":["quiet_hours","pacing","daily_cap"]},{"type":"null"}],"description":"Set when the server withheld work for carrier safety"}},"required":["messages","serverTime","pollAfterMs","holdReason"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"default":1,"type":"integer","minimum":1,"maximum":10}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/devices/{id}/inbound":{"post":{"operationId":"reportInbound","tags":["Gateway"],"summary":"Forward an SMS the phone received","description":"Stores the reply for the matching organisation. An opt-out (STOP, AFMELD, FRAMELD, NEJ TAK, UNSUBSCRIBE) blocks the number for that organisation at once, including its queued messages to it. Send the same `ref` when retrying; a repeat is stored once.","security":[{"deviceToken":[]}],"responses":{"201":{"description":"Stored","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"stop":{"type":"boolean","description":"The reply was an opt-out; the sender is now blocked for the organisation"}},"required":["id","stop"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ref":{"type":"string","minLength":1,"maxLength":64,"description":"Id the phone gives the SMS, so a retried report is stored once"},"from":{"type":"string","minLength":1,"maxLength":32,"description":"Sender as the phone received it"},"body":{"type":"string","maxLength":1600},"receivedAt":{"description":"When the phone received it. Defaults to server time; never later than server time.","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":["ref","from","body"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/messages":{"post":{"operationId":"queueMessage","tags":["Messages"],"summary":"Queue a message for sending","description":"Normalises `to` to E.164 (default country DK). With a session or API key it goes on the organisation's default route unless `route` says otherwise: `phone` (free, paced, company name first) or `api` (instant, company name as sender, charged in credits). Blocked numbers are marked `blocked`. `sendAt` schedules it.","security":[{"adminToken":[]},{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Message queued","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"to":{"type":"string","description":"Recipient in E.164"},"body":{"type":"string"},"status":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"deviceId":{"type":["string","null"]},"sendAfter":{"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))$"},{"type":"null"}],"description":"Earliest time the device may send this message"},"error":{"type":["string","null"]},"createdAt":{"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))$"},"claimedAt":{"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))$"},{"type":"null"}]},"sentAt":{"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))$"},{"type":"null"}]},"deliveredAt":{"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))$"},{"type":"null"}]},"contactId":{"type":["string","null"]},"campaignId":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"sender":{"description":"Alphanumeric sender on the paid tier; null on the phone tier, where the phone's number shows","type":["string","null"]},"scheduledAt":{"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))$"},{"type":"null"}],"description":"Not sent before this time"},"priceOre":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"Credits charged, in øre (paid tier only)"}},"required":["id","to","body","status","deviceId","sendAfter","error","createdAt","claimedAt","sentAt","deliveredAt","contactId","campaignId","route","category","sender","scheduledAt","priceOre"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"Not enough credit (`insufficient_credits`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","minLength":3,"maxLength":32,"description":"Recipient phone number. E.164, or a national number in the default country (DK)."},"body":{"type":"string","minLength":1,"maxLength":1600},"route":{"description":"Defaults to the organisation's default route","type":"string","enum":["phone","api"]},"category":{"default":"service","type":"string","enum":["service","marketing","code"]},"sendAt":{"description":"Schedule for later; omitted means now","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))$"},"replyTo":{"description":"A reply's id: the answer goes out from the phone that received it (D26)","type":"string"}},"required":["to","body"]}}}}},"get":{"operationId":"listMessages","tags":["Messages"],"summary":"List messages, newest first","description":"A customer session sees its own organisation's messages; the operator token sees all.","security":[{"adminToken":[]},{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Messages","content":{"application/json":{"schema":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"to":{"type":"string","description":"Recipient in E.164"},"body":{"type":"string"},"status":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"deviceId":{"type":["string","null"]},"sendAfter":{"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))$"},{"type":"null"}],"description":"Earliest time the device may send this message"},"error":{"type":["string","null"]},"createdAt":{"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))$"},"claimedAt":{"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))$"},{"type":"null"}]},"sentAt":{"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))$"},{"type":"null"}]},"deliveredAt":{"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))$"},{"type":"null"}]},"contactId":{"type":["string","null"]},"campaignId":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"sender":{"description":"Alphanumeric sender on the paid tier; null on the phone tier, where the phone's number shows","type":["string","null"]},"scheduledAt":{"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))$"},{"type":"null"}],"description":"Not sent before this time"},"priceOre":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"Credits charged, in øre (paid tier only)"}},"required":["id","to","body","status","deviceId","sendAfter","error","createdAt","claimedAt","sentAt","deliveredAt","contactId","campaignId","route","category","sender","scheduledAt","priceOre"]}}},"required":["messages"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"in":"query","name":"status","schema":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]}},{"in":"query","name":"campaignId","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"default":50,"type":"integer","minimum":1,"maximum":100}}]}},"/v1/messages/{id}":{"get":{"operationId":"getMessage","tags":["Messages"],"summary":"Get one message with its delivery timeline","security":[{"adminToken":[]},{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Message","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"to":{"type":"string","description":"Recipient in E.164"},"body":{"type":"string"},"status":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"deviceId":{"type":["string","null"]},"sendAfter":{"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))$"},{"type":"null"}],"description":"Earliest time the device may send this message"},"error":{"type":["string","null"]},"createdAt":{"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))$"},"claimedAt":{"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))$"},{"type":"null"}]},"sentAt":{"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))$"},{"type":"null"}]},"deliveredAt":{"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))$"},{"type":"null"}]},"contactId":{"type":["string","null"]},"campaignId":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"sender":{"description":"Alphanumeric sender on the paid tier; null on the phone tier, where the phone's number shows","type":["string","null"]},"scheduledAt":{"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))$"},{"type":"null"}],"description":"Not sent before this time"},"priceOre":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"Credits charged, in øre (paid tier only)"}},"required":["id","to","body","status","deviceId","sendAfter","error","createdAt","claimedAt","sentAt","deliveredAt","contactId","campaignId","route","category","sender","scheduledAt","priceOre"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/messages/{id}/retry":{"post":{"operationId":"retryMessage","tags":["Messages"],"summary":"Send one failed message again","description":"As `retryCampaign`, for one message. 409 unless the message has status `failed`.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Queued again","content":{"application/json":{"schema":{"type":"object","properties":{"retried":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Failed messages queued again"},"blocked":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Not sent again, because the number opted out since"},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credit charged for paid messages sent again"}},"required":["retried","blocked","priceOre"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"Not enough credit (`insufficient_credits`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/messages/{id}/status":{"post":{"operationId":"reportMessageStatus","tags":["Gateway"],"summary":"Report sent, delivered or failed","description":"Called by the device that claimed the message. Allowed: claimed→sent, claimed|sent→delivered, claimed|sent→failed. Repeating the current status is a no-op, so retries are safe. A message not reported on within 5 minutes becomes `failed` (`phone_no_confirmation`); a late report from the same device still applies.","security":[{"deviceToken":[]}],"responses":{"200":{"description":"Updated message","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"to":{"type":"string","description":"Recipient in E.164"},"body":{"type":"string"},"status":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"deviceId":{"type":["string","null"]},"sendAfter":{"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))$"},{"type":"null"}],"description":"Earliest time the device may send this message"},"error":{"type":["string","null"]},"createdAt":{"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))$"},"claimedAt":{"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))$"},{"type":"null"}]},"sentAt":{"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))$"},{"type":"null"}]},"deliveredAt":{"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))$"},{"type":"null"}]},"contactId":{"type":["string","null"]},"campaignId":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"sender":{"description":"Alphanumeric sender on the paid tier; null on the phone tier, where the phone's number shows","type":["string","null"]},"scheduledAt":{"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))$"},{"type":"null"}],"description":"Not sent before this time"},"priceOre":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"Credits charged, in øre (paid tier only)"}},"required":["id","to","body","status","deviceId","sendAfter","error","createdAt","claimedAt","sentAt","deliveredAt","contactId","campaignId","route","category","sender","scheduledAt","priceOre"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["sent","delivered","failed"]},"error":{"description":"Failure reason reported by the device; only stored for `failed`","type":"string","maxLength":500},"occurredAt":{"description":"When the device observed the event. Defaults to server time; never later than server time.","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":["status"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/signup":{"post":{"operationId":"signup","tags":["Account"],"summary":"Create a user and their organisation","description":"Sets the session cookie. The organisation can send once trustmy approves it (D21).","responses":{"200":{"description":"Signed up; session cookie set"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"company":{"type":"string","minLength":1,"maxLength":60},"email":{"type":"string","maxLength":200,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"password":{"type":"string","minLength":10,"maxLength":200}},"required":["name","company","email","password"]}}}}}},"/v1/me":{"get":{"operationId":"getMe","tags":["Account"],"summary":"Signed-in user, organisation and last-24 h numbers","security":[{"session":[]}],"responses":{"200":{"description":"Account overview","content":{"application/json":{"schema":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}},"required":["id","name","email"]},"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"trusted":{"type":"boolean","description":"False until trustmy approves the organisation to send from its phones (D21)"},"canSend":{"type":"boolean","description":"True when the organisation has a paired phone of its own, or is approved (D23)"}},"required":["id","name","slug","trusted","canSend"]},"contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last24h":{"type":"object","propertyNames":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["queued","claimed","sent","delivered","failed","blocked"]},"gateway":{"type":"object","properties":{"mode":{"type":"string","enum":["own","pool"],"description":"`own`: the organisation's paired phones send its messages. `pool`: trustmy's phones do (D23)."},"online":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Phones in this sending mode seen in the last 5 minutes"},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["mode","online","total"]},"paid":{"type":"object","properties":{"available":{"type":"boolean","description":"trustmy has a paid SMS provider configured"},"canSend":{"type":"boolean","description":"Available, approved, and credits left"},"balanceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Price per SMS part on the paid tier, in øre"},"senderName":{"type":["string","null"]},"defaultRoute":{"type":"string","enum":["phone","api"]}},"required":["available","canSend","balanceOre","priceOre","senderName","defaultRoute"]},"webhookUrl":{"type":["string","null"]},"sending":{"type":"object","properties":{"from":{"type":"string","description":"Texts go out from this time, HH:MM Copenhagen time"},"until":{"type":"string","description":"and until this time"},"earliest":{"type":"string","description":"trustmy's earliest: `from` can be no earlier"},"latest":{"type":"string","description":"trustmy's latest: `until` can be no later"},"phoneDailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"How many texts each of the organisation's own phones sends in 24 h"},"nightUntil":{"description":"Night sending is on until this time (D38): own phones also send between `until` and `from`","type":["string","null"]}},"required":["from","until","earliest","latest","phoneDailyCap","nightUntil"],"description":"When and how much the organisation's texts go out (D35)"}},"required":["user","organization","contacts","last24h","gateway","paid","webhookUrl","sending"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/organization":{"get":{"operationId":"getOrganization","tags":["Account"],"summary":"The organisation's state: approval, phones, credit, sending hours, last-24 h numbers","description":"`getMe` without the signed-in person, so an API key can read it too.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Organisation","content":{"application/json":{"schema":{"type":"object","properties":{"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"trusted":{"type":"boolean","description":"False until trustmy approves the organisation to send from its phones (D21)"},"canSend":{"type":"boolean","description":"True when the organisation has a paired phone of its own, or is approved (D23)"}},"required":["id","name","slug","trusted","canSend"]},"contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last24h":{"type":"object","propertyNames":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["queued","claimed","sent","delivered","failed","blocked"]},"gateway":{"type":"object","properties":{"mode":{"type":"string","enum":["own","pool"],"description":"`own`: the organisation's paired phones send its messages. `pool`: trustmy's phones do (D23)."},"online":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Phones in this sending mode seen in the last 5 minutes"},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["mode","online","total"]},"paid":{"type":"object","properties":{"available":{"type":"boolean","description":"trustmy has a paid SMS provider configured"},"canSend":{"type":"boolean","description":"Available, approved, and credits left"},"balanceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Price per SMS part on the paid tier, in øre"},"senderName":{"type":["string","null"]},"defaultRoute":{"type":"string","enum":["phone","api"]}},"required":["available","canSend","balanceOre","priceOre","senderName","defaultRoute"]},"webhookUrl":{"type":["string","null"]},"sending":{"type":"object","properties":{"from":{"type":"string","description":"Texts go out from this time, HH:MM Copenhagen time"},"until":{"type":"string","description":"and until this time"},"earliest":{"type":"string","description":"trustmy's earliest: `from` can be no earlier"},"latest":{"type":"string","description":"trustmy's latest: `until` can be no later"},"phoneDailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"How many texts each of the organisation's own phones sends in 24 h"},"nightUntil":{"description":"Night sending is on until this time (D38): own phones also send between `until` and `from`","type":["string","null"]}},"required":["from","until","earliest","latest","phoneDailyCap","nightUntil"],"description":"When and how much the organisation's texts go out (D35)"}},"required":["organization","contacts","last24h","gateway","paid","webhookUrl","sending"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"patch":{"operationId":"updateOrganization","tags":["Account"],"summary":"Rename the organisation (also the message prefix)","security":[{"session":[]}],"responses":{"204":{"description":"Updated"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"description":"Company name; also the prefix on phone-tier messages","type":"string","minLength":1,"maxLength":60},"senderName":{"description":"Paid-tier sender: 1-11 letters, digits or spaces","anyOf":[{"type":"string","maxLength":11},{"type":"null"}]},"defaultRoute":{"type":"string","enum":["phone","api"]},"webhookUrl":{"description":"Receives message and reply events","anyOf":[{"type":"string","maxLength":500,"format":"uri"},{"type":"null"}]},"sendFrom":{"description":"Texts go out from this time, Copenhagen time, between trustmy's 08:00 and 12:00; null resets to 08:00","anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"},{"type":"null"}]},"sendUntil":{"description":"Texts go out until this time, between 14:00 and trustmy's 21:00; null resets to 21:00","anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"},{"type":"null"}]},"phoneDailyCap":{"description":"Texts per day for each of the organisation's own phones, 10 to 500; null resets to 200","anyOf":[{"type":"integer","minimum":10,"maximum":500},{"type":"null"}]}}}}}}}},"/v1/contacts":{"get":{"operationId":"listContacts","tags":["Contacts"],"summary":"List contacts, newest first","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Contacts","content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"phone":{"type":"string","description":"E.164"},"name":{"type":["string","null"]},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"consentSource":{"type":"string","description":"How the contact agreed to receive messages, e.g. `manual` or `csv:kunder.csv`"},"consentAt":{"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))$"},"optedOutAt":{"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))$"},{"type":"null"}],"description":"Set when the contact replied STOP or was blocked"},"tags":{"type":"array","items":{"type":"string"},"description":"Groups, e.g. `vip` or `hold-a`; send to a tag from the composer"},"createdAt":{"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":["id","phone","name","fields","consentSource","consentAt","optedOutAt","tags","createdAt"]}}},"required":["contacts"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"post":{"operationId":"createContact","tags":["Contacts"],"summary":"Add a contact who agreed to receive messages","security":[{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Contact created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"phone":{"type":"string","description":"E.164"},"name":{"type":["string","null"]},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"consentSource":{"type":"string","description":"How the contact agreed to receive messages, e.g. `manual` or `csv:kunder.csv`"},"consentAt":{"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))$"},"optedOutAt":{"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))$"},{"type":"null"}],"description":"Set when the contact replied STOP or was blocked"},"tags":{"type":"array","items":{"type":"string"},"description":"Groups, e.g. `vip` or `hold-a`; send to a tag from the composer"},"createdAt":{"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":["id","phone","name","fields","consentSource","consentAt","optedOutAt","tags","createdAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string","minLength":3,"maxLength":32},"name":{"type":"string","maxLength":120},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":40},"additionalProperties":{"type":"string","maxLength":200}},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":32}},"consent":{"type":"boolean","const":true,"description":"The customer confirms the contact agreed to receive messages"}},"required":["phone","consent"]}}}}}},"/v1/contacts/import":{"post":{"operationId":"importContacts","tags":["Contacts"],"summary":"Import contacts (parsed CSV rows); upserts by phone number","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Import result","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"updated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"invalid":{"type":"array","items":{"type":"object","properties":{"row":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"phone":{"type":"string"}},"required":["row","phone"]}}},"required":["created","updated","invalid"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"minItems":1,"maxItems":5000,"type":"array","items":{"type":"object","properties":{"phone":{"type":"string","maxLength":64},"name":{"type":"string","maxLength":120},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":40},"additionalProperties":{"type":"string","maxLength":200}},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":32}}},"required":["phone"]}},"consent":{"type":"boolean","const":true},"source":{"type":"string","minLength":1,"maxLength":120,"description":"Shown as the consent source, e.g. the file name"}},"required":["contacts","consent","source"]}}}}}},"/v1/contacts/{id}":{"patch":{"operationId":"updateContact","tags":["Contacts"],"summary":"Change a contact's name, fields or tags","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"phone":{"type":"string","description":"E.164"},"name":{"type":["string","null"]},"fields":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"consentSource":{"type":"string","description":"How the contact agreed to receive messages, e.g. `manual` or `csv:kunder.csv`"},"consentAt":{"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))$"},"optedOutAt":{"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))$"},{"type":"null"}],"description":"Set when the contact replied STOP or was blocked"},"tags":{"type":"array","items":{"type":"string"},"description":"Groups, e.g. `vip` or `hold-a`; send to a tag from the composer"},"createdAt":{"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":["id","phone","name","fields","consentSource","consentAt","optedOutAt","tags","createdAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}]},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":40},"additionalProperties":{"type":"string","maxLength":200}},"tags":{"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":32}}}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]},"delete":{"operationId":"deleteContact","tags":["Contacts"],"summary":"Delete a contact","security":[{"apiKey":[]},{"session":[]}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/campaigns":{"get":{"operationId":"listCampaigns","tags":["Campaigns"],"summary":"Recent sends with status counts","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Campaigns, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"campaigns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"template":{"type":"string"},"createdAt":{"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))$"},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"counts":{"type":"object","propertyNames":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["queued","claimed","sent","delivered","failed","blocked"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"scheduledAt":{"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))$"},{"type":"null"}]},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credits charged in øre; 0 on the phone tier"},"canceled":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Messages stopped by `cancelCampaign`; counted as `blocked` in `counts`"}},"required":["id","template","createdAt","total","counts","route","category","scheduledAt","priceOre","canceled"]}}},"required":["campaigns"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"post":{"operationId":"sendCampaign","tags":["Campaigns"],"summary":"Send a templated message to contacts","description":"Renders `{{navn}}`-style variables per contact, puts the company name first and queues one message each. Opted-out and blocked numbers are recorded as `blocked` and never sent. `route: api` sends at once with the company name as sender and charges credits; `category: marketing` adds an opt-out line and waits out quiet hours; `sendAt` schedules it; `tag` sends to every contact with that tag.","security":[{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Queued","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"template":{"type":"string"},"createdAt":{"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))$"},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"counts":{"type":"object","propertyNames":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["queued","claimed","sent","delivered","failed","blocked"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"scheduledAt":{"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))$"},{"type":"null"}]},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credits charged in øre; 0 on the phone tier"},"canceled":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Messages stopped by `cancelCampaign`; counted as `blocked` in `counts`"}},"required":["id","template","createdAt","total","counts","route","category","scheduledAt","priceOre","canceled"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"Not enough credit (`insufficient_credits`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"template":{"type":"string","minLength":1,"maxLength":1530,"description":"Body with `{{navn}}`-style variables; the company prefix is added"},"contactIds":{"maxItems":5000,"type":"array","items":{"type":"string"}},"all":{"description":"Send to every contact that has not opted out","type":"boolean"},"tag":{"description":"Send to every contact with this tag","type":"string","minLength":1,"maxLength":32},"route":{"description":"Defaults to the organisation's default route","type":"string","enum":["phone","api"]},"category":{"default":"service","type":"string","enum":["service","marketing"]},"sendAt":{"description":"Schedule for later; omitted means now","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":["template"]}}}}}},"/v1/replies":{"get":{"operationId":"listReplies","tags":["Replies"],"summary":"Replies to the organisation's messages, newest first","description":"SMS received by the organisation's phones, or by trustmy's phones from numbers the organisation messaged. `stop: true` marks an opt-out; the number was blocked automatically. Answer with `queueMessage`.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Up to 200 replies","content":{"application/json":{"schema":{"type":"object","properties":{"replies":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"from":{"type":"string","description":"E.164 when the sender could be parsed, else as received"},"body":{"type":"string"},"contactId":{"type":["string","null"]},"contactName":{"type":["string","null"]},"stop":{"type":"boolean","description":"An opt-out; the number was blocked automatically"},"receivedAt":{"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))$"},"campaignId":{"description":"The send it answers: the last one to this number in the past 7 days","type":["string","null"]},"answer":{"description":"`yes`, `no` or a rating `0`-`10`","type":["string","null"]},"automation":{"description":"Name of the automation that answered it","type":["string","null"]},"answers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"body":{"type":"string"},"status":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"error":{"type":["string","null"]},"automatic":{"type":"boolean","description":"Sent by an automation"},"createdAt":{"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":["id","body","status","error","automatic","createdAt"]},"description":"What was sent back to it, oldest first"}},"required":["id","from","body","contactId","contactName","stop","receivedAt","campaignId","answer","automation","answers"]}}},"required":["replies"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/phones":{"get":{"operationId":"listPhones","tags":["Phones"],"summary":"The organisation's own paired phones","description":"Phones paired with a code from `createPairingCode`. While at least one is paired, the organisation's messages go out only through them, with their number as sender (D23).","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Phones, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"phones":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"phoneNumber":{"description":"E.164, when entered in the app at pairing","type":["string","null"]},"online":{"type":"boolean","description":"Seen in the last 5 minutes"},"lastSeenAt":{"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))$"},{"type":"null"}]},"sentLast24h":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Messages this phone picked up in the last 24 h"},"dailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"0 means unlimited"},"createdAt":{"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":["id","name","phoneNumber","online","lastSeenAt","sentLast24h","dailyCap","createdAt"]}}},"required":["phones"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/phones/pairing-codes":{"post":{"operationId":"createPairingCode","tags":["Phones"],"summary":"Make a one-time code to pair an Android phone","description":"Enter the code in the trustmy app on the phone, which calls `pairDevice`. One use, valid for 10 minutes. Pairing a phone lets a new organisation send without waiting for approval, through its own SIM.","security":[{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Code created","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string","description":"Shown as `ABCD-EFGH`. One use; enter it in the trustmy app on the phone."},"expiresAt":{"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":["code","expiresAt"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/phones/{id}":{"delete":{"operationId":"removePhone","tags":["Phones"],"summary":"Remove a paired phone","description":"The phone's token stops working at once. Messages it had picked up but not reported become `failed` (`phone_removed`), because it may already have sent them.","security":[{"apiKey":[]},{"session":[]}],"responses":{"204":{"description":"Removed"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/campaigns/{id}":{"get":{"operationId":"getCampaign","tags":["Campaigns"],"summary":"One send with every message and its status","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Campaign","content":{"application/json":{"schema":{"type":"object","properties":{"campaign":{"type":"object","properties":{"id":{"type":"string"},"template":{"type":"string"},"createdAt":{"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))$"},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"counts":{"type":"object","propertyNames":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["queued","claimed","sent","delivered","failed","blocked"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"scheduledAt":{"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))$"},{"type":"null"}]},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credits charged in øre; 0 on the phone tier"},"canceled":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Messages stopped by `cancelCampaign`; counted as `blocked` in `counts`"}},"required":["id","template","createdAt","total","counts","route","category","scheduledAt","priceOre","canceled"]},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"to":{"type":"string","description":"Recipient in E.164"},"body":{"type":"string"},"status":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"deviceId":{"type":["string","null"]},"sendAfter":{"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))$"},{"type":"null"}],"description":"Earliest time the device may send this message"},"error":{"type":["string","null"]},"createdAt":{"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))$"},"claimedAt":{"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))$"},{"type":"null"}]},"sentAt":{"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))$"},{"type":"null"}]},"deliveredAt":{"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))$"},{"type":"null"}]},"contactId":{"type":["string","null"]},"campaignId":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"sender":{"description":"Alphanumeric sender on the paid tier; null on the phone tier, where the phone's number shows","type":["string","null"]},"scheduledAt":{"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))$"},{"type":"null"}],"description":"Not sent before this time"},"priceOre":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}],"description":"Credits charged, in øre (paid tier only)"}},"required":["id","to","body","status","deviceId","sendAfter","error","createdAt","claimedAt","sentAt","deliveredAt","contactId","campaignId","route","category","sender","scheduledAt","priceOre"]}},"answers":{"type":"object","properties":{"yes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"no":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ratingCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ratingAverage":{"type":["number","null"]},"other":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Replies that are neither yes, no nor a rating"},"stop":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["yes","no","ratingCount","ratingAverage","other","stop"]},"replies":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string"},"body":{"type":"string"},"answer":{"description":"`yes`, `no`, or a rating `0`-`10`","type":["string","null"]},"stop":{"type":"boolean"},"receivedAt":{"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":["from","body","answer","stop","receivedAt"]},"description":"Newest first, at most 500"}},"required":["campaign","messages","answers","replies"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/campaigns/{id}/cancel":{"post":{"operationId":"cancelCampaign","tags":["Campaigns"],"summary":"Stop what of a send has not left yet","description":"Queued and scheduled messages become `blocked` with error `canceled`; paid ones get their credit back. Messages a phone has already picked up (`claimed`) may be on their way and are not stopped. Safe to repeat.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Stopped","content":{"application/json":{"schema":{"type":"object","properties":{"canceled":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Queued messages stopped; they become `blocked` with error `canceled`"},"refundedOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credit given back for stopped paid messages"}},"required":["canceled","refundedOre"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/campaigns/{id}/retry":{"post":{"operationId":"retryCampaign","tags":["Campaigns"],"summary":"Send a send's failed messages again","description":"Nothing is retried automatically. A message that failed with `phone_no_confirmation` may have arrived after all (the phone only lost its report), so it can reach the person twice. Numbers that opted out since become `blocked`. Paid messages are charged again; calling twice charges once.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Queued again","content":{"application/json":{"schema":{"type":"object","properties":{"retried":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Failed messages queued again"},"blocked":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Not sent again, because the number opted out since"},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Credit charged for paid messages sent again"}},"required":["retried","blocked","priceOre"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"Not enough credit (`insufficient_credits`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/credits":{"get":{"operationId":"getCredits","tags":["Credits"],"summary":"Prepaid balance, price per SMS and the last 100 entries","description":"Credit is in øre. Paid-tier sends are charged up front; refused messages are refunded.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Credits","content":{"application/json":{"schema":{"type":"object","properties":{"balanceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"amountOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"kind":{"type":"string","enum":["topup","grant","charge","refund"]},"call":{"type":"boolean","description":"A phone call's minutes (D29), rather than SMS"},"note":{"type":["string","null"]},"createdAt":{"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":["id","amountOre","kind","call","note","createdAt"]}}},"required":["balanceOre","priceOre","entries"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/credits/checkout":{"post":{"operationId":"createCheckout","tags":["Credits"],"summary":"Start a card top-up (Stripe Checkout)","description":"Returns the Stripe page to send the browser to. Credit is added when Stripe confirms the payment.","security":[{"session":[]}],"responses":{"200":{"description":"Checkout created","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amountKr":{"anyOf":[{"type":"number","const":100},{"type":"number","const":250},{"type":"number","const":500},{"type":"number","const":1000},{"type":"number","const":2500}]}},"required":["amountKr"]}}}}}},"/v1/billing/stripe/webhook":{"post":{"operationId":"stripeWebhook","tags":["Callbacks"],"summary":"Stripe events (signed)","description":"Books credit for `checkout.session.completed`. Verified with the `Stripe-Signature` header.","responses":{"200":{"description":"Handled"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/providers/gatewayapi/status":{"post":{"operationId":"gatewayApiStatus","tags":["Callbacks"],"summary":"GatewayAPI delivery reports (signed)","description":"Maps GatewayAPI states onto message statuses. Verified with the `X-Gwapi-Signature` JWT when a secret is set.","responses":{"204":{"description":"Handled"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/opt-out/{token}":{"get":{"operationId":"getOptOut","tags":["Opt-out"],"summary":"Who an opt-out link is for (public)","responses":{"200":{"description":"Company name, and whether it was used"},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}]},"post":{"operationId":"useOptOut","tags":["Opt-out"],"summary":"Opt out with a link from a message (public)","description":"Blocks the number for that organisation, like a STOP reply. Needs a POST, so link scanners opt nobody out.","responses":{"200":{"description":"Opted out"},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}]}},"/v1/api-keys":{"get":{"operationId":"listApiKeys","tags":["API keys"],"summary":"The organisation's API keys","security":[{"session":[]}],"responses":{"200":{"description":"Keys, newest first","content":{"application/json":{"schema":{"type":"object","properties":{"apiKeys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string","description":"First characters of the key, to tell keys apart"},"createdAt":{"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))$"},"lastUsedAt":{"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))$"},{"type":"null"}]}},"required":["id","name","prefix","createdAt","lastUsedAt"]}}},"required":["apiKeys"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"post":{"operationId":"createApiKey","tags":["API keys"],"summary":"Make an API key (shown once)","security":[{"session":[]}],"responses":{"201":{"description":"Key created","content":{"application/json":{"schema":{"type":"object","properties":{"apiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"prefix":{"type":"string","description":"First characters of the key, to tell keys apart"},"createdAt":{"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))$"},"lastUsedAt":{"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))$"},{"type":"null"}]}},"required":["id","name","prefix","createdAt","lastUsedAt"]},"key":{"type":"string","description":"Shown once. Send as `Authorization: Bearer <key>`."}},"required":["apiKey","key"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60}},"required":["name"]}}}}}},"/v1/api-keys/{id}":{"delete":{"operationId":"revokeApiKey","tags":["API keys"],"summary":"Revoke an API key; it stops working at once","security":[{"session":[]}],"responses":{"204":{"description":"Revoked"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/verify":{"post":{"operationId":"startVerification","tags":["Verification"],"summary":"Text a 6-digit code to a number","description":"For logins and sign-ups. Always the paid tier, so it arrives in seconds, day and night, from your sender name. Valid 10 minutes, 5 tries. At most 5 codes an hour per number, 30 s apart. Check it with `checkVerification`.","security":[{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Code sent","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"to":{"type":"string","description":"E.164"},"expiresAt":{"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))$"},"messageId":{"type":"string"}},"required":["id","to","expiresAt","messageId"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"402":{"description":"Not enough credit (`insufficient_credits`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"403":{"description":"Not allowed (`forbidden`, `organization_pending_review`, `paid_tier_needs_approval`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"429":{"description":"Too many requests (`too_many_codes`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","minLength":3,"maxLength":32},"lang":{"default":"da","type":"string","enum":["da","en"]}},"required":["to"]}}}}}},"/v1/verify/check":{"post":{"operationId":"checkVerification","tags":["Verification"],"summary":"Check a code the user typed","description":"Checks the newest code for the number. `valid: true` once; after that the code is spent.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Result","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"reason":{"type":"string","enum":["ok","wrong_code","expired","too_many_attempts","no_code"]}},"required":["valid","reason"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","minLength":3,"maxLength":32},"code":{"type":"string","pattern":"^\\d{6}$"}},"required":["to","code"]}}}}}},"/v1/templates":{"get":{"operationId":"listTemplates","tags":["Templates"],"summary":"Saved messages, by name","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Templates","content":{"application/json":{"schema":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"body":{"type":"string"},"updatedAt":{"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":["id","name","body","updatedAt"]}}},"required":["templates"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"post":{"operationId":"createTemplate","tags":["Templates"],"summary":"Save a message","security":[{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"body":{"type":"string"},"updatedAt":{"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":["id","name","body","updatedAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"body":{"type":"string","minLength":1,"maxLength":1530}},"required":["name","body"]}}}}}},"/v1/templates/{id}":{"put":{"operationId":"updateTemplate","tags":["Templates"],"summary":"Change a saved message","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"body":{"type":"string"},"updatedAt":{"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":["id","name","body","updatedAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"body":{"type":"string","minLength":1,"maxLength":1530}},"required":["name","body"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]},"delete":{"operationId":"deleteTemplate","tags":["Templates"],"summary":"Delete a saved message","security":[{"apiKey":[]},{"session":[]}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/organization/webhook":{"get":{"operationId":"getWebhook","tags":["Account"],"summary":"Webhook URL and signing secret","description":"Events: `message.status` (sent, delivered, failed) and `reply.received`. Each POST carries `X-Trustmy-Signature: t=<unix>,v1=<hex HMAC-SHA256 of \"<t>.<body>\" with the secret>`.","security":[{"session":[]}],"responses":{"200":{"description":"Webhook","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":["string","null"]},"secret":{"type":["string","null"]}},"required":["url","secret"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/automations":{"get":{"operationId":"listAutomations","tags":["Automations"],"summary":"The organisation's automations, with how many messages each has sent","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Automations, oldest first","content":{"application/json":{"schema":{"type":"object","properties":{"automations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["keyword","join","date"]},"name":{"type":"string"},"enabled":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"reply":{"type":["string","null"]},"tag":{"type":["string","null"]},"dateField":{"type":["string","null"]},"offsetDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sendTime":{"type":"string"},"repeat":{"type":"string","enum":["yearly","once"]},"template":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"lastRunOn":{"description":"Copenhagen date of the last run (date automations)","type":["string","null"]},"runs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Messages it has sent"},"updatedAt":{"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":["id","kind","name","enabled","keywords","reply","tag","dateField","offsetDays","sendTime","repeat","template","route","category","lastRunOn","runs","updatedAt"]}}},"required":["automations"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"post":{"operationId":"createAutomation","tags":["Automations"],"summary":"Create an automation","description":"`keyword`: answer replies containing a keyword (`*` answers anything else). `join`: a keyword makes the sender a contact with consent, in a group, and sends a welcome. `date`: once a day at `sendTime` (Copenhagen), send to contacts whose date field falls `offsetDays` from today; `yearly` for birthdays, `once` for renewals. Replies go out from the phone that received the message, at most 3 automatic replies per number a day.","security":[{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["keyword","join","date"]},"name":{"type":"string"},"enabled":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"reply":{"type":["string","null"]},"tag":{"type":["string","null"]},"dateField":{"type":["string","null"]},"offsetDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sendTime":{"type":"string"},"repeat":{"type":"string","enum":["yearly","once"]},"template":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"lastRunOn":{"description":"Copenhagen date of the last run (date automations)","type":["string","null"]},"runs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Messages it has sent"},"updatedAt":{"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":["id","kind","name","enabled","keywords","reply","tag","dateField","offsetDays","sendTime","repeat","template","route","category","lastRunOn","runs","updatedAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"keyword"},"name":{"type":"string","minLength":1,"maxLength":60},"keywords":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"description":"Words that trigger the reply; `*` answers any message no other rule caught"},"reply":{"type":"string","minLength":1,"maxLength":600},"enabled":{"default":true,"type":"boolean"}},"required":["kind","name","keywords","reply"]},{"type":"object","properties":{"kind":{"type":"string","const":"join"},"name":{"type":"string","minLength":1,"maxLength":60},"keywords":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"description":"Words that sign the sender up, e.g. TILMELD"},"tag":{"description":"Group new sign-ups get","type":"string","minLength":1,"maxLength":32},"reply":{"type":"string","minLength":1,"maxLength":600,"description":"Welcome message"},"enabled":{"default":true,"type":"boolean"}},"required":["kind","name","keywords","reply"]},{"type":"object","properties":{"kind":{"type":"string","const":"date"},"name":{"type":"string","minLength":1,"maxLength":60},"dateField":{"type":"string","minLength":1,"maxLength":40,"description":"Contact field holding the date, e.g. fødselsdag"},"offsetDays":{"default":0,"description":"Days before the date to send","type":"integer","minimum":0,"maximum":365},"sendTime":{"default":"10:00","description":"Copenhagen time","type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` ignores the year (birthdays); `once` needs it (renewals)"},"template":{"type":"string","minLength":1,"maxLength":1530},"route":{"default":"phone","type":"string","enum":["phone","api"]},"category":{"default":"service","type":"string","enum":["service","marketing"]},"enabled":{"default":true,"type":"boolean"}},"required":["kind","name","dateField","repeat","template"]}]}}}}}},"/v1/automations/{id}":{"put":{"operationId":"updateAutomation","tags":["Automations"],"summary":"Replace an automation's settings","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["keyword","join","date"]},"name":{"type":"string"},"enabled":{"type":"boolean"},"keywords":{"type":"array","items":{"type":"string"}},"reply":{"type":["string","null"]},"tag":{"type":["string","null"]},"dateField":{"type":["string","null"]},"offsetDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sendTime":{"type":"string"},"repeat":{"type":"string","enum":["yearly","once"]},"template":{"type":["string","null"]},"route":{"type":"string","enum":["phone","api"]},"category":{"type":"string","enum":["service","marketing","code"]},"lastRunOn":{"description":"Copenhagen date of the last run (date automations)","type":["string","null"]},"runs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Messages it has sent"},"updatedAt":{"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":["id","kind","name","enabled","keywords","reply","tag","dateField","offsetDays","sendTime","repeat","template","route","category","lastRunOn","runs","updatedAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"keyword"},"name":{"type":"string","minLength":1,"maxLength":60},"keywords":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"description":"Words that trigger the reply; `*` answers any message no other rule caught"},"reply":{"type":"string","minLength":1,"maxLength":600},"enabled":{"default":true,"type":"boolean"}},"required":["kind","name","keywords","reply"]},{"type":"object","properties":{"kind":{"type":"string","const":"join"},"name":{"type":"string","minLength":1,"maxLength":60},"keywords":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1,"maxLength":40},"description":"Words that sign the sender up, e.g. TILMELD"},"tag":{"description":"Group new sign-ups get","type":"string","minLength":1,"maxLength":32},"reply":{"type":"string","minLength":1,"maxLength":600,"description":"Welcome message"},"enabled":{"default":true,"type":"boolean"}},"required":["kind","name","keywords","reply"]},{"type":"object","properties":{"kind":{"type":"string","const":"date"},"name":{"type":"string","minLength":1,"maxLength":60},"dateField":{"type":"string","minLength":1,"maxLength":40,"description":"Contact field holding the date, e.g. fødselsdag"},"offsetDays":{"default":0,"description":"Days before the date to send","type":"integer","minimum":0,"maximum":365},"sendTime":{"default":"10:00","description":"Copenhagen time","type":"string","pattern":"^([01]\\d|2[0-3]):([0-5]\\d)$"},"repeat":{"type":"string","enum":["yearly","once"],"description":"`yearly` ignores the year (birthdays); `once` needs it (renewals)"},"template":{"type":"string","minLength":1,"maxLength":1530},"route":{"default":"phone","type":"string","enum":["phone","api"]},"category":{"default":"service","type":"string","enum":["service","marketing"]},"enabled":{"default":true,"type":"boolean"}},"required":["kind","name","dateField","repeat","template"]}]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]},"patch":{"operationId":"toggleAutomation","tags":["Automations"],"summary":"Switch an automation on or off","security":[{"apiKey":[]},{"session":[]}],"responses":{"204":{"description":"Done"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]},"delete":{"operationId":"deleteAutomation","tags":["Automations"],"summary":"Delete an automation","security":[{"apiKey":[]},{"session":[]}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/reviews":{"get":{"operationId":"getReviewOverview","tags":["Reviews"],"summary":"Review numbers (last 30 days, all time, per location) and the newest requests","description":"`status=attention` lists low scores (3 or less) and requests that could not be sent.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Overview","content":{"application/json":{"schema":{"type":"object","properties":{"setupNeeded":{"type":"boolean"},"last30":{"type":"object","properties":{"requested":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"clicked":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ratingAverage":{"type":["number","null"]},"low":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["requested","sent","clicked","rated","ratingAverage","low","skipped"]},"allTime":{"type":"object","properties":{"requested":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"clicked":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ratingAverage":{"type":["number","null"]},"low":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["requested","sent","clicked","rated","ratingAverage","low","skipped"]},"byLocation":{"type":"array","items":{"type":"object","properties":{"locationId":{"type":"string"},"name":{"type":"string"},"last30":{"type":"object","properties":{"requested":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sent":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"clicked":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rated":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"ratingAverage":{"type":["number","null"]},"low":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["requested","sent","clicked","rated","ratingAverage","low","skipped"]}},"required":["locationId","name","last30"]}},"requests":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["scheduled","sent","reminded","clicked","rated","skipped","failed"]},"locationId":{"type":["string","null"]},"locationName":{"type":["string","null"]},"contactId":{"type":["string","null"]},"source":{"type":"string","enum":["manual","contacts","api","economic","dinero","billy","shipmondo"]},"externalRef":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"channel":{"type":"string","enum":["sms","email"]},"flow":{"type":"string","enum":["link","ask"]},"sendAt":{"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)))$"},"sentAt":{"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":"null"}]},"reminderSentAt":{"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":"null"}]},"clickedAt":{"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":"null"}]},"clicks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rating":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ratedAt":{"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":"null"}]},"feedback":{"type":["string","null"]},"feedbackAt":{"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":"null"}]},"skippedReason":{"type":["string","null"]},"error":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","status","locationId","locationName","contactId","source","externalRef","name","phone","email","channel","flow","sendAt","sentAt","reminderSentAt","clickedAt","clicks","rating","ratedAt","feedback","feedbackAt","skippedReason","error","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["setupNeeded","last30","allTime","byLocation","requests","nextCursor"]}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"array","items":{}},"data":{}},"required":["success","error","data"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"in":"query","name":"before","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["all","attention","scheduled"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":200}}]}},"/v1/reviews/requests":{"get":{"operationId":"listReviewRequests","tags":["Reviews"],"summary":"Review requests, newest first","description":"Pass the response's `nextCursor` as `before` for the next page.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"A page of requests","content":{"application/json":{"schema":{"type":"object","properties":{"requests":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["scheduled","sent","reminded","clicked","rated","skipped","failed"]},"locationId":{"type":["string","null"]},"locationName":{"type":["string","null"]},"contactId":{"type":["string","null"]},"source":{"type":"string","enum":["manual","contacts","api","economic","dinero","billy","shipmondo"]},"externalRef":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"channel":{"type":"string","enum":["sms","email"]},"flow":{"type":"string","enum":["link","ask"]},"sendAt":{"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)))$"},"sentAt":{"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":"null"}]},"reminderSentAt":{"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":"null"}]},"clickedAt":{"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":"null"}]},"clicks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rating":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ratedAt":{"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":"null"}]},"feedback":{"type":["string","null"]},"feedbackAt":{"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":"null"}]},"skippedReason":{"type":["string","null"]},"error":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","status","locationId","locationName","contactId","source","externalRef","name","phone","email","channel","flow","sendAt","sentAt","reminderSentAt","clickedAt","clicks","rating","ratedAt","feedback","feedbackAt","skippedReason","error","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["requests","nextCursor"]}}}},"400":{"description":"Validation Error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","enum":[false]},"error":{"type":"array","items":{}},"data":{}},"required":["success","error","data"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"in":"query","name":"before","schema":{"type":"string"}},{"in":"query","name":"status","schema":{"type":"string","enum":["all","attention","scheduled"]}},{"in":"query","name":"limit","schema":{"type":"integer","minimum":1,"maximum":200}}]},"post":{"operationId":"createReviewRequest","tags":["Reviews"],"summary":"Ask one customer for a Google review","description":"Call it when a job is done or an order delivered. The customer is texted after the delay in the review settings (or `delayMinutes`, or at `sendAt`), within your sending hours, and gets the Google link; at most one reminder follows. Nobody is asked twice within the cooldown, and a number that texted STOP is never asked. Pass `externalRef` (your job, order or invoice id): a second call with it returns the first request (200). `consent: true` confirms it is your own customer, who gave you the number for this job. Keep the text neutral; asked right after the job it is then not marketing.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Already made for this `externalRef`","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["scheduled","sent","reminded","clicked","rated","skipped","failed"]},"locationId":{"type":["string","null"]},"locationName":{"type":["string","null"]},"contactId":{"type":["string","null"]},"source":{"type":"string","enum":["manual","contacts","api","economic","dinero","billy","shipmondo"]},"externalRef":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"channel":{"type":"string","enum":["sms","email"]},"flow":{"type":"string","enum":["link","ask"]},"sendAt":{"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)))$"},"sentAt":{"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":"null"}]},"reminderSentAt":{"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":"null"}]},"clickedAt":{"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":"null"}]},"clicks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rating":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ratedAt":{"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":"null"}]},"feedback":{"type":["string","null"]},"feedbackAt":{"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":"null"}]},"skippedReason":{"type":["string","null"]},"error":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","status","locationId","locationName","contactId","source","externalRef","name","phone","email","channel","flow","sendAt","sentAt","reminderSentAt","clickedAt","clicks","rating","ratedAt","feedback","feedbackAt","skippedReason","error","createdAt"]}}}},"201":{"description":"Created (`status` may be `skipped`, with `skippedReason`)","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["scheduled","sent","reminded","clicked","rated","skipped","failed"]},"locationId":{"type":["string","null"]},"locationName":{"type":["string","null"]},"contactId":{"type":["string","null"]},"source":{"type":"string","enum":["manual","contacts","api","economic","dinero","billy","shipmondo"]},"externalRef":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"channel":{"type":"string","enum":["sms","email"]},"flow":{"type":"string","enum":["link","ask"]},"sendAt":{"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)))$"},"sentAt":{"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":"null"}]},"reminderSentAt":{"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":"null"}]},"clickedAt":{"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":"null"}]},"clicks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rating":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ratedAt":{"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":"null"}]},"feedback":{"type":["string","null"]},"feedbackAt":{"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":"null"}]},"skippedReason":{"type":["string","null"]},"error":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","status","locationId","locationName","contactId","source","externalRef","name","phone","email","channel","flow","sendAt","sentAt","reminderSentAt","clickedAt","clicks","rating","ratedAt","feedback","feedbackAt","skippedReason","error","createdAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":120},"phone":{"type":"string","maxLength":32},"email":{"type":"string","maxLength":254,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"contactId":{"type":"string"},"locationId":{"type":"string"},"externalRef":{"type":"string","minLength":1,"maxLength":120},"sendAt":{"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)))$"},"delayMinutes":{"type":"integer","minimum":0,"maximum":10080},"consent":{"type":"boolean","const":true}}}}}}}},"/v1/reviews/requests/bulk":{"post":{"operationId":"createReviewRequestsFromContacts","tags":["Reviews"],"summary":"Ask contacts for a review: chosen ones, a group, or all","description":"Up to 2,000 at a time, sent by the cron at the phones' pace. These may be older customers, so they go as marketing (opt-out line, sending hours) on the contacts' own consent.","security":[{"session":[]}],"responses":{"200":{"description":"How many were made and skipped","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"skipped":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["created","skipped"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"contactIds":{"maxItems":2000,"type":"array","items":{"type":"string"}},"tag":{"type":"string","minLength":1,"maxLength":60},"all":{"type":"boolean"},"locationId":{"type":"string"}}}}}}}},"/v1/reviews/requests/{id}":{"get":{"operationId":"getReviewRequest","tags":["Reviews"],"summary":"One review request","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"The request","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["scheduled","sent","reminded","clicked","rated","skipped","failed"]},"locationId":{"type":["string","null"]},"locationName":{"type":["string","null"]},"contactId":{"type":["string","null"]},"source":{"type":"string","enum":["manual","contacts","api","economic","dinero","billy","shipmondo"]},"externalRef":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"channel":{"type":"string","enum":["sms","email"]},"flow":{"type":"string","enum":["link","ask"]},"sendAt":{"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)))$"},"sentAt":{"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":"null"}]},"reminderSentAt":{"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":"null"}]},"clickedAt":{"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":"null"}]},"clicks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rating":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ratedAt":{"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":"null"}]},"feedback":{"type":["string","null"]},"feedbackAt":{"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":"null"}]},"skippedReason":{"type":["string","null"]},"error":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","status","locationId","locationName","contactId","source","externalRef","name","phone","email","channel","flow","sendAt","sentAt","reminderSentAt","clickedAt","clicks","rating","ratedAt","feedback","feedbackAt","skippedReason","error","createdAt"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/reviews/requests/{id}/cancel":{"post":{"operationId":"cancelReviewRequest","tags":["Reviews"],"summary":"Cancel a request that has not been sent","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Cancelled","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["scheduled","sent","reminded","clicked","rated","skipped","failed"]},"locationId":{"type":["string","null"]},"locationName":{"type":["string","null"]},"contactId":{"type":["string","null"]},"source":{"type":"string","enum":["manual","contacts","api","economic","dinero","billy","shipmondo"]},"externalRef":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"channel":{"type":"string","enum":["sms","email"]},"flow":{"type":"string","enum":["link","ask"]},"sendAt":{"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)))$"},"sentAt":{"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":"null"}]},"reminderSentAt":{"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":"null"}]},"clickedAt":{"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":"null"}]},"clicks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rating":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ratedAt":{"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":"null"}]},"feedback":{"type":["string","null"]},"feedbackAt":{"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":"null"}]},"skippedReason":{"type":["string","null"]},"error":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","status","locationId","locationName","contactId","source","externalRef","name","phone","email","channel","flow","sendAt","sentAt","reminderSentAt","clickedAt","clicks","rating","ratedAt","feedback","feedbackAt","skippedReason","error","createdAt"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/reviews/requests/{id}/retry":{"post":{"operationId":"retryReviewRequest","tags":["Reviews"],"summary":"Send a request that could not be sent again","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Sent again (or failed again, with `error`)","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["scheduled","sent","reminded","clicked","rated","skipped","failed"]},"locationId":{"type":["string","null"]},"locationName":{"type":["string","null"]},"contactId":{"type":["string","null"]},"source":{"type":"string","enum":["manual","contacts","api","economic","dinero","billy","shipmondo"]},"externalRef":{"type":["string","null"]},"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]},"channel":{"type":"string","enum":["sms","email"]},"flow":{"type":"string","enum":["link","ask"]},"sendAt":{"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)))$"},"sentAt":{"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":"null"}]},"reminderSentAt":{"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":"null"}]},"clickedAt":{"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":"null"}]},"clicks":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"rating":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"ratedAt":{"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":"null"}]},"feedback":{"type":["string","null"]},"feedbackAt":{"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":"null"}]},"skippedReason":{"type":["string","null"]},"error":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","status","locationId","locationName","contactId","source","externalRef","name","phone","email","channel","flow","sendAt","sentAt","reminderSentAt","clickedAt","clicks","rating","ratedAt","feedback","feedbackAt","skippedReason","error","createdAt"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/reviews/settings":{"get":{"operationId":"getReviewSettings","tags":["Reviews"],"summary":"Review texts, timing, locations, and what the server has switched on","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Settings","content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","enum":["da","en"]},"flow":{"type":"string","enum":["link","ask"]},"linkTemplate":{"type":"string"},"askTemplate":{"type":"string"},"highTemplate":{"type":"string"},"lowTemplate":{"type":"string"},"reminderTemplate":{"type":"string"},"emailSubject":{"type":"string"},"delayMinutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reminderDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"cooldownDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"notifyPhone":{"type":["string","null"]},"emailFallback":{"type":"boolean"},"route":{"type":"string","enum":["phone","api"]},"monthlyReport":{"type":"boolean"},"locations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"reviewUrl":{"type":"string"},"placeId":{"type":["string","null"]},"address":{"type":["string","null"]}},"required":["id","name","reviewUrl","placeId","address"]}},"emailAvailable":{"type":"boolean"},"placesAvailable":{"type":"boolean"}},"required":["language","flow","linkTemplate","askTemplate","highTemplate","lowTemplate","reminderTemplate","emailSubject","delayMinutes","reminderDays","cooldownDays","notifyPhone","emailFallback","route","monthlyReport","locations","emailAvailable","placesAvailable"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"patch":{"operationId":"updateReviewSettings","tags":["Reviews"],"summary":"Change review texts and timing","description":"The link text, both answers to a score, and (in the `link` flow) the reminder must contain `{{link}}`. The `ask` flow needs replies, so it needs `route: phone`.","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","enum":["da","en"]},"flow":{"type":"string","enum":["link","ask"]},"linkTemplate":{"type":"string"},"askTemplate":{"type":"string"},"highTemplate":{"type":"string"},"lowTemplate":{"type":"string"},"reminderTemplate":{"type":"string"},"emailSubject":{"type":"string"},"delayMinutes":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"reminderDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"cooldownDays":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"notifyPhone":{"type":["string","null"]},"emailFallback":{"type":"boolean"},"route":{"type":"string","enum":["phone","api"]},"monthlyReport":{"type":"boolean"},"locations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"reviewUrl":{"type":"string"},"placeId":{"type":["string","null"]},"address":{"type":["string","null"]}},"required":["id","name","reviewUrl","placeId","address"]}},"emailAvailable":{"type":"boolean"},"placesAvailable":{"type":"boolean"}},"required":["language","flow","linkTemplate","askTemplate","highTemplate","lowTemplate","reminderTemplate","emailSubject","delayMinutes","reminderDays","cooldownDays","notifyPhone","emailFallback","route","monthlyReport","locations","emailAvailable","placesAvailable"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"language":{"type":"string","enum":["da","en"]},"flow":{"type":"string","enum":["link","ask"]},"linkTemplate":{"type":"string","minLength":1,"maxLength":480},"askTemplate":{"type":"string","minLength":1,"maxLength":480},"highTemplate":{"type":"string","minLength":1,"maxLength":480},"lowTemplate":{"type":"string","minLength":1,"maxLength":480},"reminderTemplate":{"type":"string","minLength":1,"maxLength":480},"emailSubject":{"type":"string","minLength":1,"maxLength":150},"delayMinutes":{"type":"integer","minimum":0,"maximum":10080},"reminderDays":{"type":"integer","minimum":0,"maximum":14},"cooldownDays":{"type":"integer","minimum":0,"maximum":365},"notifyPhone":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}]},"emailFallback":{"type":"boolean"},"route":{"type":"string","enum":["phone","api"]},"monthlyReport":{"type":"boolean"}}}}}}}},"/v1/reviews/locations":{"post":{"operationId":"createReviewLocation","tags":["Reviews"],"summary":"Add a location (a Google Business Profile)","description":"Give the review link from the Business Profile, or a `placeId` from `searchPlaces`.","security":[{"apiKey":[]},{"session":[]}],"responses":{"201":{"description":"Added","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"reviewUrl":{"type":"string"},"placeId":{"type":["string","null"]},"address":{"type":["string","null"]}},"required":["id","name","reviewUrl","placeId","address"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"reviewUrl":{"type":"string","maxLength":600},"placeId":{"type":"string","minLength":1,"maxLength":300},"address":{"type":"string","maxLength":200}},"required":["name"]}}}}}},"/v1/reviews/locations/{id}":{"put":{"operationId":"updateReviewLocation","tags":["Reviews"],"summary":"Change a location","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"reviewUrl":{"type":"string"},"placeId":{"type":["string","null"]},"address":{"type":["string","null"]}},"required":["id","name","reviewUrl","placeId","address"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80},"reviewUrl":{"type":"string","maxLength":600},"placeId":{"type":"string","minLength":1,"maxLength":300},"address":{"type":"string","maxLength":200}},"required":["name"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]},"delete":{"operationId":"deleteReviewLocation","tags":["Reviews"],"summary":"Remove a location","description":"Links already sent open the organisation's first remaining location.","security":[{"apiKey":[]},{"session":[]}],"responses":{"204":{"description":"Removed"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/reviews/places/search":{"post":{"operationId":"searchPlaces","tags":["Reviews"],"summary":"Find your business on Google","description":"Name and address only. Needs GOOGLE_PLACES_API_KEY on the server (`places_unavailable` otherwise).","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Up to 5 places","content":{"application/json":{"schema":{"type":"object","properties":{"places":{"type":"array","items":{"type":"object","properties":{"placeId":{"type":"string"},"name":{"type":"string"},"address":{"type":["string","null"]},"rating":{"type":["number","null"]},"userRatingCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"mapsUri":{"type":["string","null"]}},"required":["placeId","name","address","rating","userRatingCount","mapsUri"]}}},"required":["places"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":2,"maxLength":160}},"required":["query"]}}}}}},"/v1/reviews/google":{"get":{"operationId":"getGoogleRatings","tags":["Reviews"],"summary":"Each location's Google rating and review count, now","description":"Fetched from Google when asked and never stored (Google's terms). Show it with the text \"Google Maps\".","security":[{"apiKey":[]},{"session":[]}],"responses":{"200":{"description":"Ratings","content":{"application/json":{"schema":{"type":"object","properties":{"available":{"type":"boolean"},"locations":{"type":"array","items":{"type":"object","properties":{"locationId":{"type":"string"},"place":{"anyOf":[{"type":"object","properties":{"placeId":{"type":"string"},"name":{"type":"string"},"address":{"type":["string","null"]},"rating":{"type":["number","null"]},"userRatingCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"mapsUri":{"type":["string","null"]}},"required":["placeId","name","address","rating","userRatingCount","mapsUri"]},{"type":"null"}]},"error":{"type":["string","null"]}},"required":["locationId","place","error"]}}},"required":["available","locations"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/reviews/link/{token}":{"get":{"operationId":"getReviewLink","tags":["Reviews"],"summary":"Who a review link is for (public)","description":"Counts nothing: link previews fetch the page too.","responses":{"200":{"description":"Company, location and the Google page","content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"location":{"type":["string","null"]},"reviewUrl":{"type":"string"}},"required":["company","location","reviewUrl"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}]}},"/v1/reviews/link/{token}/open":{"post":{"operationId":"openReviewLink","tags":["Reviews"],"summary":"Count a click on a review link (public)","description":"Called by the link page's script in the customer's browser, right before it opens Google.","responses":{"200":{"description":"Counted","content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"location":{"type":["string","null"]},"reviewUrl":{"type":"string"}},"required":["company","location","reviewUrl"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}]}},"/v1/reviews/email-unsubscribe/{token}":{"get":{"operationId":"getEmailUnsubscribe","tags":["Reviews"],"summary":"Who an email unsubscribe link is for (public)","responses":{"200":{"description":"Company, and whether it was used","content":{"application/json":{"schema":{"type":"object","properties":{"company":{"type":"string"},"done":{"type":"boolean"}},"required":["company","done"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}]},"post":{"operationId":"unsubscribeEmail","tags":["Reviews"],"summary":"Stop review emails from this company (public; also the one-click List-Unsubscribe target)","responses":{"200":{"description":"Unsubscribed"},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"token","required":true}]}},"/v1/reviews/calculator":{"post":{"operationId":"reviewCalculator","tags":["Reviews"],"summary":"How a business compares with its nearest competitors on Google (public)","description":"Looks the business up on Google, finds the five nearest places of the same kind, and estimates reviews from customers asked (15 %). A few per visitor a day, and a daily cap in all.","responses":{"200":{"description":"Comparison","content":{"application/json":{"schema":{"type":"object","properties":{"business":{"anyOf":[{"type":"object","properties":{"placeId":{"type":"string"},"name":{"type":"string"},"address":{"type":["string","null"]},"rating":{"type":["number","null"]},"userRatingCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"mapsUri":{"type":["string","null"]}},"required":["placeId","name","address","rating","userRatingCount","mapsUri"]},{"type":"null"}]},"competitors":{"type":"array","items":{"type":"object","properties":{"placeId":{"type":"string"},"name":{"type":"string"},"address":{"type":["string","null"]},"rating":{"type":["number","null"]},"userRatingCount":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"mapsUri":{"type":["string","null"]}},"required":["placeId","name","address","rating","userRatingCount","mapsUri"]}},"competitorAverage":{"type":"object","properties":{"rating":{"type":["number","null"]},"userRatingCount":{"type":["number","null"]}},"required":["rating","userRatingCount"]},"estimate":{"type":"object","properties":{"perMonth":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sixMonths":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"conversion":{"type":"number"}},"required":["perMonth","sixMonths","conversion"]}},"required":["business","competitors","competitorAverage","estimate"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"429":{"description":"Too many requests (`too_many_codes`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"business":{"type":"string","minLength":2,"maxLength":120},"city":{"type":"string","minLength":2,"maxLength":80},"customersPerMonth":{"type":"integer","minimum":1,"maximum":100000}},"required":["business","city","customersPerMonth"]}}}}}},"/v1/integrations":{"get":{"operationId":"listIntegrations","tags":["Integrations"],"summary":"Connected systems, and which can be connected","security":[{"session":[]}],"responses":{"200":{"description":"Integrations","content":{"application/json":{"schema":{"type":"object","properties":{"integrations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["economic","dinero","billy","shipmondo"]},"account":{"type":["string","null"]},"locationId":{"type":["string","null"]},"status":{"type":"string","enum":["active","error"]},"lastError":{"type":["string","null"]},"lastSyncAt":{"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":"null"}]},"imported":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"mode":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","provider","account","locationId","status","lastError","lastSyncAt","imported","mode","createdAt"]}},"available":{"type":"object","propertyNames":{"type":"string","enum":["economic","dinero","billy","shipmondo"]},"additionalProperties":{"type":"boolean"},"required":["economic","dinero","billy","shipmondo"]},"economicInstallUrl":{"type":["string","null"]},"dineroAuthorizeUrl":{"type":["string","null"]}},"required":["integrations","available","economicInstallUrl","dineroAuthorizeUrl"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}},"post":{"operationId":"connectIntegration","tags":["Integrations"],"summary":"Connect e-conomic, Billy or Shipmondo","description":"e-conomic: the `grantToken` e-conomic returns (as `?token=`) after the install page. Billy: an access token from Indstillinger → Adgangstokens. Shipmondo: an API user and key; trustmy registers a delivered webhook (Shipmondo Pro), or else asks `shippedDelayDays` after the label. Dinero signs in with `startDinero`.","security":[{"session":[]}],"responses":{"201":{"description":"Connected","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["economic","dinero","billy","shipmondo"]},"account":{"type":["string","null"]},"locationId":{"type":["string","null"]},"status":{"type":"string","enum":["active","error"]},"lastError":{"type":["string","null"]},"lastSyncAt":{"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":"null"}]},"imported":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"mode":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","provider","account","locationId","status","lastError","lastSyncAt","imported","mode","createdAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"422":{"description":"Semantically invalid input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"502":{"description":"Error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"provider":{"type":"string","const":"economic"},"grantToken":{"type":"string","minLength":10,"maxLength":200},"locationId":{"type":"string"},"consent":{"type":"boolean","const":true}},"required":["provider","grantToken","consent"]},{"type":"object","properties":{"provider":{"type":"string","const":"billy"},"accessToken":{"type":"string","minLength":10,"maxLength":200},"locationId":{"type":"string"},"consent":{"type":"boolean","const":true}},"required":["provider","accessToken","consent"]},{"type":"object","properties":{"provider":{"type":"string","const":"shipmondo"},"apiUser":{"type":"string","minLength":8,"maxLength":100},"apiKey":{"type":"string","minLength":8,"maxLength":100},"shippedDelayDays":{"type":"integer","minimum":1,"maximum":14},"locationId":{"type":"string"},"consent":{"type":"boolean","const":true}},"required":["provider","apiUser","apiKey","consent"]}]}}}}}},"/v1/integrations/dinero/start":{"post":{"operationId":"startDinero","tags":["Integrations"],"summary":"Begin connecting Dinero (Visma Connect sign-in)","security":[{"session":[]}],"responses":{"200":{"description":"Where to send the browser","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"409":{"description":"Conflicts with current state","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"locationId":{"type":"string"},"consent":{"type":"boolean","const":true}},"required":["consent"]}}}}}},"/v1/integrations/dinero/callback":{"post":{"operationId":"dineroCallback","tags":["Callbacks"],"summary":"Visma Connect's sign-in callback (form_post)","description":"Identified by the signed `state`, not a session: Visma posts it from its own site. Redirects to the dashboard.","responses":{"303":{"description":"Back to Reviews → Integrations"}}}},"/v1/integrations/shipmondo/hook/{id}":{"post":{"operationId":"shipmondoWebhook","tags":["Callbacks"],"summary":"Shipmondo's delivered webhook (HS256 JWT signed with the key trustmy registered)","responses":{"200":{"description":"Received"}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/integrations/{id}":{"patch":{"operationId":"updateIntegration","tags":["Integrations"],"summary":"Choose which location an integration's requests are for","security":[{"session":[]}],"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["economic","dinero","billy","shipmondo"]},"account":{"type":["string","null"]},"locationId":{"type":["string","null"]},"status":{"type":"string","enum":["active","error"]},"lastError":{"type":["string","null"]},"lastSyncAt":{"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":"null"}]},"imported":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"mode":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","provider","account","locationId","status","lastError","lastSyncAt","imported","mode","createdAt"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"locationId":{"type":["string","null"]}},"required":["locationId"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]},"delete":{"operationId":"disconnectIntegration","tags":["Integrations"],"summary":"Disconnect (requests already made stay)","security":[{"session":[]}],"responses":{"204":{"description":"Disconnected"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/integrations/{id}/sync":{"post":{"operationId":"syncIntegration","tags":["Integrations"],"summary":"Look for new invoices or shipments now","security":[{"session":[]}],"responses":{"200":{"description":"Synced","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"provider":{"type":"string","enum":["economic","dinero","billy","shipmondo"]},"account":{"type":["string","null"]},"locationId":{"type":["string","null"]},"status":{"type":"string","enum":["active","error"]},"lastError":{"type":["string","null"]},"lastSyncAt":{"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":"null"}]},"imported":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"mode":{"type":["string","null"]},"createdAt":{"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)))$"}},"required":["id","provider","account","locationId","status","lastError","lastSyncAt","imported","mode","createdAt"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/partner/organizations":{"post":{"operationId":"partnerProvisionOrganization","tags":["Partners"],"summary":"Make (or find) the organisation for one of the partner's businesses, and give it a new API key","description":"Safe to repeat: the same `ref` always means the same organisation, whose name is updated. Each call returns a new API key named after the partner and revokes the partner's earlier key for that organisation. The owner becomes a member: a new address gets an account with no password, an existing one keeps its other organisations. A new organisation sends from its own paired phone at once, and from trustmy's phones or the paid route once trustmy approves it (D21).","security":[{"partnerKey":[]}],"responses":{"200":{"description":"The organisation and its key","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"boolean","description":"False when the organisation existed: its name is updated and nothing else changes"},"apiKey":{"type":"string","description":"A new API key for the organisation. Shown once. The partner's earlier key for it stops working."},"apiKeyId":{"type":"string"},"status":{"type":"object","properties":{"organization":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"slug":{"type":"string"},"trusted":{"type":"boolean","description":"False until trustmy approves the organisation to send from its phones (D21)"},"canSend":{"type":"boolean","description":"True when the organisation has a paired phone of its own, or is approved (D23)"}},"required":["id","name","slug","trusted","canSend"]},"contacts":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"last24h":{"type":"object","propertyNames":{"type":"string","enum":["queued","claimed","sent","delivered","failed","blocked"]},"additionalProperties":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"required":["queued","claimed","sent","delivered","failed","blocked"]},"gateway":{"type":"object","properties":{"mode":{"type":"string","enum":["own","pool"],"description":"`own`: the organisation's paired phones send its messages. `pool`: trustmy's phones do (D23)."},"online":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Phones in this sending mode seen in the last 5 minutes"},"total":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["mode","online","total"]},"paid":{"type":"object","properties":{"available":{"type":"boolean","description":"trustmy has a paid SMS provider configured"},"canSend":{"type":"boolean","description":"Available, approved, and credits left"},"balanceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"priceOre":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"Price per SMS part on the paid tier, in øre"},"senderName":{"type":["string","null"]},"defaultRoute":{"type":"string","enum":["phone","api"]}},"required":["available","canSend","balanceOre","priceOre","senderName","defaultRoute"]},"webhookUrl":{"type":["string","null"]},"sending":{"type":"object","properties":{"from":{"type":"string","description":"Texts go out from this time, HH:MM Copenhagen time"},"until":{"type":"string","description":"and until this time"},"earliest":{"type":"string","description":"trustmy's earliest: `from` can be no earlier"},"latest":{"type":"string","description":"trustmy's latest: `until` can be no later"},"phoneDailyCap":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991,"description":"How many texts each of the organisation's own phones sends in 24 h"},"nightUntil":{"description":"Night sending is on until this time (D38): own phones also send between `until` and `from`","type":["string","null"]}},"required":["from","until","earliest","latest","phoneDailyCap","nightUntil"],"description":"When and how much the organisation's texts go out (D35)"}},"required":["organization","contacts","last24h","gateway","paid","webhookUrl","sending"]}},"required":["created","apiKey","apiKeyId","status"]}}}},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ref":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9:._-]{0,119}$","description":"The partner's own id for the business, e.g. its workspace slug. The same ref always means the same organisation."},"name":{"type":"string","minLength":1,"maxLength":60,"description":"The business's name, also the prefix of its texts from a phone"},"owner":{"type":"object","properties":{"email":{"type":"string","maxLength":200,"format":"email","pattern":"^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"},"name":{"type":"string","minLength":1,"maxLength":120}},"required":["email"],"description":"The business's owner: a trustmy account is made for them without a password, or an existing one is added"}},"required":["ref","name","owner"]}}}}}},"/v1/partner/organizations/disconnect":{"post":{"operationId":"partnerDisconnectOrganization","tags":["Partners"],"summary":"Stop the partner's key for one of its businesses","description":"The organisation, its contacts, phones and credit stay; calling `partnerProvisionOrganization` again connects it anew.","security":[{"partnerKey":[]}],"responses":{"204":{"description":"Disconnected"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"ref":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9:._-]{0,119}$","description":"The partner's own id for the business, e.g. its workspace slug. The same ref always means the same organisation."}},"required":["ref"]}}}}}},"/v1/admin/organizations":{"get":{"operationId":"adminListOrganizations","tags":["Operator"],"summary":"Every organisation, newest first, with owner, approval state and credit balance (øre)","responses":{"200":{"description":"Organisations"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}}}},"/v1/admin/organizations/{id}/credits":{"post":{"operationId":"adminGrantCredits","tags":["Operator"],"summary":"Add (or with a negative amount, remove) credit by hand","security":[{"adminToken":[]}],"responses":{"204":{"description":"Booked"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"amountOre":{"type":"integer","minimum":-1000000,"maximum":10000000},"note":{"type":"string","minLength":1,"maxLength":200}},"required":["amountOre","note"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/admin/organizations/{id}/trust":{"post":{"operationId":"adminTrustOrganization","tags":["Operator"],"summary":"Approve an organisation to send (D21)","responses":{"204":{"description":"Approved"},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}},"/v1/admin/organizations/{id}/night-sending":{"post":{"operationId":"adminSetNightSending","tags":["Operator"],"summary":"Let an organisation's own phones send at night for some hours (D38); 0 ends it","description":"For testing. trustmy's phones keep quiet hours; daily caps and gaps still apply.","security":[{"adminToken":[]}],"responses":{"200":{"description":"Until when, or null"},"400":{"description":"Invalid request (`invalid_request`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"401":{"description":"Not signed in, or missing or invalid bearer token (`unauthorized`)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}},"404":{"description":"Resource not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Stable machine-readable error code, e.g. `invalid_request`"},"message":{"type":"string"},"requestId":{"type":["string","null"]},"details":{}},"required":["code","message","requestId"]}},"required":["error"]}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"hours":{"type":"integer","minimum":0,"maximum":72}},"required":["hours"]}}}},"parameters":[{"schema":{"type":"string"},"in":"path","name":"id","required":true}]}}}}