{"openapi":"3.0.3","info":{"title":"BlueyEmail API","version":"2.0.0","description":"Public REST API for BlueyEmail. Authenticate with an API key (Bearer or `X-API-Key`) or an OAuth2 access token. Triggers are delivered as REST hooks (see `/hooks/subscribe`); deliveries are HMAC-signed with the subscription `secret` via the `X-Bluey-Signature` header.\n\n**Idempotency.** Any request that changes data (POST, PATCH, PUT, DELETE) accepts an `Idempotency-Key` header. Send the same key again and the original response is replayed rather than the write repeated — the replay carries `Idempotent-Replay: true`. A request still in flight under that key returns `409 IDEMPOTENCY_IN_PROGRESS`. Keys are scoped to your workspace and to the specific endpoint, and are remembered for 24 hours. Only successful (2xx) responses are stored: if a call fails validation you can correct the body and retry with the same key. The header is optional — omit it and behaviour is unchanged.\n\nUse it whenever a retry is possible, which for an automated client is always: a request that times out may well have succeeded, and without a key the retry creates a duplicate.","contact":{"name":"BlueyEmail","url":"https://api.blueyemail.com"}},"servers":[{"url":"https://api.blueyemail.com/api/v2","description":"Public API v2"}],"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":[]}],"tags":[{"name":"Auth"},{"name":"Contacts"},{"name":"Audiences"},{"name":"Campaigns"},{"name":"Automations"},{"name":"Forms"},{"name":"Email"},{"name":"Templates"},{"name":"Domains"},{"name":"CRM","description":"Pipelines, deals, companies, contacts, tasks, notes, activities, and custom fields."},{"name":"Webhooks (triggers)"},{"name":"Email accounts","description":"Sending accounts (SMTP / OAuth providers) mail goes out through."},{"name":"Suppressions","description":"Suppression groups, per-contact topic preferences, and why an address is suppressed."},{"name":"Email validation","description":"Single and batch address validation."},{"name":"Sandbox","description":"Simulated sending — no mail leaves the platform."},{"name":"Inbound","description":"Received mail and the rules that route it."},{"name":"SMTP relay","description":"Send through BlueyEmail over SMTP instead of REST."},{"name":"Analytics","description":"Aggregate performance, by category, recipient domain and ISP."},{"name":"Migration","description":"Bulk import from another email platform."}],"x-webhook-events":["form.submitted","form.verified","lead.created","lead.updated","lead.tagged","lead.unsubscribed","email.sent","email.opened","email.clicked","email.replied","email.bounced","campaign.started","campaign.completed","campaign.lead_enrolled","campaign.lead_exited","automation.started","automation.completed","automation.step_completed","waitlist.joined","waitlist.verified","waitlist.position_changed","waitlist.referral","payment.success","payment.failed","email.delivered","email.complained","email.held","email.received","email.deferred","page.viewed","web.event"],"paths":{"/crm/stats":{"get":{"tags":["CRM"],"operationId":"crmGetStats","summary":"CRM pipeline stats","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","description":"Aggregate deal counts / values by stage."}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/overview":{"get":{"tags":["CRM"],"operationId":"crmGetOverview","summary":"CRM overview (stats + pipelines in one call)","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"stats":{"type":"object"},"pipelines":{"type":"array","items":{"$ref":"#/components/schemas/Pipeline"}}}}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/pipelines":{"get":{"tags":["CRM"],"operationId":"crmListPipelines","summary":"List pipelines","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"post":{"tags":["CRM"],"operationId":"crmCreatePipeline","summary":"Create a pipeline","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pipeline"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/pipelines/{id}":{"get":{"tags":["CRM"],"operationId":"crmGetPipeline","summary":"Get a pipeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pipeline"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"patch":{"tags":["CRM"],"operationId":"crmUpdatePipeline","summary":"Update a pipeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pipeline"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"},"delete":{"tags":["CRM"],"operationId":"crmDeletePipeline","summary":"Delete a pipeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/pipelines/{id}/board":{"get":{"tags":["CRM"],"operationId":"crmGetPipelineBoard","summary":"Kanban board for a pipeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"per_stage_limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":100}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","description":"{ pipeline, columns: {<stage>: Deal[]}, deals: Deal[], per_stage_limit, stage_meta }"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/reports/forecast":{"get":{"tags":["CRM"],"operationId":"crmGetForecast","summary":"Weighted pipeline forecast","parameters":[{"name":"pipeline_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/reports/win-rate":{"get":{"tags":["CRM"],"operationId":"crmGetWinRate","summary":"Win rate by rep","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/reports/funnel":{"get":{"tags":["CRM"],"operationId":"crmGetFunnel","summary":"Stage funnel","parameters":[{"name":"pipeline_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"funnel":{"type":"array","items":{"type":"object","properties":{"stage":{"type":"string"},"color":{"type":"string"},"deal_count":{"type":"integer"},"total_value":{"type":"number"}}}}}}}}},"404":{"description":"Pipeline not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/deals/export":{"get":{"tags":["CRM"],"operationId":"crmExportDeals","summary":"Export deals as CSV","description":"Accepts the same filters as GET /crm/deals. Returns text/csv (up to 5000 rows).","parameters":[{"name":"pipeline_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"stage","in":"query","schema":{"type":"string"}},{"name":"lead_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"assigned_to","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"value_min","in":"query","schema":{"type":"string"}},{"name":"value_max","in":"query","schema":{"type":"string"}},{"name":"close_before","in":"query","schema":{"type":"string"}},{"name":"close_after","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["won","lost","open"]}},{"name":"rotting","in":"query","schema":{"type":"string","enum":["true"]}}],"responses":{"200":{"description":"CSV export","content":{"text/csv":{"schema":{"type":"string"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/activities":{"get":{"tags":["CRM"],"operationId":"crmListActivities","summary":"List logged activities","parameters":[{"name":"deal_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"lead_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"post":{"tags":["CRM"],"operationId":"crmLogActivity","summary":"Log an activity","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Activity"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/companies/stats":{"get":{"tags":["CRM"],"operationId":"crmGetCompanyStats","summary":"Company stats","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"total_companies":{"type":"integer"},"new_this_month":{"type":"integer"}}}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/companies":{"get":{"tags":["CRM"],"operationId":"crmListCompanies","summary":"List companies","parameters":[{"name":"search","in":"query","schema":{"type":"string"}},{"name":"assigned_to","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"post":{"tags":["CRM"],"operationId":"crmCreateCompany","summary":"Create a company","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Company"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/companies/{id}":{"get":{"tags":["CRM"],"operationId":"crmGetCompany","summary":"Get a company","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Company"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"patch":{"tags":["CRM"],"operationId":"crmUpdateCompany","summary":"Update a company","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CompanyInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Company"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"},"delete":{"tags":["CRM"],"operationId":"crmDeleteCompany","summary":"Delete a company","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/companies/{id}/contacts":{"get":{"tags":["CRM"],"operationId":"crmGetCompanyContacts","summary":"List contacts for a company","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"contacts":{"type":"array","items":{"type":"object"}}}}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/companies/{id}/deals":{"get":{"tags":["CRM"],"operationId":"crmGetCompanyDeals","summary":"List deals for a company","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"deals":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}}}}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/contacts/{leadId}/company":{"patch":{"tags":["CRM"],"operationId":"crmSetContactCompany","summary":"Link or unlink a contact to a company","parameters":[{"name":"leadId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"company_id":{"type":"string","format":"uuid","nullable":true,"description":"null unlinks the contact."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid","nullable":true}}}}}},"400":{"description":"Invalid company_id","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Lead not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/custom-fields":{"get":{"tags":["CRM"],"operationId":"crmListCustomFields","summary":"List custom field definitions","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"post":{"tags":["CRM"],"operationId":"crmCreateCustomField","summary":"Create a custom field","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomField"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/custom-fields/{id}":{"patch":{"tags":["CRM"],"operationId":"crmUpdateCustomField","summary":"Update a custom field","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomFieldInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomField"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"},"delete":{"tags":["CRM"],"operationId":"crmDeleteCustomField","summary":"Delete a custom field","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/deals/by-lead/{leadId}":{"get":{"tags":["CRM"],"operationId":"crmGetDealsByLead","summary":"Deals for a contact","parameters":[{"name":"leadId","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"deals":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}}}}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/deals/bulk":{"post":{"tags":["CRM"],"operationId":"crmBulkUpdateDeals","summary":"Bulk update deals","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["ids","action"],"properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"maxItems":500},"action":{"type":"string","enum":["delete","assign","move_stage"]},"assigned_to":{"type":"string","format":"uuid","nullable":true},"stage":{"type":"string","description":"Required when action=move_stage."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"affected":{"type":"integer"}}}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/deals":{"get":{"tags":["CRM"],"operationId":"crmListDeals","summary":"List deals","parameters":[{"name":"pipeline_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"stage","in":"query","schema":{"type":"string"}},{"name":"lead_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"assigned_to","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"value_min","in":"query","schema":{"type":"string"}},{"name":"value_max","in":"query","schema":{"type":"string"}},{"name":"close_before","in":"query","schema":{"type":"string"}},{"name":"close_after","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string","enum":["won","lost","open"]}},{"name":"rotting","in":"query","schema":{"type":"string","enum":["true"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":500,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"default":0}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"post":{"tags":["CRM"],"operationId":"crmCreateDeal","summary":"Create a deal","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deal"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/deals/{id}":{"get":{"tags":["CRM"],"operationId":"crmGetDeal","summary":"Get a deal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deal"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"patch":{"tags":["CRM"],"operationId":"crmUpdateDeal","summary":"Update a deal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deal"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"},"delete":{"tags":["CRM"],"operationId":"crmDeleteDeal","summary":"Delete a deal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/deals/{id}/stage":{"patch":{"tags":["CRM"],"operationId":"crmMoveDealStage","summary":"Move a deal to a stage / position","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"stage":{"type":"string"},"position":{"type":"integer"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Deal"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/deals/{id}/activity":{"get":{"tags":["CRM"],"operationId":"crmGetDealActivity","summary":"Activity feed for a deal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/deals/{id}/history":{"get":{"tags":["CRM"],"operationId":"crmGetDealHistory","summary":"Change history for a deal","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"history":{"type":"array","items":{"type":"object"}}}}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"}},"/crm/notes":{"get":{"tags":["CRM"],"operationId":"crmListNotes","summary":"List notes","parameters":[{"name":"lead_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"deal_id","in":"query","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"post":{"tags":["CRM"],"operationId":"crmCreateNote","summary":"Create a note","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Note"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/notes/{id}":{"patch":{"tags":["CRM"],"operationId":"crmUpdateNote","summary":"Update a note","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteUpdateInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Note"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"},"delete":{"tags":["CRM"],"operationId":"crmDeleteNote","summary":"Delete a note","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/notes/{id}/toggle-pin":{"post":{"tags":["CRM"],"operationId":"crmToggleNotePin","summary":"Pin / unpin a note","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Note"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/tasks":{"get":{"tags":["CRM"],"operationId":"crmListTasks","summary":"List tasks","parameters":[{"name":"lead_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"deal_id","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"assigned_to","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"completed","in":"query","schema":{"type":"string","enum":["true","false"]}},{"name":"overdue","in":"query","schema":{"type":"string","enum":["true"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"post":{"tags":["CRM"],"operationId":"crmCreateTask","summary":"Create a task","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/tasks/{id}":{"get":{"tags":["CRM"],"operationId":"crmGetTask","summary":"Get a task","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:read"]}],"x-required-scopes":["crm:read"],"x-scope-match":"any"},"patch":{"tags":["CRM"],"operationId":"crmUpdateTask","summary":"Update a task","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaskInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"},"delete":{"tags":["CRM"],"operationId":"crmDeleteTask","summary":"Delete a task","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/crm/tasks/{id}/complete":{"post":{"tags":["CRM"],"operationId":"crmCompleteTask","summary":"Mark a task complete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Task"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["crm:write"]}],"x-required-scopes":["crm:write"],"x-scope-match":"any"}},"/openapi.json":{"get":{"tags":["Auth"],"operationId":"getOpenApiSpec","summary":"Fetch this OpenAPI document","description":"Unauthenticated. Returned spec reflects the runtime `API_URL` in `servers[0].url`.","security":[],"responses":{"200":{"description":"OpenAPI 3 document","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}}}}},"/examples":{"get":{"tags":["Auth"],"operationId":"getApiExamples","summary":"Copy-paste request examples","description":"Worked examples for the common endpoints, handy when wiring a connector by hand.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":[]}],"x-required-scopes":[],"x-scope-match":"any"}},"/leads/{id}":{"get":{"tags":["Contacts"],"operationId":"getLead","summary":"Get a contact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"},"patch":{"tags":["Contacts"],"operationId":"updateLead","summary":"Update a contact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"},"delete":{"tags":["Contacts"],"operationId":"deleteLead","summary":"Delete a contact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/leads/bulk":{"post":{"tags":["Contacts"],"operationId":"createLeadsBulk","summary":"Create contacts in bulk","description":"Up to 1000 per call. Rows without an email are skipped rather than rejected, so a partial success is normal — check the response counts.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["leads"],"properties":{"leads":{"type":"array","items":{"$ref":"#/components/schemas/LeadInput"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Missing leads array, or more than 1000 rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/leads/import":{"post":{"tags":["Contacts"],"operationId":"importLeads","summary":"Import contacts from a CSV file","description":"multipart/form-data upload — NOT JSON. The file field MUST be named `file`. The CSV needs a header row with an `email` column; `first_name`, `last_name` and `phone` are recognised if present. Rows with a blank email are skipped.","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","required":["file"],"properties":{"file":{"type":"string","format":"binary","description":"CSV file with an `email` header column."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"No file, missing email column, or no data rows","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/audiences":{"get":{"tags":["Audiences"],"operationId":"listAudiences","summary":"List audiences","description":"Used by the Make app and n8n node to populate the audience picker.","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:read"]}],"x-required-scopes":["audiences:read"],"x-scope-match":"any"},"post":{"tags":["Audiences"],"operationId":"createAudience","summary":"Create an audience","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Audience name is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:write"]}],"x-required-scopes":["audiences:write"],"x-scope-match":"any"}},"/audiences/{id}":{"get":{"tags":["Audiences"],"operationId":"getAudience","summary":"Get an audience","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:read"]}],"x-required-scopes":["audiences:read"],"x-scope-match":"any"},"patch":{"tags":["Audiences"],"operationId":"updateAudience","summary":"Update an audience","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:write"]}],"x-required-scopes":["audiences:write"],"x-scope-match":"any"},"delete":{"tags":["Audiences"],"operationId":"deleteAudience","summary":"Delete an audience","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:write"]}],"x-required-scopes":["audiences:write"],"x-scope-match":"any"}},"/audiences/{id}/leads":{"get":{"tags":["Audiences"],"operationId":"getAudienceLeads","summary":"List contacts in an audience","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceMemberList"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:read"]}],"x-required-scopes":["audiences:read"],"x-scope-match":"any"},"delete":{"tags":["Audiences"],"operationId":"removeAudienceLeads","summary":"Remove contacts from an audience","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["lead_ids"],"properties":{"lead_ids":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"lead_ids array is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:write"]}],"x-required-scopes":["audiences:write"],"x-scope-match":"any"},"post":{"tags":["Audiences"],"operationId":"addAudienceLeads","summary":"Add contacts to an audience","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"emails":{"type":"array","items":{"type":"string","format":"email"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["audiences:write"]}],"x-required-scopes":["audiences:write"],"x-scope-match":"any"}},"/campaigns/{id}":{"get":{"tags":["Campaigns"],"operationId":"getCampaign","summary":"Get a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"},"patch":{"tags":["Campaigns"],"operationId":"updateCampaign","summary":"Update a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"email_account_id":{"type":"string","format":"uuid"},"timezone":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"No recognised fields in body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"},"delete":{"tags":["Campaigns"],"operationId":"deleteCampaign","summary":"Delete a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/campaigns/{id}/stats":{"get":{"tags":["Campaigns"],"operationId":"getCampaignStats","summary":"Campaign performance stats","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"}},"/campaigns/{id}/leads":{"get":{"tags":["Campaigns"],"operationId":"getCampaignLeads","summary":"List contacts enrolled in a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignEnrollmentList"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"},"delete":{"tags":["Campaigns"],"operationId":"removeCampaignLeads","summary":"Un-enroll contacts from a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["lead_ids"],"properties":{"lead_ids":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"lead_ids array is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"},"post":{"tags":["Campaigns"],"operationId":"enrollLeads","summary":"Enroll contacts into a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"emails":{"type":"array","items":{"type":"string","format":"email"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/campaigns/{id}/sequences":{"get":{"tags":["Campaigns"],"operationId":"listCampaignSequences","summary":"List sequence steps","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"},"post":{"tags":["Campaigns"],"operationId":"addCampaignSequence","summary":"Append a sequence step","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"string"},"body":{"type":"string"},"template_id":{"type":"string","format":"uuid"},"delay_days":{"type":"integer","default":0},"delay_hours":{"type":"integer","default":0}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"},"patch":{"tags":["Campaigns"],"operationId":"updateCampaignSequences","summary":"Replace all sequence steps","description":"Sends the whole ordered list; steps not present are removed.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["sequences"],"properties":{"sequences":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/campaigns/{id}/sequences/{stepId}":{"delete":{"tags":["Campaigns"],"operationId":"deleteCampaignSequence","summary":"Delete a sequence step","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"stepId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Sequence step id."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/automations":{"get":{"tags":["Automations"],"operationId":"listAutomations","summary":"List automations","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["automations:read"]}],"x-required-scopes":["automations:read"],"x-scope-match":"any"}},"/forms":{"get":{"tags":["Forms"],"operationId":"listForms","summary":"List forms","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["forms:read"]}],"x-required-scopes":["forms:read"],"x-scope-match":"any"},"post":{"tags":["Forms"],"operationId":"createForm","summary":"Create a form","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"type":{"type":"string"},"fields":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Form name is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["forms:write"]}],"x-required-scopes":["forms:write"],"x-scope-match":"any"}},"/forms/{id}":{"get":{"tags":["Forms"],"operationId":"getForm","summary":"Get a form","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["forms:read"]}],"x-required-scopes":["forms:read"],"x-scope-match":"any"},"patch":{"tags":["Forms"],"operationId":"updateForm","summary":"Update a form","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"fields":{"type":"array","items":{"type":"object","additionalProperties":true}},"status":{"type":"string"},"settings":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["forms:write"]}],"x-required-scopes":["forms:write"],"x-scope-match":"any"},"delete":{"tags":["Forms"],"operationId":"deleteForm","summary":"Delete a form","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["forms:write"]}],"x-required-scopes":["forms:write"],"x-scope-match":"any"}},"/forms/{id}/submissions":{"get":{"tags":["Forms"],"operationId":"getFormSubmissions","summary":"List form submissions","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["forms:read"]}],"x-required-scopes":["forms:read"],"x-scope-match":"any"}},"/email-accounts":{"get":{"tags":["Email accounts"],"operationId":"listEmailAccounts","summary":"List sending accounts","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["email-accounts:read"]}],"x-required-scopes":["email-accounts:read"],"x-scope-match":"any"}},"/email-accounts/providers":{"get":{"tags":["Email accounts"],"operationId":"listEmailProviders","summary":"List supported providers","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["email-accounts:read"]}],"x-required-scopes":["email-accounts:read"],"x-scope-match":"any"}},"/email-accounts/smtp":{"post":{"tags":["Email accounts"],"operationId":"createSmtpAccount","summary":"Connect an SMTP sending account","description":"Note: delivered/bounced events are unavailable on customer SMTP — only opens and clicks are tracked.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","smtp_host","smtp_port","smtp_user","smtp_pass"],"properties":{"email":{"type":"string","format":"email"},"display_name":{"type":"string"},"smtp_host":{"type":"string"},"smtp_port":{"type":"integer"},"smtp_user":{"type":"string"},"smtp_pass":{"type":"string","format":"password"},"smtp_secure":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"email, smtp_host, smtp_port, smtp_user and smtp_pass are all required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["email-accounts:write"]}],"x-required-scopes":["email-accounts:write"],"x-scope-match":"any"}},"/email-accounts/{id}":{"get":{"tags":["Email accounts"],"operationId":"getEmailAccount","summary":"Get a sending account","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["email-accounts:read"]}],"x-required-scopes":["email-accounts:read"],"x-scope-match":"any"},"patch":{"tags":["Email accounts"],"operationId":"updateEmailAccount","summary":"Update a sending account","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"display_name":{"type":"string"},"smtp_host":{"type":"string"},"smtp_port":{"type":"integer"},"smtp_user":{"type":"string"},"smtp_pass":{"type":"string","format":"password"},"smtp_secure":{"type":"boolean"},"is_active":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["email-accounts:write"]}],"x-required-scopes":["email-accounts:write"],"x-scope-match":"any"},"delete":{"tags":["Email accounts"],"operationId":"deleteEmailAccount","summary":"Delete a sending account","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["email-accounts:write"]}],"x-required-scopes":["email-accounts:write"],"x-scope-match":"any"}},"/email-accounts/{id}/test":{"post":{"tags":["Email accounts"],"operationId":"testEmailAccount","summary":"Send a test email from an account","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["to"],"properties":{"to":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Recipient required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["email-accounts:write"]}],"x-required-scopes":["email-accounts:write"],"x-scope-match":"any"}},"/email-templates/{id}":{"get":{"tags":["Templates"],"operationId":"getEmailTemplate","summary":"Get an email template","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:read"]},{"OAuth2":["emails:read"]}],"x-required-scopes":["templates:read","emails:read"],"x-scope-match":"any"},"patch":{"tags":["Templates"],"operationId":"updateEmailTemplate","summary":"Update an email template","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"subject":{"type":"string"},"html_content":{"type":"string"},"text_content":{"type":"string"},"type":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:write"]},{"OAuth2":["emails:send"]}],"x-required-scopes":["templates:write","emails:send"],"x-scope-match":"any"},"delete":{"tags":["Templates"],"operationId":"deleteEmailTemplate","summary":"Delete an email template","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:write"]},{"OAuth2":["emails:send"]}],"x-required-scopes":["templates:write","emails:send"],"x-scope-match":"any"}},"/templates/render":{"post":{"tags":["Templates"],"operationId":"renderTemplate","summary":"Render a template with variables","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"template_id":{"type":"string","format":"uuid"},"html":{"type":"string"},"subject":{"type":"string"},"variables":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Supply template_id or html","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:read"]},{"OAuth2":["emails:read"]}],"x-required-scopes":["templates:read","emails:read"],"x-scope-match":"any"}},"/templates/render-handlebars":{"post":{"tags":["Templates"],"operationId":"renderHandlebarsTemplate","summary":"Render a Handlebars template","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["template"],"properties":{"template":{"type":"string"},"data":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Template required or failed to compile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:read"]},{"OAuth2":["emails:read"]}],"x-required-scopes":["templates:read","emails:read"],"x-scope-match":"any"}},"/templates/validate-handlebars":{"post":{"tags":["Templates"],"operationId":"validateHandlebarsTemplate","summary":"Validate Handlebars syntax","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["template"],"properties":{"template":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Template required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:read"]},{"OAuth2":["emails:read"]}],"x-required-scopes":["templates:read","emails:read"],"x-scope-match":"any"}},"/templates/extract-variables":{"post":{"tags":["Templates"],"operationId":"extractTemplateVariables","summary":"List variables used in a template","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["template"],"properties":{"template":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Template required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:read"]},{"OAuth2":["emails:read"]}],"x-required-scopes":["templates:read","emails:read"],"x-scope-match":"any"}},"/emails":{"get":{"tags":["Email"],"operationId":"listEmailLogs","summary":"List email logs","parameters":[{"name":"status","in":"query","schema":{"type":"string"},"description":"Delivery status filter. NOTE: this column is delivery state, not engagement — for opens/clicks use the dedicated stats endpoints."},{"name":"to_email","in":"query","schema":{"type":"string","format":"email"}},{"name":"from_date","in":"query","schema":{"type":"string","format":"date"}},{"name":"to_date","in":"query","schema":{"type":"string","format":"date"}},{"name":"source","in":"query","schema":{"type":"string"}},{"name":"email_type","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:read"]}],"x-required-scopes":["emails:read"],"x-scope-match":"any"}},"/emails/stats":{"get":{"tags":["Email"],"operationId":"getEmailStats","summary":"Aggregate email stats","parameters":[{"name":"period","in":"query","schema":{"type":"string"},"description":"Reporting window, e.g. 7d / 30d."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:read"]}],"x-required-scopes":["emails:read"],"x-scope-match":"any"}},"/emails/{trackingId}":{"get":{"tags":["Email"],"operationId":"getEmailStatus","summary":"Get delivery status of one email","parameters":[{"name":"trackingId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Tracking id of the email."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:read"]}],"x-required-scopes":["emails:read"],"x-scope-match":"any"}},"/transactional/batch":{"post":{"tags":["Email"],"operationId":"sendTransactionalBatch","summary":"Send a batch of transactional emails","description":"Supply an `idempotency_key` (or the `Idempotency-Key` header) so a retried batch is not sent twice.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/TransactionalInput"}},"idempotency_key":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"messages array required or an address was rejected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan limit reached","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:send"]}],"x-required-scopes":["emails:send"],"x-scope-match":"any"}},"/transactional/{id}":{"get":{"tags":["Email"],"operationId":"getTransactionalStatus","summary":"Get status of a transactional send","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:read"]}],"x-required-scopes":["emails:read"],"x-scope-match":"any"}},"/transactional/validate":{"post":{"tags":["Email"],"operationId":"validateTransactionalEmail","summary":"Dry-run validate a transactional email","description":"Checks addresses, sender authorisation and template rendering without sending.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"to":{"type":"string","format":"email"},"subject":{"type":"string"},"html":{"type":"string"},"text":{"type":"string"},"from_email":{"type":"string","format":"email"},"template_id":{"type":"string","format":"uuid"},"variables":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:read"]}],"x-required-scopes":["emails:read"],"x-scope-match":"any"}},"/unsubscribe-topics":{"get":{"tags":["Contacts"],"operationId":"listUnsubscribeTopics","summary":"List unsubscribe topics","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"},"post":{"tags":["Contacts"],"operationId":"createUnsubscribeTopic","summary":"Create an unsubscribe topic","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"is_default":{"type":"boolean"},"is_required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Name is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/unsubscribe-topics/{id}":{"patch":{"tags":["Contacts"],"operationId":"updateUnsubscribeTopic","summary":"Update an unsubscribe topic","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"display_name":{"type":"string"},"description":{"type":"string"},"is_default":{"type":"boolean"},"is_required":{"type":"boolean"},"sort_order":{"type":"integer"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"},"delete":{"tags":["Contacts"],"operationId":"deleteUnsubscribeTopic","summary":"Delete an unsubscribe topic","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/suppression-groups":{"get":{"tags":["Suppressions"],"operationId":"listSuppressionGroups","summary":"List suppression groups","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"},"post":{"tags":["Suppressions"],"operationId":"createSuppressionGroup","summary":"Create a suppression group","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"is_default":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Name is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/suppression-groups/{id}":{"get":{"tags":["Suppressions"],"operationId":"getSuppressionGroup","summary":"Get a suppression group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"},"patch":{"tags":["Suppressions"],"operationId":"updateSuppressionGroup","summary":"Update a suppression group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"is_default":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"},"delete":{"tags":["Suppressions"],"operationId":"deleteSuppressionGroup","summary":"Delete a suppression group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/suppression-groups/{id}/members":{"get":{"tags":["Suppressions"],"operationId":"listSuppressionGroupMembers","summary":"List members of a group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"search","in":"query","schema":{"type":"string"},"description":"Filter by email substring."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"},"post":{"tags":["Suppressions"],"operationId":"addSuppressionGroupMembers","summary":"Add emails to a group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["emails"],"properties":{"emails":{"type":"array","items":{"type":"string","format":"email"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"emails array is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"},"delete":{"tags":["Suppressions"],"operationId":"removeSuppressionGroupMembers","summary":"Remove emails from a group","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["emails"],"properties":{"emails":{"type":"array","items":{"type":"string","format":"email"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"emails array is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/suppressions/{email}":{"get":{"tags":["Suppressions"],"operationId":"getEmailSuppressions","summary":"Why is this address suppressed?","description":"Workspace-scoped. The platform-wide global suppression list is admin-only and is not exposed here.","parameters":[{"name":"email","in":"path","required":true,"schema":{"type":"string","format":"email"},"description":"URL-encoded email address."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"}},"/preferences/{email}":{"get":{"tags":["Suppressions"],"operationId":"getSubscriberPreferences","summary":"Get a contact’s topic preferences","parameters":[{"name":"email","in":"path","required":true,"schema":{"type":"string","format":"email"},"description":"URL-encoded email address."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"},"put":{"tags":["Suppressions"],"operationId":"updateSubscriberPreferences","summary":"Set a contact’s topic preferences","parameters":[{"name":"email","in":"path","required":true,"schema":{"type":"string","format":"email"},"description":"URL-encoded email address."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"suppressed_group_ids":{"type":"array","items":{"type":"string","format":"uuid"}},"active_group_ids":{"type":"array","items":{"type":"string","format":"uuid"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/email-validation":{"post":{"tags":["Email validation"],"operationId":"validateSingleEmail","summary":"Validate one address","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"email is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/email-validation/batch":{"post":{"tags":["Email validation"],"operationId":"validateBatchEmails","summary":"Validate a batch of addresses","description":"Asynchronous — poll `/email-validation/batch/{batchId}` for the result.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["emails"],"properties":{"emails":{"type":"array","items":{"type":"string","format":"email"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"202":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"emails array is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/email-validation/batch/{batchId}":{"get":{"tags":["Email validation"],"operationId":"getValidationBatchStatus","summary":"Get batch validation status","parameters":[{"name":"batchId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Validation batch id."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"}},"/email-validation/history":{"get":{"tags":["Email validation"],"operationId":"getValidationHistory","summary":"Validation history","parameters":[{"name":"status","in":"query","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"}},"/email-validation/stats":{"get":{"tags":["Email validation"],"operationId":"getValidationStats","summary":"Validation stats","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"}},"/sandbox":{"get":{"tags":["Sandbox"],"operationId":"getSandboxStatus","summary":"Is sandbox mode on?","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["sandbox:read"]},{"OAuth2":["emails:read"]}],"x-required-scopes":["sandbox:read","emails:read"],"x-scope-match":"any"},"post":{"tags":["Sandbox"],"operationId":"toggleSandboxMode","summary":"Turn sandbox mode on/off","description":"With sandbox on, sends are simulated and no mail leaves the platform. Useful for connector review.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["enabled"],"properties":{"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"enabled is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["sandbox:write"]}],"x-required-scopes":["sandbox:write"],"x-scope-match":"any"}},"/sandbox/simulate":{"post":{"tags":["Sandbox"],"operationId":"simulateEmailSend","summary":"Simulate a send","description":"The whole body is passed through as the email to simulate — same shape as a transactional send.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionalInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:send"]}],"x-required-scopes":["emails:send"],"x-scope-match":"any"}},"/webhooks":{"get":{"tags":["Webhooks (triggers)"],"operationId":"listWebhooks","summary":"List webhook endpoints","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"x-scope-match":"any"},"post":{"tags":["Webhooks (triggers)"],"operationId":"createWebhook","summary":"Create a webhook endpoint","description":"For iPaaS REST-hook triggers prefer `POST /hooks/subscribe`, which tags the subscription with the platform.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url","events"],"properties":{"url":{"type":"string","format":"uri"},"events":{"type":"array","items":{"type":"string"}},"secret":{"type":"string"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"url and events are required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-scope-match":"any"}},"/webhooks/{id}":{"delete":{"tags":["Webhooks (triggers)"],"operationId":"deleteWebhook","summary":"Delete a webhook endpoint","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-scope-match":"any"}},"/webhooks/trigger":{"post":{"tags":["Webhooks (triggers)"],"operationId":"triggerWebhook","summary":"Fire a test delivery","description":"Sends a synthetic event to your subscribed endpoints — how an iPaaS \"test trigger\" button gets sample data.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["event"],"properties":{"event":{"type":"string"},"payload":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"event is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-scope-match":"any"}},"/webhook-signing/secret":{"get":{"tags":["Webhooks (triggers)"],"operationId":"getSigningSecret","summary":"Get the HMAC signing secret","description":"Deliveries are signed with this secret in the `X-Bluey-Signature` header.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"x-scope-match":"any"}},"/webhook-signing/secret/rotate":{"post":{"tags":["Webhooks (triggers)"],"operationId":"rotateSigningSecret","summary":"Rotate the signing secret","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-scope-match":"any"}},"/webhook-signing/deliveries":{"get":{"tags":["Webhooks (triggers)"],"operationId":"listWebhookDeliveries","summary":"List webhook deliveries","parameters":[{"name":"webhookId","in":"query","schema":{"type":"string","format":"uuid"}},{"name":"eventType","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"x-scope-match":"any"}},"/webhook-signing/deliveries/stats":{"get":{"tags":["Webhooks (triggers)"],"operationId":"getWebhookDeliveryStats","summary":"Webhook delivery stats","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"x-scope-match":"any"}},"/webhook-signing/deliveries/{id}":{"get":{"tags":["Webhooks (triggers)"],"operationId":"getWebhookDeliveryDetail","summary":"Get one delivery attempt","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:read"]}],"x-required-scopes":["webhooks:read"],"x-scope-match":"any"}},"/webhook-signing/deliveries/{id}/retry":{"post":{"tags":["Webhooks (triggers)"],"operationId":"retryWebhookDelivery","summary":"Retry a failed delivery","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:write"]}],"x-required-scopes":["webhooks:write"],"x-scope-match":"any"}},"/inbound/rules":{"get":{"tags":["Inbound"],"operationId":"listInboundRules","summary":"List inbound routing rules","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["inbound:read"]}],"x-required-scopes":["inbound:read"],"x-scope-match":"any"},"post":{"tags":["Inbound"],"operationId":"createInboundRule","summary":"Create an inbound routing rule","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"match_type":{"type":"string"},"conditions":{"type":"object","additionalProperties":true},"actions":{"type":"object","additionalProperties":true},"priority":{"type":"integer"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["inbound:write"]}],"x-required-scopes":["inbound:write"],"x-scope-match":"any"}},"/inbound/rules/{id}":{"patch":{"tags":["Inbound"],"operationId":"updateInboundRule","summary":"Update an inbound routing rule","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"match_type":{"type":"string"},"conditions":{"type":"object","additionalProperties":true},"actions":{"type":"object","additionalProperties":true},"priority":{"type":"integer"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["inbound:write"]}],"x-required-scopes":["inbound:write"],"x-scope-match":"any"},"delete":{"tags":["Inbound"],"operationId":"deleteInboundRule","summary":"Delete an inbound routing rule","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["inbound:write"]}],"x-required-scopes":["inbound:write"],"x-scope-match":"any"}},"/inbound/emails":{"get":{"tags":["Inbound"],"operationId":"listInboundEmails","summary":"List received emails","description":"Requires inbound capture to be enabled and MX pointed at the platform, otherwise this is always empty.","parameters":[{"name":"search","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["inbound:read"]}],"x-required-scopes":["inbound:read"],"x-scope-match":"any"}},"/inbound/emails/{id}":{"get":{"tags":["Inbound"],"operationId":"getInboundEmail","summary":"Get a received email","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["inbound:read"]}],"x-required-scopes":["inbound:read"],"x-scope-match":"any"}},"/smtp":{"get":{"tags":["SMTP relay"],"operationId":"getSmtpRelayConfig","summary":"Get SMTP relay settings","description":"Host/port/TLS details for sending through BlueyEmail as an SMTP relay. Check the `enabled` flag before relying on these: the relay is an opt-in listener and is not running on every deployment.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:read"]}],"x-required-scopes":["emails:read"],"x-scope-match":"any"}},"/smtp/credentials":{"get":{"tags":["SMTP relay"],"operationId":"listSmtpCredentials","summary":"List SMTP relay credentials","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:read"]}],"x-required-scopes":["emails:read"],"x-scope-match":"any"},"post":{"tags":["SMTP relay"],"operationId":"createSmtpCredential","summary":"Enable SMTP access for an API key","description":"Grants an existing API key access to the SMTP relay. No separate password is issued: authenticate with the username \"apikey\" and the API key itself as the password. The key must be active and hold the emails:send scope.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"api_key_id":{"type":"string","format":"uuid"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"API key already linked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:send"]}],"x-required-scopes":["emails:send"],"x-scope-match":"any"}},"/smtp/credentials/{id}":{"delete":{"tags":["SMTP relay"],"operationId":"deleteSmtpCredential","summary":"Delete an SMTP relay credential","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:send"]}],"x-required-scopes":["emails:send"],"x-scope-match":"any"}},"/domains":{"get":{"tags":["Domains"],"operationId":"listDomains","summary":"List sending domains","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:read"]}],"x-required-scopes":["domains:read"],"x-scope-match":"any"},"post":{"tags":["Domains"],"operationId":"addDomain","summary":"Add a sending domain","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:write"]}],"x-required-scopes":["domains:write"],"x-scope-match":"any"}},"/domains/{id}":{"get":{"tags":["Domains"],"operationId":"getDomain","summary":"Get a sending domain with its DNS records","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:read"]}],"x-required-scopes":["domains:read"],"x-scope-match":"any"},"delete":{"tags":["Domains"],"operationId":"deleteDomain","summary":"Delete a sending domain","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:write"]}],"x-required-scopes":["domains:write"],"x-scope-match":"any"}},"/domains/{id}/verify":{"post":{"tags":["Domains"],"operationId":"verifyDomain","summary":"Re-check a domain’s DNS records","description":"A failed DNS lookup is reported as a failure, not as \"record absent\" — retry rather than treating it as unconfigured.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:write"]}],"x-required-scopes":["domains:write"],"x-scope-match":"any"}},"/domains/{domainId}/mail-from":{"get":{"tags":["Domains"],"operationId":"getMailFromConfig","summary":"Get the custom MAIL FROM (return-path) config","parameters":[{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Sending domain id."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:read"]}],"x-required-scopes":["domains:read"],"x-scope-match":"any"},"put":{"tags":["Domains"],"operationId":"updateMailFromConfig","summary":"Set the custom MAIL FROM subdomain","parameters":[{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Sending domain id."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["mail_from_subdomain"],"properties":{"mail_from_subdomain":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:write"]}],"x-required-scopes":["domains:write"],"x-scope-match":"any"}},"/domains/{domainId}/mail-from/verify":{"post":{"tags":["Domains"],"operationId":"verifyMailFrom","summary":"Verify the MAIL FROM DNS records","parameters":[{"name":"domainId","in":"path","required":true,"schema":{"type":"string","format":"uuid"},"description":"Sending domain id."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:write"]}],"x-required-scopes":["domains:write"],"x-scope-match":"any"}},"/analytics/overview":{"get":{"tags":["Analytics"],"operationId":"getAnalyticsOverview","summary":"Account-wide overview","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"}},"/analytics/categories":{"get":{"tags":["Analytics"],"operationId":"getCategoryStats","summary":"Stats grouped by category","parameters":[{"name":"days","in":"query","schema":{"type":"integer","minimum":1},"description":"Look-back window in days."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"}},"/analytics/domains":{"get":{"tags":["Analytics"],"operationId":"getDomainAnalytics","summary":"Stats grouped by recipient domain","parameters":[{"name":"range","in":"query","schema":{"type":"string","default":"30d"},"description":"Reporting window, e.g. 7d / 30d."},{"name":"domain","in":"query","schema":{"type":"string"},"description":"Restrict to one recipient domain."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["domains:read"]}],"x-required-scopes":["domains:read"],"x-scope-match":"any"}},"/analytics/isp":{"get":{"tags":["Analytics"],"operationId":"getIspBreakdown","summary":"Deliverability broken down by ISP","parameters":[{"name":"period","in":"query","schema":{"type":"string"},"description":"Reporting window, e.g. 7d / 30d."},{"name":"email_type","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"}},"/analytics/isp/trends":{"get":{"tags":["Analytics"],"operationId":"getIspTrends","summary":"ISP deliverability over time","parameters":[{"name":"isp","in":"query","schema":{"type":"string"},"description":"ISP key, e.g. gmail / outlook / yahoo."},{"name":"days","in":"query","schema":{"type":"integer","minimum":1}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"}},"/migration/contacts":{"post":{"tags":["Migration"],"operationId":"migrateContacts","summary":"Import contacts from another platform","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["source","csv_data"],"properties":{"source":{"type":"string"},"csv_data":{"type":"string"},"mapping":{"type":"object","additionalProperties":true}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"source and csv_data are required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/migration/suppressions":{"post":{"tags":["Migration"],"operationId":"migrateSuppressions","summary":"Import a suppression list","description":"Import these BEFORE your first send so previously-unsubscribed people are not emailed again.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["source","csv_data"],"properties":{"source":{"type":"string"},"csv_data":{"type":"string"},"group_name":{"type":"string"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"source and csv_data are required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/migration/templates":{"post":{"tags":["Migration"],"operationId":"migrateTemplates","summary":"Import templates from another platform","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["source","templates"],"properties":{"source":{"type":"string"},"templates":{"type":"array","items":{"type":"object","additionalProperties":true}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"source and templates are required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:write"]},{"OAuth2":["emails:send"]}],"x-required-scopes":["templates:write","emails:send"],"x-scope-match":"any"}},"/migration/guide/{source}":{"get":{"tags":["Migration"],"operationId":"getMigrationGuide","summary":"How to export from a given platform","parameters":[{"name":"source","in":"path","required":true,"schema":{"type":"string"},"description":"Source platform key (e.g. mailchimp, sendgrid, klaviyo)."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":[]}],"x-required-scopes":[],"x-scope-match":"any"}},"/me":{"get":{"tags":["Auth"],"operationId":"getMe","summary":"Test connection / whoami","description":"Validates the credential and returns the bound workspace + effective scopes. Use this for iPaaS connection tests.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeResponse"}}}},"401":{"description":"Invalid credential","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":[]}],"x-required-scopes":[],"x-scope-match":"any"}},"/leads":{"get":{"tags":["Contacts"],"operationId":"listLeads","summary":"List contacts","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"status","in":"query","schema":{"type":"string"},"description":"Filters on CONSENT (`optin_status`), not deliverability — the query parameter name is historical. Exact match against one of `pending`, `unverified`, `verified`, `confirmed`, `subscribed`, `unsubscribed`; an unknown value simply matches nothing. There is no filter for the deliverability `status` field."}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadList"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:read"]}],"x-required-scopes":["leads:read"],"x-scope-match":"any"},"post":{"tags":["Contacts"],"operationId":"createLead","summary":"Create a contact","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Contact already exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/leads/{id}/tags":{"post":{"tags":["Contacts"],"operationId":"addTags","summary":"Add tags to a contact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tags"],"properties":{"tags":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:tags"]}],"x-required-scopes":["leads:tags"],"x-scope-match":"any"},"delete":{"tags":["Contacts"],"operationId":"removeTags","summary":"Remove tags from a contact","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["tags"],"properties":{"tags":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:tags"]}],"x-required-scopes":["leads:tags"],"x-scope-match":"any"}},"/contacts/unsubscribe":{"post":{"tags":["Contacts"],"operationId":"unsubscribeContact","summary":"Unsubscribe a contact","description":"Marks a contact as unsubscribed from all marketing email (workspace-scoped, idempotent). This is the callback for senders who run their OWN external unsubscribe page via a custom unsubscribe URL: your page MUST either 302-redirect the visitor to the `redirect` URL we append to your link, OR call this endpoint. If we never hear back we cannot honor the opt-out and sending may be paused.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","description":"Provide `email` OR the `token` we append to your custom unsubscribe link.","properties":{"email":{"type":"string","format":"email","description":"Contact to unsubscribe."},"token":{"type":"string","description":"The `token` query param from the custom unsubscribe link (encodes the contact)."},"reason":{"type":"string","description":"Optional free-text reason."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Neither email nor a valid token supplied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Token belongs to a different workspace","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["leads:write"]}],"x-required-scopes":["leads:write"],"x-scope-match":"any"}},"/campaigns":{"get":{"tags":["Campaigns"],"operationId":"listCampaigns","summary":"List campaigns","parameters":[{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"default":1}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"status","in":"query","schema":{"type":"string","enum":["draft","scheduled","active","paused","completed"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:read"]}],"x-required-scopes":["campaigns:read"],"x-scope-match":"any"},"post":{"tags":["Campaigns"],"operationId":"createCampaign","summary":"Create a campaign","description":"Creates a campaign in `draft`. To be startable it needs an `email_account_id`, at least one sequence step, and at least one enrolled contact — supply them here to make the campaign immediately startable via `POST /campaigns/{id}/start`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Referenced email account or audience not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/campaigns/{id}/start":{"post":{"tags":["Campaigns"],"operationId":"startCampaign","summary":"Start a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Activates the campaign and queues the first email to every enrolled contact; sending begins within a minute. Runs the full pre-flight: readiness, sender authentication (SPF/DKIM/DMARC), content spam scoring, and plan limits. The error body names the specific reason.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Campaign not ready (CAMPAIGN_NOT_READY) — see validation_errors","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Plan limit reached (LIVE_LIMIT_REACHED / EMAIL_SEND_LIMIT_REACHED) or list blocked","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Campaign not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"Sender not authorized (SENDER_NOT_AUTHORIZED) — sending domain lacks SPF/DKIM/DMARC","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Content blocked as spam (CONTENT_SPAM_BLOCKED)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/campaigns/{id}/pause":{"post":{"tags":["Campaigns"],"operationId":"pauseCampaign","summary":"Pause a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Stops further sends. Contacts keep their position in the sequence so resume continues where it left off.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Campaign not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Campaign is not active","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/campaigns/{id}/resume":{"post":{"tags":["Campaigns"],"operationId":"resumeCampaign","summary":"Resume a paused campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Contacts continue from the step they were on — no email is re-sent. Steps that came due while paused are sent right away.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Campaign not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Campaign is not paused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/campaigns/{id}/schedule":{"post":{"tags":["Campaigns"],"operationId":"scheduleCampaign","summary":"Schedule a campaign","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Schedules a draft campaign to auto-start at `scheduled_at`. Runs the sender-authentication and volume pre-flight now, so problems surface immediately rather than at activation.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["scheduled_at"],"properties":{"scheduled_at":{"type":"string","format":"date-time","description":"ISO 8601, must be in the future."}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Invalid date or campaign status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Would exceed the monthly send limit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"412":{"description":"Sender not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["campaigns:write"]}],"x-required-scopes":["campaigns:write"],"x-scope-match":"any"}},"/automations/{id}/start":{"post":{"tags":["Automations"],"operationId":"startAutomation","summary":"Activate an automation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Activates the workflow so its trigger fires and enrolled contacts begin advancing. Contacts enrolled while it was a draft are picked up here.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"400":{"description":"Workflow not ready (WORKFLOW_NOT_READY) — see validation_errors for the per-step problems","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Automation not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["automations:write"]}],"x-required-scopes":["automations:write"],"x-scope-match":"any"}},"/automations/{id}/stop":{"post":{"tags":["Automations"],"operationId":"stopAutomation","summary":"Pause an automation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"description":"Pauses the workflow. Contacts keep their position, so starting it again resumes them where they left off.","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Automation not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["automations:write"]}],"x-required-scopes":["automations:write"],"x-scope-match":"any"}},"/automations/{id}/enroll":{"post":{"tags":["Automations"],"operationId":"enrollInAutomation","summary":"Enroll a contact into an automation","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"lead_id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Automation not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["automations:write"]}],"x-required-scopes":["automations:write"],"x-scope-match":"any"}},"/forms/{id}/submit":{"post":{"tags":["Forms"],"operationId":"submitForm","summary":"Submit a form","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["forms:submit"]}],"x-required-scopes":["forms:submit"],"x-scope-match":"any"}},"/transactional/send":{"post":{"tags":["Email"],"operationId":"sendTransactional","summary":"Send a transactional email","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionalInput"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"403":{"description":"Domain not verified","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["emails:send"]}],"x-required-scopes":["emails:send"],"x-scope-match":"any"}},"/email-templates":{"get":{"tags":["Templates"],"operationId":"listTemplates","summary":"List email templates","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:read"]},{"OAuth2":["emails:read"]}],"x-required-scopes":["templates:read","emails:read"],"x-scope-match":"any"},"post":{"tags":["Templates"],"operationId":"createTemplate","summary":"Create an email template","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"subject":{"type":"string"},"html_content":{"type":"string"},"text_content":{"type":"string"}}}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["templates:write"]},{"OAuth2":["emails:send"]}],"x-required-scopes":["templates:write","emails:send"],"x-scope-match":"any"}},"/hooks/subscribe":{"post":{"tags":["Webhooks (triggers)"],"operationId":"subscribeHook","summary":"Subscribe to an event (REST hook)","description":"Registers a target URL for an event. The response includes a `secret` — verify the `X-Bluey-Signature` HMAC on deliveries with it. See `x-webhook-events` for valid event names.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HookSubscribeInput"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HookSubscription"}}}},"400":{"description":"Unknown event or invalid URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:write"]},{"OAuth2":["webhooks:subscribe"]}],"x-required-scopes":["webhooks:write","webhooks:subscribe"],"x-scope-match":"any"}},"/hooks/subscribe/{id}":{"delete":{"tags":["Webhooks (triggers)"],"operationId":"unsubscribeHook","summary":"Unsubscribe (delete a REST hook)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:write"]},{"OAuth2":["webhooks:subscribe"]}],"x-required-scopes":["webhooks:write","webhooks:subscribe"],"x-scope-match":"any"}},"/hooks/subscriptions":{"get":{"tags":["Webhooks (triggers)"],"operationId":"listHookSubscriptions","summary":"List active REST-hook subscriptions","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Success"}}}}},"security":[{"ApiKeyBearer":[]},{"ApiKeyHeader":[]},{"OAuth2":["webhooks:read"]},{"OAuth2":["webhooks:subscribe"]}],"x-required-scopes":["webhooks:read","webhooks:subscribe"],"x-scope-match":"any"}}},"components":{"securitySchemes":{"ApiKeyBearer":{"type":"http","scheme":"bearer","description":"Send your API key (`bfm_live_…` / `bfm_test_…`) or an OAuth access token (`bft_…`) as a Bearer token."},"ApiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Alternatively send the API key in the `X-API-Key` header."},"OAuth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://api.blueyemail.com/api/oauth/authorize","tokenUrl":"https://api.blueyemail.com/api/oauth/token","refreshUrl":"https://api.blueyemail.com/api/oauth/token","scopes":{"leads:read":"Read leads, list leads, search leads","leads:write":"Create, update, delete leads","leads:tags":"Add and remove tags from leads","forms:read":"List forms, view form details","forms:write":"Create, update, and delete forms","forms:submit":"Submit form data","campaigns:read":"List campaigns, view campaign stats","campaigns:write":"Create/update campaigns, add leads to campaigns","audiences:read":"List audiences, view audience members","audiences:write":"Create/update audiences, manage members","webhooks:read":"List webhooks, view delivery history","webhooks:write":"Create, update, delete webhooks","webhooks:subscribe":"Subscribe/unsubscribe to webhook events (REST hooks)","automations:read":"List automations, view stats","automations:write":"Enroll leads in automations","emails:send":"Send emails via API","emails:read":"View send logs, email status, and delivery history","templates:read":"List email templates, read template content, render a stored template","templates:write":"Create, update, and delete email templates","inbound:read":"List inbound routing rules and read received inbound emails, including message bodies, headers, and attachments","inbound:write":"Create, update, and delete inbound routing rules, including forward/webhook actions that send received mail to a URL you choose","sandbox:read":"View whether workspace sandbox mode is enabled","sandbox:write":"Turn workspace sandbox mode on or off (while on, NO email is delivered for the whole workspace)","email-accounts:read":"List email accounts, view account details and health","email-accounts:write":"Create, update, delete SMTP email accounts, send test emails","domains:read":"List domains, view domain verification status and DNS records","domains:write":"Add, verify, and delete sending domains","waitlists:read":"List waitlists, view entries (Zapier/Pabbly triggers and searches)","waitlists:write":"Manage waitlist entries (Zapier/Pabbly add-to-waitlist action)","crm:read":"Read CRM pipelines, deals, companies, tasks, notes, activities","crm:write":"Create, update, delete CRM pipelines, deals, companies, tasks, notes, activities"}}}}},"schemas":{"Pipeline":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"stages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"color":{"type":"string"},"probability":{"type":"integer"}}}},"is_default":{"type":"boolean"},"rotting_days":{"type":"integer","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"PipelineInput":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"stages":{"type":"array","items":{"type":"object"}},"is_default":{"type":"boolean"},"rotting_days":{"type":"integer"}}},"PipelineList":{"type":"object","properties":{"pipelines":{"type":"array","items":{"$ref":"#/components/schemas/Pipeline"}}}},"Deal":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"pipeline_id":{"type":"string","format":"uuid"},"lead_id":{"type":"string","format":"uuid","nullable":true},"company_id":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string"},"value":{"type":"number"},"currency":{"type":"string"},"stage":{"type":"string"},"position":{"type":"integer"},"probability":{"type":"integer","nullable":true},"expected_close_date":{"type":"string","format":"date","nullable":true},"won_at":{"type":"string","format":"date-time","nullable":true},"lost_at":{"type":"string","format":"date-time","nullable":true},"lost_reason":{"type":"string","nullable":true},"custom_fields":{"type":"object","additionalProperties":true},"assigned_to":{"type":"string","format":"uuid","nullable":true},"stage_entered_at":{"type":"string","format":"date-time"},"last_activity_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"weighted_value":{"type":"number","description":"Derived (value x probability/100); present on list/get/board."},"is_rotting":{"type":"boolean","description":"Derived; present on list/get/board."},"lead_email":{"type":"string","nullable":true},"lead_first_name":{"type":"string","nullable":true},"lead_last_name":{"type":"string","nullable":true}}},"DealInput":{"type":"object","required":["title","pipeline_id"],"properties":{"title":{"type":"string"},"pipeline_id":{"type":"string","format":"uuid"},"lead_id":{"type":"string","format":"uuid"},"company_id":{"type":"string","format":"uuid"},"value":{"type":"number"},"currency":{"type":"string"},"stage":{"type":"string"},"probability":{"type":"integer"},"expected_close_date":{"type":"string","format":"date"},"assigned_to":{"type":"string","format":"uuid"},"lost_reason":{"type":"string"},"custom_fields":{"type":"object","additionalProperties":true}}},"DealList":{"type":"object","properties":{"deals":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"Company":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"domain":{"type":"string","nullable":true},"industry":{"type":"string","nullable":true},"size":{"type":"string","nullable":true},"website":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"address":{"type":"string","nullable":true},"city":{"type":"string","nullable":true},"country":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"assigned_to":{"type":"string","format":"uuid","nullable":true},"custom_fields":{"type":"object","additionalProperties":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"contact_count":{"type":"integer","description":"Rollup; present on list/get."},"deal_count":{"type":"integer","description":"Rollup; present on list/get."},"open_deal_value":{"type":"number","description":"Rollup; present on list/get."},"won_deal_value":{"type":"number","description":"Rollup; present on list/get."},"owner_name":{"type":"string","nullable":true},"owner_email":{"type":"string","nullable":true}}},"CompanyInput":{"type":"object","required":["name"],"additionalProperties":true,"properties":{"name":{"type":"string"},"domain":{"type":"string"},"industry":{"type":"string"},"size":{"type":"string"},"website":{"type":"string"},"phone":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"country":{"type":"string"},"notes":{"type":"string"},"assigned_to":{"type":"string","format":"uuid"},"custom_fields":{"type":"object","additionalProperties":true}}},"CompanyList":{"type":"object","properties":{"companies":{"type":"array","items":{"$ref":"#/components/schemas/Company"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"}}},"Task":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"lead_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"assigned_to":{"type":"string","format":"uuid","nullable":true},"title":{"type":"string"},"description":{"type":"string","nullable":true},"due_date":{"type":"string","format":"date-time","nullable":true},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"completed_at":{"type":"string","format":"date-time","nullable":true},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"assignee_name":{"type":"string","nullable":true},"assignee_email":{"type":"string","nullable":true}}},"TaskInput":{"type":"object","additionalProperties":true,"properties":{"title":{"type":"string"},"description":{"type":"string"},"due_date":{"type":"string","format":"date-time"},"due_in_days":{"type":"integer"},"priority":{"type":"string","enum":["low","medium","high","urgent"]},"deal_id":{"type":"string","format":"uuid"},"lead_id":{"type":"string","format":"uuid"},"assigned_to":{"type":"string","format":"uuid"}}},"TaskList":{"type":"object","properties":{"tasks":{"type":"array","items":{"$ref":"#/components/schemas/Task"}}}},"Note":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"lead_id":{"type":"string","format":"uuid","nullable":true},"deal_id":{"type":"string","format":"uuid","nullable":true},"user_id":{"type":"string","format":"uuid","nullable":true},"content":{"type":"string"},"pinned":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"user_name":{"type":"string","nullable":true},"user_email":{"type":"string","nullable":true}}},"NoteInput":{"type":"object","required":["content"],"properties":{"content":{"type":"string"},"lead_id":{"type":"string","format":"uuid"},"deal_id":{"type":"string","format":"uuid"}}},"NoteUpdateInput":{"type":"object","properties":{"content":{"type":"string"},"pinned":{"type":"boolean"}}},"NoteList":{"type":"object","properties":{"notes":{"type":"array","items":{"$ref":"#/components/schemas/Note"}}}},"Activity":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"deal_id":{"type":"string","format":"uuid","nullable":true},"lead_id":{"type":"string","format":"uuid","nullable":true},"user_id":{"type":"string","format":"uuid","nullable":true},"type":{"type":"string","enum":["call","meeting","email"]},"direction":{"type":"string","nullable":true,"description":"inbound | outbound"},"subject":{"type":"string","nullable":true},"body":{"type":"string","nullable":true},"outcome":{"type":"string","nullable":true},"duration_minutes":{"type":"integer","nullable":true},"occurred_at":{"type":"string","format":"date-time"},"created_at":{"type":"string","format":"date-time"},"user_name":{"type":"string","nullable":true}}},"ActivityInput":{"type":"object","required":["type"],"description":"Requires type and at least one of deal_id or lead_id.","properties":{"type":{"type":"string","enum":["call","meeting","email"]},"deal_id":{"type":"string","format":"uuid"},"lead_id":{"type":"string","format":"uuid"},"direction":{"type":"string"},"subject":{"type":"string"},"body":{"type":"string"},"outcome":{"type":"string"},"duration_minutes":{"type":"integer"},"occurred_at":{"type":"string","format":"date-time"}}},"ActivityList":{"type":"object","properties":{"activities":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}}}},"CustomField":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"workspace_id":{"type":"string","format":"uuid"},"entity":{"type":"string","enum":["deal","company"]},"field_key":{"type":"string"},"label":{"type":"string"},"field_type":{"type":"string","enum":["text","number","date","select","checkbox","url"]},"options":{"type":"array","items":{"type":"string"}},"position":{"type":"integer"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"CustomFieldInput":{"type":"object","required":["label"],"properties":{"label":{"type":"string"},"field_type":{"type":"string","enum":["text","number","date","select","checkbox","url"]},"entity":{"type":"string","enum":["deal","company"]},"options":{"type":"array","items":{"type":"string"}},"position":{"type":"integer"}}},"CustomFieldList":{"type":"object","properties":{"fields":{"type":"array","items":{"$ref":"#/components/schemas/CustomField"}}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"type":{"type":"string","example":"validation_error"},"message":{"type":"string"},"code":{"type":"string","example":"VALIDATION_ERROR"}}}}},"Success":{"type":"object","properties":{"success":{"type":"boolean","example":true},"data":{"type":"object"}}},"Pagination":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"totalPages":{"type":"integer"}}},"MeResponse":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"workspace":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"}}},"auth":{"type":"object","properties":{"method":{"type":"string","enum":["api_key","oauth"]},"mode":{"type":"string","enum":["live","test"]},"sandbox":{"type":"boolean"},"scopes":{"type":"array","items":{"type":"string"}}}}}}}},"Lead":{"type":"object","description":"A contact. Note the two different status fields: `optin_status` is CONSENT (may this person be mailed) and `status` is DELIVERABILITY (can this address be reached). They move independently — a confirmed subscriber whose mailbox starts hard-bouncing keeps `optin_status: confirmed` and gets `status: bounced`.","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"status":{"type":"string","example":"active","description":"Read-only DELIVERABILITY state of the address, set by BlueyEmail — there is no API field for writing it, and only `active` contacts are sent to. Values in use: `active`, `new`, `unsubscribed`, `bounced`, `invalid`, `suppressed`, `complained`, `pending`. `active` is the default and the only sendable one; `bounced` / `complained` / `suppressed` are set by our bounce and complaint handling; `invalid` means we could tell the address was undeliverable on sight; `unsubscribed` mirrors an opt-out. A contact erased under a GDPR request reads `deleted` and has had its personal fields anonymised. Deliberately left without an `enum` so a value we add later cannot fail response validation in your client."},"optin_status":{"type":"string","example":"confirmed","description":"CONSENT state — the field that marketing sending and every consent filter read. One of: `pending`, `unverified`, `verified`, `confirmed`, `subscribed`, `unsubscribed`. See `LeadInput` for what each value means and how to set it."},"tags":{"type":"array","items":{"type":"string"}},"created_at":{"type":"string","format":"date-time"}}},"LeadInput":{"type":"object","required":["email"],"description":"Used by `POST /leads` (create) and `PATCH /leads/{id}` (update). The deliverability `status` column is never caller-writable — see the `status` property below, whose name is historical.","properties":{"email":{"type":"string","format":"email"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"status":{"type":"string","enum":["pending","unverified","verified","confirmed","subscribed","unsubscribed"],"example":"pending","description":"CREATE ONLY, and a historical field name: on `POST /leads` this sets the contact's CONSENT state (the `optin_status` field of the returned contact), not the read-only deliverability `status`. Defaults to `pending` when omitted. Any other value is rejected with 400 VALIDATION_ERROR. `PATCH /leads/{id}` ignores this field — send `optin_status` there instead."},"optin_status":{"type":"string","enum":["pending","unverified","verified","confirmed","subscribed","unsubscribed"],"example":"confirmed","description":"UPDATE ONLY (`PATCH /leads/{id}`; on create use `status` above). The contact's CONSENT state, which is what marketing sending and every consent filter check against. `pending` is the default for a new contact and means consent has not been established; `unverified` is awaiting double opt-in confirmation and `verified` has completed it; `confirmed` is an explicit opt-in (single opt-in form, checkout consent box, confirmation click); `subscribed` is set by our own meeting-booking flow and is accepted here so a contact you READ can be written back unchanged; `unsubscribed` is an opt-out and is honoured everywhere. Omit the field to leave consent untouched — an empty string is rejected rather than stored, because a blank consent state would match no filter in the product. Any value outside the list is rejected with 400 VALIDATION_ERROR."},"tags":{"type":"array","items":{"type":"string"}},"custom_fields":{"type":"object","additionalProperties":true}}},"CampaignInput":{"type":"object","required":["name"],"properties":{"name":{"type":"string","description":"Campaign name."},"description":{"type":"string"},"email_account_id":{"type":"string","format":"uuid","description":"Sending account. Required before the campaign can start."},"timezone":{"type":"string","description":"IANA timezone, e.g. Asia/Kolkata."},"sequences":{"type":"array","description":"Ordered email steps. `sequences[0]` is the FIRST email every contact receives and is sent immediately on start (its `delay_days` is ignored). Each later entry is a follow-up sent `delay_days` after the previous step.","items":{"type":"object","required":["subject"],"properties":{"subject":{"type":"string"},"body":{"type":"string","description":"HTML body."},"text_body":{"type":"string","description":"Optional plain-text alternative (first step only)."},"delay_days":{"type":"integer","minimum":0,"description":"Days after the previous step. Ignored on the first step."}}}},"lead_ids":{"type":"array","items":{"type":"string","format":"uuid"},"description":"Contacts to enroll on creation."},"audience_id":{"type":"string","format":"uuid","description":"Enroll every member of this audience."}}},"LeadList":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}},"meta":{"$ref":"#/components/schemas/Pagination"}}},"AudienceMember":{"type":"object","description":"A contact as seen through an audience membership. Not a full Lead.","properties":{"id":{"type":"string","format":"uuid","description":"Contact id."},"email":{"type":"string","format":"email"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"optin_status":{"type":"string"},"subscribed_at":{"type":"string","format":"date-time","description":"When this contact joined the audience."}}},"AudienceMemberList":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/AudienceMember"}},"meta":{"$ref":"#/components/schemas/Pagination"}}},"CampaignEnrollment":{"type":"object","description":"A contact as seen through a campaign enrollment. Not a full Lead.","properties":{"id":{"type":"string","format":"uuid","description":"Contact id."},"email":{"type":"string","format":"email"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"enrollment_status":{"type":"string","description":"State of THIS contact in THIS campaign (campaign_leads.status) — not the contact's deliverability status."},"enrolled_at":{"type":"string","format":"date-time"}}},"CampaignEnrollmentList":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/CampaignEnrollment"}},"meta":{"$ref":"#/components/schemas/Pagination"}}},"TransactionalInput":{"type":"object","required":["to","subject"],"properties":{"to":{"oneOf":[{"type":"string","format":"email"},{"type":"array","items":{"type":"string","format":"email"}}]},"subject":{"type":"string"},"html":{"type":"string"},"text":{"type":"string"},"template_id":{"type":"string","format":"uuid"},"variables":{"type":"object","additionalProperties":true},"from_email":{"type":"string","format":"email"},"from_name":{"type":"string"},"reply_to":{"type":"string","format":"email"},"track_opens":{"type":"boolean","default":false},"track_clicks":{"type":"boolean","default":false},"idempotency_key":{"type":"string"}}},"HookSubscribeInput":{"type":"object","required":["event","target_url"],"properties":{"event":{"type":"string","description":"One of x-webhook-events","example":"lead.created"},"target_url":{"type":"string","format":"uri"},"platform":{"type":"string","default":"custom"}}},"HookSubscription":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"event_type":{"type":"string"},"target_url":{"type":"string"},"status":{"type":"string"},"secret":{"type":"string","description":"HMAC secret for verifying X-Bluey-Signature. Returned once, at creation."},"created_at":{"type":"string","format":"date-time"}}}}}}}}