Skip to main content

Overview

A Campaign is the top-level container that defines how calls are made: which agent speaks, which phone numbers are used, when calls are allowed, and what retry logic to apply. Every Batch belongs to exactly one campaign and inherits its settings. Base URL: https://api.graine.ai/api/v1 Authentication: All campaign endpoints require Authorization: Bearer gat_<token>.

Campaign Object

{
  "campaign_id": "cmp_abc123",
  "name": "Q2 Insurance Renewals",
  "organization_id": "org_xyz",
  "agent_id": "agent_abc123",
  "status": "active",
  "phone_numbers": ["+919876543210", "+919876543211"],
  "phone_number_strategy": "round_robin",
  "working_hours_enforced": true,
  "timezone": "Asia/Kolkata",
  "working_hours": {
    "monday":    { "start": "09:00", "end": "18:00", "enabled": true },
    "tuesday":   { "start": "09:00", "end": "18:00", "enabled": true },
    "wednesday": { "start": "09:00", "end": "18:00", "enabled": true },
    "thursday":  { "start": "09:00", "end": "18:00", "enabled": true },
    "friday":    { "start": "09:00", "end": "18:00", "enabled": true },
    "saturday":  { "start": "10:00", "end": "14:00", "enabled": false },
    "sunday":    { "start": "10:00", "end": "14:00", "enabled": false }
  },
  "retry_policy": {
    "max_retries": 3,
    "strategy": "fixed",
    "cooldown_minutes": 30
  },
  "default_call_variables": {
    "language": "en",
    "product": "Health Insurance"
  },
  "metadata": {
    "concurrency_limit": 20
  }
}

Campaign Fields

FieldTypeDescription
campaign_idstringUnique identifier for the campaign
namestringHuman-readable campaign name
organization_idstringOwning organization. Defaults to token’s org if omitted
agent_idstringThe AI agent that makes the calls
statusstringCurrent state: draft · active · paused · cancelled · completed
phone_numbersstring[]Outbound caller IDs to use
phone_number_strategystringHow to pick numbers: round_robin · random · least_loaded
working_hours_enforcedbooleanIf true, calls only go out within per-day windows
timezonestringIANA timezone for working hours (e.g. Asia/Kolkata)
working_hoursobjectPer-day { start, end, enabled } schedule
retry_policyobjectmax_retries, strategy (fixed/exponential), cooldown_minutes
default_call_variablesobjectVariables merged into every contact’s call (contact-level values win)
metadata.concurrency_limitintegerMax concurrent outbound calls across all batches

Campaign Status Lifecycle

StatusDescription
draftCreated but no batches yet
activeDispatching calls
pausedTemporarily stopped — resumes with /resume
cancelledHard-stopped. Terminal — cannot resume
completedAll batches finished naturally

Endpoints

Create Campaign

POST /campaigns/

List Campaigns

GET /campaigns/

Get Campaign

GET /campaigns/:id

Update Campaign

PATCH /campaigns/:id

Delete Campaign

DELETE /campaigns/:id

Pause / Resume / Cancel

Control campaign execution

Campaign Stats

GET /campaigns/:id/stats