Skip to main content
POST
/
campaign
Create campaign
curl --request POST \
  --url https://app2.freyavoice.ai/api/v2/campaign \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "Q1 Customer Outreach",
  "assistantId": "agent_abc123",
  "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
  ],
  "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": "<string>",
        "phoneNumberId": "<string>",
        "description": "<string>",
        "status": "draft",
        "startDate": "2023-12-25",
        "startTime": "<string>",
        "timezone": "UTC",
        "endTime": "<string>",
        "activeDays": [
          0,
          1,
          2,
          3,
          4,
          5,
          6
        ],
        "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

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

Time on start date (HH:MM). Also defines retry window start.

timezone
string
default:UTC

IANA timezone for all times (e.g., Europe/Prague)

endTime
string

Daily retry window end (HH:MM). Retries only happen between startTime-endTime.

activeDays
integer[]

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

Required range: 0 <= x <= 6
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,
false
data
object
required