Skip to main content
POST
/
campaign
Create campaign
curl --request POST \
  --url https://app.freyavoice.ai/api/v2/campaign \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Q1 Customer Outreach",
  "assistantId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "description": "Follow-up calls for Q1 leads",
  "startDate": "2024-03-15",
  "startTime": "09:00",
  "endTime": "17:00",
  "timezone": "America/New_York",
  "activeDays": [
    0,
    1,
    2,
    3,
    4
  ],
  "daySchedules": {
    "2": {
      "startTime": "10:00",
      "endTime": "18:00"
    },
    "4": {
      "startTime": "09:00",
      "endTime": "15:00"
    }
  },
  "phoneNumber": "+14155551234",
  "callRetries": 3,
  "retryDelaySeconds": 3600,
  "retryDelayMode": "fixed",
  "webhookUrl": "https://api.example.com/webhook/campaign",
  "customers": [
    {
      "phoneNumber": "+14155559001",
      "properties": {
        "name": "John Doe",
        "company": "Acme Inc"
      }
    },
    {
      "phoneNumber": "+14155559002",
      "properties": {
        "name": "Jane Smith",
        "company": "Tech Corp"
      }
    }
  ]
}
'
{
  "success": true,
  "data": {
    "message": "<string>",
    "result": {
      "status": "<string>",
      "isScheduled": true,
      "campaign": {
        "id": "<string>",
        "name": "<string>",
        "workspaceId": "<string>",
        "createdAt": "<string>",
        "updatedAt": "<string>",
        "assistantId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "phoneNumberId": "<string>",
        "description": "<string>",
        "status": "draft",
        "startDate": "2023-12-25",
        "startTime": "<string>",
        "timezone": "UTC",
        "endTime": "<string>",
        "activeDays": [
          0,
          1,
          2,
          3,
          4,
          5,
          6
        ],
        "daySchedules": {},
        "phoneNumber": "<string>",
        "callRetries": 0,
        "retryDelaySeconds": 300,
        "retryDelayMode": "fixed",
        "retryConditions": [
          "No Answer",
          "Busy",
          "Timeout",
          "Unreachable",
          "Network Error",
          "Resource Unavailable",
          "Service Unavailable",
          "voicemail"
        ],
        "endDate": "2023-12-25",
        "schedulingMode": "even",
        "callIntervalSeconds": 30,
        "maxConcurrency": 5,
        "webhookUrl": "<string>",
        "customers": [],
        "callIds": [],
        "roomNames": [],
        "events": [],
        "version": "v1"
      },
      "message": "<string>"
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required
Minimum string length: 1
assistantId
string<uuid>

ID of the AI assistant

assistantName
string

Name of the AI assistant (alternative to assistantId)

description
string
startDate
string<date>

When campaign starts (YYYY-MM-DD). Omit for immediate start.

startTime
string

Default daily window start as wall-clock time in the campaign timezone (HH:MM). Also defines retry window start. Can be overridden per day via daySchedules.

Pattern: ^\d{2}:\d{2}(:\d{2})?$
timezone
string
default:UTC

IANA timezone identifier (e.g., 'Europe/Prague', 'America/New_York'). All time values — startTime, endTime, and daySchedules entries — are interpreted as wall-clock times in this timezone. See https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for valid identifiers.

endTime
string

Default daily window end as wall-clock time in the campaign timezone (HH:MM). Retries only happen between startTime and endTime. Can be overridden per day via daySchedules.

Pattern: ^\d{2}:\d{2}(:\d{2})?$
activeDays
integer[]

Days retries can happen (0=Monday, 6=Sunday)

Required range: 0 <= x <= 6
daySchedules
object

Sparse per-day schedule overrides. Keys are day indices (0=Monday, 6=Sunday), values are {startTime, endTime} as wall-clock times in the campaign timezone. Only include days that differ from the global startTime/endTime. Days not listed here use the global window.

phoneNumber
string

Caller ID phone number

callRetries
integer
default:0

Number of retry attempts (0-10)

Required range: 0 <= x <= 10
retryDelaySeconds
integer
default:300

Delay between retries in seconds (0-86400)

Required range: 0 <= x <= 86400
retryDelayMode
enum<string>
default:fixed
Available options:
fixed,
next_day
retryConditions
enum<string>[]

Array of call outcome values to retry on (SipCodeCategory + special endedReason values)

Available options:
Rejected,
Unreachable,
Busy,
No Answer,
Network Error,
Invalid,
Timeout,
Cancelled,
Resource Unavailable,
Service Unavailable,
Protocol Error,
Unspecified,
voicemail,
exceeded-max-duration
webhookUrl
string
customers
object[]

List of customers to call

phoneList
string[]

Simple list of phone numbers (alternative to customers)

workspaceId
string

Response

Campaign created

success
enum<boolean>
required
Available options:
true
data
object
required