> ## Documentation Index
> Fetch the complete documentation index at: https://developers.sendazi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Voice Campaign

> Create a new voice campaign to broadcast messages to your contacts

<Note>
  This endpoint accepts `multipart/form-data` when uploading an audio file, or `application/json` when using text-to-speech.
</Note>

<ParamField body="name" type="string" required>
  Name of the campaign for identification
</ParamField>

<ParamField body="recipients" type="array">
  Array of phone numbers (international, local, or with + prefix). Either `recipients` or `group_ids` must be provided.
</ParamField>

<ParamField body="group_ids" type="array">
  Array of group UUIDs to target. Either `recipients` or `group_ids` must be provided.
</ParamField>

<ParamField body="sender_id" type="string" required>
  Your approved sender ID
</ParamField>

<ParamField body="audio" type="file">
  Audio file to broadcast (MP3, WAV, OGG). Either `audio` or `message` must be provided.
</ParamField>

<ParamField body="message" type="string">
  Text message to be converted to speech (text-to-speech). Either `audio` or `message` must be provided.
</ParamField>

<ParamField body="scheduled_at" type="string">
  Schedule the campaign for a future time. Format: `YYYY-MM-DD HH:MM:SS`
</ParamField>

<ParamField body="is_recurring" type="boolean" default="false">
  Enable recurring campaign
</ParamField>

<ParamField body="recurrence_frequency" type="string">
  Frequency of recurrence: `daily`, `weekly`, or `monthly`
</ParamField>

<ParamField body="recurrence_interval" type="integer" default="1">
  Interval between recurrences
</ParamField>

<ParamField body="recurrence_ends_at" type="string">
  End date for recurring campaign
</ParamField>

## Audio File Requirements

| Format | Max Size | Max Duration |
| ------ | -------- | ------------ |
| MP3    | 10 MB    | 5 minutes    |
| WAV    | 10 MB    | 5 minutes    |
| OGG    | 10 MB    | 5 minutes    |

<RequestExample>
  ```bash cURL (with audio file) theme={null}
  curl -X POST "https://sendazi.com/api/v1/voice-campaigns" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "name=Audio Announcement" \
    -F "group_ids[]=ee9fb0b4-83f0-4be5-a0be-1063e05ff0b8" \
    -F "sender_id=MYCOMPANY" \
    -F "audio=@/path/to/audio.mp3"
  ```

  ```bash cURL (with text-to-speech) theme={null}
  curl -X POST "https://sendazi.com/api/v1/voice-campaigns" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "Important Announcement",
      "group_ids": ["ee9fb0b4-83f0-4be5-a0be-1063e05ff0b8"],
      "sender_id": "MYCOMPANY",
      "message": "Hello, this is an important announcement from our company."
    }'
  ```

  ```javascript Node.js (with audio file) theme={null}
  const formData = new FormData();
  formData.append('name', 'Audio Announcement');
  formData.append('group_ids[]', 'ee9fb0b4-83f0-4be5-a0be-1063e05ff0b8');
  formData.append('sender_id', 'MYCOMPANY');
  formData.append('audio', audioFile); // File object

  const response = await fetch('https://sendazi.com/api/v1/voice-campaigns', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: formData
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python (with audio file) theme={null}
  import requests

  with open('/path/to/audio.mp3', 'rb') as audio_file:
      response = requests.post(
          'https://sendazi.com/api/v1/voice-campaigns',
          headers={
              'Authorization': 'Bearer YOUR_API_KEY'
          },
          data={
              'name': 'Audio Announcement',
              'group_ids[]': 'ee9fb0b4-83f0-4be5-a0be-1063e05ff0b8',
              'sender_id': 'MYCOMPANY'
          },
          files={
              'audio': audio_file
          }
      )

  print(response.json())
  ```

  ```php PHP (with audio file) theme={null}
  $curl = curl_init();

  $postFields = [
      'name' => 'Audio Announcement',
      'group_ids[]' => 'ee9fb0b4-83f0-4be5-a0be-1063e05ff0b8',
      'sender_id' => 'MYCOMPANY',
      'audio' => new CURLFile('/path/to/audio.mp3', 'audio/mpeg', 'audio.mp3')
  ];

  curl_setopt_array($curl, [
      CURLOPT_URL => 'https://sendazi.com/api/v1/voice-campaigns',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_POST => true,
      CURLOPT_HTTPHEADER => [
          'Authorization: Bearer YOUR_API_KEY'
      ],
      CURLOPT_POSTFIELDS => $postFields
  ]);

  $response = curl_exec($curl);
  curl_close($curl);

  echo $response;
  ```
</RequestExample>

<ResponseExample>
  ```json 201 - Created theme={null}
  {
    "success": true,
    "data": {
      "id": 2,
      "uuid": "9c026029-25e7-5d3b-b3dg-g7d4e9ecd956",
      "name": "Audio Announcement",
      "total_recipients": 25,
      "messages_sent": 0,
      "credits_used": "0.00",
      "status": "pending",
      "audio_url": "https://sendazi.com/storage/audio/9c026029.mp3",
      "created_at": "2026-01-15T11:00:00.000000Z",
      "updated_at": "2026-01-15T11:00:00.000000Z"
    }
  }
  ```

  ```json 422 - Validation Error theme={null}
  {
    "success": false,
    "message": "The given data was invalid.",
    "errors": {
      "audio": ["The audio must be a file of type: mp3, wav, ogg."],
      "message": ["The message field is required when audio is not present."]
    }
  }
  ```
</ResponseExample>
