CampaignOS API Documentation
Welcome to the CampaignOS API documentation. This guide covers everything you can do through the API to manage your marketing automation and customer engagement.
What Can You Do?
With the CampaignOS API you can:
- Manage contacts — create, update, import, merge identities, and track consent
- Build segments — define dynamic audiences based on attributes, behavior, and engagement
- Run campaigns — create multi-channel campaigns with A/B testing across email, push, Telegram, and on-site
- Send messages — dispatch messages across all supported channels
- Capture events — ingest custom events from your website, app, or backend
- Manage forms — create embeddable forms for data capture and lead generation
- Handle conversations — manage inbox threads, auto-replies, and assignments
- Track analytics — query campaign performance, funnels, and attribution
- Configure webhooks — receive real-time notifications when things happen in CampaignOS
- Personalize your website — serve modals, banners, and widgets to targeted audiences
Quick Links
| Section | Description |
|---|---|
| Getting Started | Authenticate and make your first API call |
| Authentication | Session and API key authentication |
| Contacts | Manage contacts, import, merge, consent |
| Segments | Build dynamic audience segments |
| Campaigns | Create and run multi-channel campaigns |
| Messages | Send and track messages |
| Events | Ingest and query events |
| Templates | Create reusable message templates |
| Forms | Embeddable forms and submissions |
| Inbox | Conversation management |
| Push Notifications | Web push subscription and delivery |
| Website Script | Embed tracking and personalization |
| Webhooks | Inbound and outbound webhook integrations |
| Analytics | Dashboards, funnels, and attribution |
| Compliance | Unsubscribe, preferences, and data privacy |
Base URL
All API endpoints are relative to your CampaignOS instance:
https://your-campaignos-domain.com/apiAuthentication
Most endpoints require either a session cookie (from signing in) or an API key passed in the Authorization header.
Public endpoints like the tracking script, form submissions, and unsubscribe links do not require authentication.
# API key authentication
curl -H "Authorization: Bearer cos_your_api_key_here" \
https://your-domain.com/api/workspacesSee Authentication and API Keys for details.
Response Format
All API responses return JSON. Paginated endpoints include a pagination object:
{
"data": [...],
"pagination": {
"page": 1,
"limit": 50,
"total": 250,
"totalPages": 5
}
}Error Handling
Errors return an appropriate HTTP status code with a JSON body:
{
"error": "Validation failed",
"details": [
{ "field": "email", "message": "Invalid email address" }
]
}| Status | Meaning |
|---|---|
400 | Bad request / validation error |
401 | Not authenticated |
403 | Insufficient permissions |
404 | Resource not found |
429 | Rate limited |
500 | Internal server error |
Last updated on