{"openapi":"3.1.0","info":{"title":"Auftragspilot API","version":"1.0.0","description":"WhatsApp/Instagram inbox, AI agent, calendar and CRM of one Auftragspilot account. Same tools as the MCP server (/api/mcp). Webhook payloads are signed: X-Auftragspilot-Signature t=<unix>,v1=hex(HMAC_SHA256(secret, '<t>.<raw body>'))."},"servers":[{"url":"https://app.larsomatic.org"}],"security":[{"bearer":[]}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Access key ap_… from the portal (Own AI agent)"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}},"paths":{"/api/v1/list_clients":{"post":{"operationId":"list_clients","summary":"List the businesses (clients) in this account with their status.","description":"List the businesses (clients) in this account with their status.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_conversations":{"post":{"operationId":"list_conversations","summary":"List recent conversations (leads) with channel, status, last message and whether the AI is paused","description":"List recent conversations (leads) with channel, status, last message and whether the AI is paused. Use unanswered_only to find guests waiting for a reply.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional)"},"status":{"type":"string","enum":["Neu","Kontaktiert","Termine angeboten","Qualifiziert","Termin gebucht","Abgeschlossen (gewonnen)","Nicht qualifiziert","Verloren","Termin storniert"]},"unanswered_only":{"type":"boolean","description":"only conversations whose last message is from the guest"},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_conversation":{"post":{"operationId":"get_conversation","summary":"Full conversation of one lead: contact, answers, booking, and the last 60 messages/events.","description":"Full conversation of one lead: contact, answers, booking, and the last 60 messages/events.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"}},"required":["lead_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_bookings":{"post":{"operationId":"list_bookings","summary":"Upcoming bookings that came in through connected booking systems (with guest, date, service, and whether the guest chatt","description":"Upcoming bookings that came in through connected booking systems (with guest, date, service, and whether the guest chatted with the AI first).","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string"},"days_ahead":{"type":"integer","minimum":1,"maximum":120,"default":14}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_report":{"post":{"operationId":"get_report","summary":"This month's numbers per client: new leads, replies, bookings, bookings after an AI chat.","description":"This month's numbers per client: new leads, replies, bookings, bookings after an AI chat.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/send_message":{"post":{"operationId":"send_message","summary":"Send a message to the guest on their channel (WhatsApp or Instagram)","description":"Send a message to the guest on their channel (WhatsApp or Instagram). Only possible within 24 hours of the guest's last message (WhatsApp/Instagram rule). Sending pauses the AI for this conversation, because a human took over.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"text":{"type":"string","maxLength":1000}},"required":["lead_id","text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/set_ai":{"post":{"operationId":"set_ai","summary":"Turn the automatic AI replies on or off for one conversation.","description":"Turn the automatic AI replies on or off for one conversation.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"on":{"type":"boolean"}},"required":["lead_id","on"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/set_status":{"post":{"operationId":"set_status","summary":"Set the pipeline status of a conversation.","description":"Set the pipeline status of a conversation.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"status":{"type":"string","enum":["Neu","Kontaktiert","Termine angeboten","Qualifiziert","Termin gebucht","Abgeschlossen (gewonnen)","Nicht qualifiziert","Verloren","Termin storniert"]}},"required":["lead_id","status"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/add_note":{"post":{"operationId":"add_note","summary":"Add an internal note to a conversation (not sent to the guest).","description":"Add an internal note to a conversation (not sent to the guest).","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"text":{"type":"string","maxLength":2000}},"required":["lead_id","text"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_setup_links":{"post":{"operationId":"get_setup_links","summary":"One-click links for the account owner (valid 2 hours, they log the person straight in): setup assistant, connect WhatsAp","description":"One-click links for the account owner (valid 2 hours, they log the person straight in): setup assistant, connect WhatsApp number, connect calendar (Google/Outlook), lead sources, test on WhatsApp, plan & go live, expert setup. Use for every step that needs the person's own sign-in. Give each link only to the account owner.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug (optional, default all)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/request_expert_setup":{"post":{"operationId":"request_expert_setup","summary":"For people who are unsure or have no time: we (the Auftragspilot team) set everything up for them","description":"For people who are unsure or have no time: we (the Auftragspilot team) set everything up for them. Notifies the team and returns the link to book the expert setup and a link for a free call. Ask the person first.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"note":{"type":"string","description":"what the person needs, in one or two sentences"},"phone":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_setup_status":{"post":{"operationId":"get_setup_status","summary":"Start here","description":"Start here. Setup checklist per client: WhatsApp number, calendar, business knowledge, who answers (built-in AI or your own agent), live status, plan. Returns next_steps in plain words.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_business_brief":{"post":{"operationId":"get_business_brief","summary":"The business knowledge the agent works with: company, services, prices/FAQ (one fact per line), audience, contact person","description":"The business knowledge the agent works with: company, services, prices/FAQ (one fact per line), audience, contact person, rules (no_gos).","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/update_business_brief":{"post":{"operationId":"update_business_brief","summary":"Update the business knowledge (only the fields you pass)","description":"Update the business knowledge (only the fields you pass). faq and no_gos: one fact/rule per line. A live built-in agent is rebuilt automatically (takes a few minutes).","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"},"firma":{"type":"string","maxLength":1500},"branche":{"type":"string","maxLength":1500},"beschreibung":{"type":"string","maxLength":1500},"leistungen":{"type":"string","maxLength":1500},"zielgruppe":{"type":"string","maxLength":1500},"region":{"type":"string","maxLength":1500},"ansprechpartner":{"type":"string","maxLength":1500},"website":{"type":"string","maxLength":1500},"faq":{"type":"string","maxLength":6000},"no_gos":{"type":"string","maxLength":6000},"agent_name":{"type":"string","maxLength":40}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/set_agent_mode":{"post":{"operationId":"set_agent_mode","summary":"Who answers incoming messages","description":"Who answers incoming messages. \"builtin\" = the Auftragspilot AI agent (default). \"own_agent\" = your agent: the built-in AI stays silent, every message comes to you as an event/webhook and you reply with send_message. The first contact (start template) is still sent automatically.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"},"mode":{"type":"string","enum":["builtin","own_agent"]}},"required":["mode"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/pause_all":{"post":{"operationId":"pause_all","summary":"Emergency stop: no automatic replies or follow-ups for this client (or all clients)","description":"Emergency stop: no automatic replies or follow-ups for this client (or all clients). Messages are still logged. Undo with resume_all.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/resume_all":{"post":{"operationId":"resume_all","summary":"Undo pause_all.","description":"Undo pause_all.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_events":{"post":{"operationId":"list_events","summary":"New chat messages as events (message.received = guest wrote, message.sent = business replied), oldest first, with a curs","description":"New chat messages as events (message.received = guest wrote, message.sent = business replied), oldest first, with a cursor. First call without 'after' returns the current cursor and the last events; then pass the returned next_after. wait_seconds (max 25) long-polls until something arrives. Prefer this over polling list_conversations.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"after":{"type":"string","description":"next_after from the previous call"},"wait_seconds":{"type":"integer","minimum":0,"maximum":25,"default":0},"types":{"type":"array","items":{"type":"string","enum":["message.received","message.sent"]}},"client":{"type":"string","description":"client slug or name (optional if the account has only one)"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":50}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/create_webhook":{"post":{"operationId":"create_webhook","summary":"Get a signed POST to your https URL on every event (message.received, message.sent, lead.created)","description":"Get a signed POST to your https URL on every event (message.received, message.sent, lead.created). The secret is shown once: verify X-Auftragspilot-Signature (t=<unix>,v1=hex HMAC-SHA256 of \"<t>.<raw body>\").","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"https URL of your agent/automation (n8n, Make, Zapier, own server)"},"events":{"type":"array","items":{"type":"string","enum":["message.received","message.sent","lead.created"]}}},"required":["url"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_webhooks":{"post":{"operationId":"list_webhooks","summary":"Webhooks of this account with their last delivery status.","description":"Webhooks of this account with their last delivery status.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/delete_webhook":{"post":{"operationId":"delete_webhook","summary":"Delete a webhook.","description":"Delete a webhook.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"webhook_id":{"type":"string"}},"required":["webhook_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/test_webhook":{"post":{"operationId":"test_webhook","summary":"Send a signed test event to a webhook and return the HTTP status.","description":"Send a signed test event to a webhook and return the HTTP status.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"webhook_id":{"type":"string"}},"required":["webhook_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_free_slots":{"post":{"operationId":"get_free_slots","summary":"Free appointment times in the client's calendar (its local time zone).","description":"Free appointment times in the client's calendar (its local time zone).","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"},"date_from":{"type":"string","description":"YYYY-MM-DD, default tomorrow"},"days":{"type":"integer","minimum":1,"maximum":21,"default":7}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/book_appointment":{"post":{"operationId":"book_appointment","summary":"Book an appointment for a conversation at a free time from get_free_slots (ISO start, e.g","description":"Book an appointment for a conversation at a free time from get_free_slots (ISO start, e.g. 2026-11-24T10:00:00+01:00). The guest gets the usual WhatsApp confirmation and reminders.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"start":{"type":"string"}},"required":["lead_id","start"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/start_conversation":{"post":{"operationId":"start_conversation","summary":"Start a WhatsApp conversation with a new contact who agreed to be contacted (e.g","description":"Start a WhatsApp conversation with a new contact who agreed to be contacted (e.g. filled a form). Sends the approved start template; the conversation then shows up in list_conversations. Only for live clients.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string","description":"client slug or name (optional if the account has only one)"},"phone":{"type":"string","description":"international format, e.g. +4917612345678"},"name":{"type":"string"},"email":{"type":"string"},"consent":{"type":"boolean","description":"must be true: the person agreed to be contacted on WhatsApp"}},"required":["phone","consent"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_usage":{"post":{"operationId":"get_usage","summary":"Current plan, billing period and usage so far (units and usage cost).","description":"Current plan, billing period and usage so far (units and usage cost).","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/wait_for_events":{"post":{"operationId":"wait_for_events","summary":"Waits up to 25 s for new messages/events and returns them (use instead of polling list calls)","description":"Waits up to 25 s for new messages/events and returns them (use instead of polling list calls). Pass next_after from the previous call.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"after":{"type":"string"},"client":{"type":"string"},"types":{"type":"array","items":{"type":"string"}}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_templates":{"post":{"operationId":"list_templates","summary":"Approved WhatsApp templates known for a client (start template and follow-up templates)","description":"Approved WhatsApp templates known for a client (start template and follow-up templates). Only templates can reach people outside the 24-hour window.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string"}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/send_template":{"post":{"operationId":"send_template","summary":"Sends an approved WhatsApp template to one lead (works outside the 24-hour window)","description":"Sends an approved WhatsApp template to one lead (works outside the 24-hour window). Lead must not have opted out.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"template_name":{"type":"string","description":"name of an approved WhatsApp template (list_templates)"},"language":{"type":"string","description":"template language code, e.g. de or en"},"parameters":{"type":"array","items":{"type":"string"},"description":"values for {{1}}, {{2}} … in the template body"},"idempotency_key":{"type":"string","description":"any unique string per intended message: a retry with the same key never sends twice (24 h)"}},"required":["lead_id","template_name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/schedule_message":{"post":{"operationId":"schedule_message","summary":"Schedules a text (needs an open 24-hour window at send time) or a template to one lead, up to 90 days ahead","description":"Schedules a text (needs an open 24-hour window at send time) or a template to one lead, up to 90 days ahead. send_at ISO time.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"send_at":{"type":"string"},"text":{"type":"string"},"template_name":{"type":"string","description":"name of an approved WhatsApp template (list_templates)"},"language":{"type":"string","description":"template language code, e.g. de or en"},"parameters":{"type":"array","items":{"type":"string"},"description":"values for {{1}}, {{2}} … in the template body"},"idempotency_key":{"type":"string","description":"any unique string per intended message: a retry with the same key never sends twice (24 h)"}},"required":["lead_id","send_at"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_scheduled":{"post":{"operationId":"list_scheduled","summary":"Scheduled messages, approvals and broadcast/sequence items that are still open.","description":"Scheduled messages, approvals and broadcast/sequence items that are still open.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["scheduled","approval","sent","failed","cancelled"]},"limit":{"type":"number"}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/cancel_scheduled":{"post":{"operationId":"cancel_scheduled","summary":"Cancels a scheduled message or open approval.","description":"Cancels a scheduled message or open approval.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_approvals":{"post":{"operationId":"list_approvals","summary":"Messages prepared by draft keys that wait for the owner's approval.","description":"Messages prepared by draft keys that wait for the owner's approval.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/approve":{"post":{"operationId":"approve","summary":"Owner only (write key or app): releases a prepared message.","description":"Owner only (write key or app): releases a prepared message.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/reject":{"post":{"operationId":"reject","summary":"Owner only: discards a prepared message.","description":"Owner only: discards a prepared message.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"reason":{"type":"string"}},"required":["id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/create_broadcast":{"post":{"operationId":"create_broadcast","summary":"Prepares a template broadcast to leads of one client (max 1000)","description":"Prepares a template broadcast to leads of one client (max 1000). Filter by status and/or created_after, or pass lead_ids. Nothing is sent until send_broadcast.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string"},"name":{"type":"string"},"template_name":{"type":"string","description":"name of an approved WhatsApp template (list_templates)"},"language":{"type":"string","description":"template language code, e.g. de or en"},"parameters":{"type":"array","items":{"type":"string"},"description":"values for {{1}}, {{2}} … in the template body"},"lead_ids":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"created_after":{"type":"string"}},"required":["template_name"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/send_broadcast":{"post":{"operationId":"send_broadcast","summary":"Owner only","description":"Owner only. Starts a prepared broadcast: needs confirm=true and consent_confirmed=true (all recipients agreed to be contacted). Sent at 30 per minute, 08:00-20:00, opted-out leads are skipped. send_at optional.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"broadcast_id":{"type":"string"},"confirm":{"type":"boolean"},"consent_confirmed":{"type":"boolean"},"send_at":{"type":"string"}},"required":["broadcast_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/get_broadcast":{"post":{"operationId":"get_broadcast","summary":"Status and counts of a broadcast (or list all when broadcast_id is empty).","description":"Status and counts of a broadcast (or list all when broadcast_id is empty).","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"broadcast_id":{"type":"string"}},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/create_sequence":{"post":{"operationId":"create_sequence","summary":"Creates a follow-up sequence (max 6 steps, each after_hours >= 1 since the previous step, text or template)","description":"Creates a follow-up sequence (max 6 steps, each after_hours >= 1 since the previous step, text or template). Stops automatically when the lead replies or opts out.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string"},"name":{"type":"string"},"steps":{"type":"array","items":{"type":"object","properties":{"after_hours":{"type":"number"},"text":{"type":"string"},"template_name":{"type":"string"},"language":{"type":"string"},"parameters":{"type":"array","items":{"type":"string"}}}}}},"required":["steps"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/list_sequences":{"post":{"operationId":"list_sequences","summary":"Sequences of the account.","description":"Sequences of the account.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{},"required":[]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/enroll_in_sequence":{"post":{"operationId":"enroll_in_sequence","summary":"Puts leads into a sequence (max 200 per call).","description":"Puts leads into a sequence (max 200 per call).","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"sequence_id":{"type":"string"},"lead_ids":{"type":"array","items":{"type":"string"}}},"required":["sequence_id","lead_ids"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/stop_sequence":{"post":{"operationId":"stop_sequence","summary":"Stops a sequence for one lead, or for everyone when lead_id is empty.","description":"Stops a sequence for one lead, or for everyone when lead_id is empty.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"sequence_id":{"type":"string"},"lead_id":{"type":"string"}},"required":["sequence_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/hand_to_person":{"post":{"operationId":"hand_to_person","summary":"Hands a conversation to a human: the built-in AI pauses and agents can no longer send there (HANDED_OVER) until hand_bac","description":"Hands a conversation to a human: the built-in AI pauses and agents can no longer send there (HANDED_OVER) until hand_back_to_agent.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"note":{"type":"string"}},"required":["lead_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/hand_back_to_agent":{"post":{"operationId":"hand_back_to_agent","summary":"Gives a handed-over conversation back to the agents (and optionally resumes the built-in AI).","description":"Gives a handed-over conversation back to the agents (and optionally resumes the built-in AI).","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string"},"resume_ai":{"type":"boolean"}},"required":["lead_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/start_setup_test":{"post":{"operationId":"start_setup_test","summary":"Setup test: sends the client's first WhatsApp to the person's OWN phone (ask for it first)","description":"Setup test: sends the client's first WhatsApp to the person's OWN phone (ask for it first). Then poll check_setup_test.","tags":["write"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"client":{"type":"string"},"phone":{"type":"string","description":"the person's own WhatsApp number, international format"},"name":{"type":"string"}},"required":["phone"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}},"/api/v1/check_setup_test":{"post":{"operationId":"check_setup_test","summary":"Result of a setup test: message sent, reply received, what is still missing.","description":"Result of a setup test: message sent, reply received, what is still missing.","tags":["read"],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"test_id":{"type":"string"}},"required":["test_id"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"data":{}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid access key"},"403":{"description":"Read-only key"},"429":{"description":"Rate limit (600 requests per hour per key)"}}}}}}