> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.talkif.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.talkif.ai/_mcp/server.

# Create campaign

POST https://api.talkif.ai/api/v1/campaigns
Content-Type: application/json

Reference: https://docs.talkif.ai/api-reference/campaigns/create-campaign

## Authentication

- `Authorization` header (bearer token, required) — Pass a JWT access token or an API key (prefixed with `tif_live_`) as a Bearer token.

## Request

### Body (application/json)

This endpoint expects a CreateCampaignRequest.

- `flowId` (string, required) — Flow (conversation script) to use for all calls
- `fromPhoneNumber` (string, required) — Caller ID phone number in E.164 format
- `name` (string, required) — Human-readable name for the campaign
- `providerId` (string, required) — VoIP provider to route calls through
- `allowedDays` (list of integer, optional, nullable) — DEPRECATED: Use call_windows instead. Allowed days of week (1=Monday through 7=Sunday)
- `callWindows` (list of CallWindowRequest, optional, nullable) — Call time windows in UTC, if empty or not provided calls are allowed anytime
- `concurrentCalls` (integer, optional) — Maximum number of simultaneous calls (1-50), defaults to 5
- `description` (string, optional, nullable) — Optional description of the campaign purpose
- `earliestCallTime` (string, optional, nullable) — DEPRECATED: Use call_windows instead. Earliest time to call (HH:MM)
- `endAt` (datetime, optional, nullable) — End time after which the campaign auto-pauses, must be after start_at
- `latestCallTime` (string, optional, nullable) — DEPRECATED: Use call_windows instead. Latest time to call (HH:MM)
- `respectContactTimezone` (boolean, optional) — Whether to check each contact's timezone before calling, defaults to true
- `startAt` (datetime, optional, nullable) — Scheduled start time, if null user must manually start the campaign

## Response

### 201

Campaign created

- `allowedDays` (list of integer, required) — DEPRECATED: Use call_windows instead. Allowed days of week
- `callWindows` (list of CallWindowResponse, required) — Call time windows in UTC
- `concurrentCalls` (integer, required) — Maximum number of simultaneous calls
- `createdAt` (datetime, required) — When the campaign was created
- `earliestCallTime` (string, required) — DEPRECATED: Use call_windows instead. Earliest call time in HH:MM
- `flowId` (string, required) — Flow (conversation script) used for all calls
- `fromPhoneNumber` (string, required) — Caller ID phone number in E.164 format
- `id` (string, required) — Unique identifier for the campaign
- `latestCallTime` (string, required) — DEPRECATED: Use call_windows instead. Latest call time in HH:MM
- `name` (string, required) — Human-readable name for the campaign
- `progress` (CampaignProgress, required) — Contact processing progress counters
- `providerId` (string, required) — VoIP provider used for routing
- `respectContactTimezone` (boolean, required) — Whether each contact's timezone is checked before calling
- `source` (string, required) — Driving subsystem: `user` (standard campaign) or `meta_lead` (auto-created envelope grouping Meta Lead Ads calls; fed on lead arrival, not by the scheduler)
- `status` (enum, required) — Current status of the campaign
  - Allowed values: `draft`, `pending`, `running`, `draining`, `paused`, `completed`, `canceled`
- `completedAt` (datetime, optional, nullable) — When the campaign finished processing all contacts
- `description` (string, optional, nullable) — Description of the campaign purpose
- `endAt` (datetime, optional, nullable) — End time after which the campaign auto-pauses
- `flowName` (string, optional, nullable) — Display name of the flow. Null when the flow has since been deleted — the campaign still renders, it just has no name to show.
- `flowVersion` (string, optional, nullable) — Pinned flow version at time of campaign creation
- `metrics` (CampaignMetrics, optional, nullable) — Aggregated call metrics for a campaign
- `pauseReason` (enum, optional, nullable) — Reason why a campaign was paused
  - Allowed values: `manual`, `insufficient_balance`, `system_limit`, `provider_error`, `canceling`
- `pausedAt` (datetime, optional, nullable) — When the campaign was paused
- `startAt` (datetime, optional, nullable) — Scheduled start time in UTC
- `startedAt` (datetime, optional, nullable) — When the campaign was started

## Errors

### 400 Bad Request Error

`validation_failed`

- `code` (enum, required) — Machine-readable error code for programmatic handling
  - Allowed values: `invalid_credentials`, `email_already_exists`, `phone_already_exists`, `contact_phone_already_exists`, `account_suspended`, `account_access_denied`, `token_expired`, `token_invalid`, `token_missing`, `account_header_missing`, `refresh_token_invalid`, `email_already_verified`, `email_verification_code_invalid`, `email_verification_code_expired`, `email_verification_code_used`, `email_service_unavailable`, `phone_already_verified`, `phone_verification_code_invalid`, `phone_verification_code_expired`, `phone_verification_code_used`, `phone_number_missing`, `sms_service_unavailable`, `mfa_already_enabled`, `mfa_not_enabled`, `mfa_not_setup`, `mfa_code_invalid`, `password_reset_token_invalid`, `password_reset_token_expired`, `password_reset_token_used`, `password_current_incorrect`, `password_same_as_current`, `invalid_o_auth_state`, `o_auth_provider_error`, `o_auth_already_linked`, `provider_already_connected`, `o_auth_not_linked`, `cannot_unlink_only_auth`, `validation_failed`, `bad_request`, `invalid_json`, `resource_not_found`, `not_found`, `forbidden`, `insufficient_permissions`, `conflict`, `resource_already_exists`, `insufficient_balance`, `payment_required`, `subscription_required`, `feature_not_available`, `payment_failed`, `business_rule_violation`, `invalid_state_transition`, `unprocessable_entity`, `rate_limit_exceeded`, `queue_full`, `assistant_quota_exceeded`, `user_phone_not_verified`, `account_not_verified`, `payment_method_required`, `trial_already_claimed`, `promotion_not_eligible`, `coupon_not_found`, `coupon_not_redeemable`, `coupon_already_redeemed`, `phone_number_not_active`, `phone_number_not_verified`, `phone_number_cannot_initiate_calls`, `flow_not_published`, `provider_call_rejected`, `concurrent_call_limit_exceeded`, `daily_call_limit_exceeded`, `contact_on_dnc_list`, `outside_callable_hours`, `call_already_completed`, `phone_provider_not_active`, `phone_number_already_connected`, `phone_number_not_connected`, `provider_must_be_sip`, `verification_only_for_sip`, `phone_verification_not_started`, `twilio_credentials_required`, `byoc_only`, `phone_already_registered`, `cannot_delete_system_provider`, `flow_name_already_exists`, `flow_structure_invalid`, `flow_has_connected_phones`, `flow_version_invalid`, `flow_version_conflict`, `flow_function_name_exists`, `flow_function_not_found`, `flow_generation_failed`, `payment_method_card_only`, `template_variable_resolution_failed`, `phone_number_in_use`, `mfa_token_invalid`, `invalid_id_format`, `verification_code_invalid`, `cannot_delete_has_dependencies`, `in_use`, `unsupported_kind`, `offer_taken`, `offer_taken_self`, `offer_expired`, `already_taken`, `takeover_unsupported`, `schedule_not_found`, `schedule_already_paused`, `schedule_not_paused`, `invalid_cron_expression`, `invalid_timezone`, `campaign_not_found`, `campaign_not_draft`, `campaign_no_contacts`, `legal_acceptance_required`, `invitation_not_found`, `invitation_not_pending`, `invitation_expired`, `not_invitation_recipient`, `organization_suspended`, `already_organization_member`, `api_key_invalid`, `api_key_expired`, `api_key_revoked`, `api_key_not_allowed`, `api_key_insufficient_scope`, `api_key_ip_restricted`, `api_key_limit_reached`, `internal_error`, `service_error`, `service_unavailable`, `no_bots_available`, `region_saturated`, `recording_not_available`, `recording_service_not_configured`, `meta_not_configured`, `meta_page_already_connected`, `meta_form_already_mapped`, `meta_api_error`, `meta_lead_unrecoverable`, `unauthorized`
- `detail` (string, required) — Human-readable detail message for this specific error instance
- `status` (integer, required) — HTTP status code (mirrors the response status line)
- `title` (string, required) — Human-readable title for the error category
- `errors` (list of FieldError, optional, nullable) — Field-level validation errors, present when code is `validation_failed`
- `meta` (ErrorResponseMeta, optional, nullable) — Additional context metadata (e.g., retryAfterSecs for rate limits)
- `requestId` (string, optional, nullable) — Unique request identifier for debugging (also in X-Request-Id response header)

### 401 Unauthorized Error

Authentication required — token is missing, expired, or invalid

- `code` (enum, required) — Machine-readable error code for programmatic handling
  - Allowed values: `invalid_credentials`, `email_already_exists`, `phone_already_exists`, `contact_phone_already_exists`, `account_suspended`, `account_access_denied`, `token_expired`, `token_invalid`, `token_missing`, `account_header_missing`, `refresh_token_invalid`, `email_already_verified`, `email_verification_code_invalid`, `email_verification_code_expired`, `email_verification_code_used`, `email_service_unavailable`, `phone_already_verified`, `phone_verification_code_invalid`, `phone_verification_code_expired`, `phone_verification_code_used`, `phone_number_missing`, `sms_service_unavailable`, `mfa_already_enabled`, `mfa_not_enabled`, `mfa_not_setup`, `mfa_code_invalid`, `password_reset_token_invalid`, `password_reset_token_expired`, `password_reset_token_used`, `password_current_incorrect`, `password_same_as_current`, `invalid_o_auth_state`, `o_auth_provider_error`, `o_auth_already_linked`, `provider_already_connected`, `o_auth_not_linked`, `cannot_unlink_only_auth`, `validation_failed`, `bad_request`, `invalid_json`, `resource_not_found`, `not_found`, `forbidden`, `insufficient_permissions`, `conflict`, `resource_already_exists`, `insufficient_balance`, `payment_required`, `subscription_required`, `feature_not_available`, `payment_failed`, `business_rule_violation`, `invalid_state_transition`, `unprocessable_entity`, `rate_limit_exceeded`, `queue_full`, `assistant_quota_exceeded`, `user_phone_not_verified`, `account_not_verified`, `payment_method_required`, `trial_already_claimed`, `promotion_not_eligible`, `coupon_not_found`, `coupon_not_redeemable`, `coupon_already_redeemed`, `phone_number_not_active`, `phone_number_not_verified`, `phone_number_cannot_initiate_calls`, `flow_not_published`, `provider_call_rejected`, `concurrent_call_limit_exceeded`, `daily_call_limit_exceeded`, `contact_on_dnc_list`, `outside_callable_hours`, `call_already_completed`, `phone_provider_not_active`, `phone_number_already_connected`, `phone_number_not_connected`, `provider_must_be_sip`, `verification_only_for_sip`, `phone_verification_not_started`, `twilio_credentials_required`, `byoc_only`, `phone_already_registered`, `cannot_delete_system_provider`, `flow_name_already_exists`, `flow_structure_invalid`, `flow_has_connected_phones`, `flow_version_invalid`, `flow_version_conflict`, `flow_function_name_exists`, `flow_function_not_found`, `flow_generation_failed`, `payment_method_card_only`, `template_variable_resolution_failed`, `phone_number_in_use`, `mfa_token_invalid`, `invalid_id_format`, `verification_code_invalid`, `cannot_delete_has_dependencies`, `in_use`, `unsupported_kind`, `offer_taken`, `offer_taken_self`, `offer_expired`, `already_taken`, `takeover_unsupported`, `schedule_not_found`, `schedule_already_paused`, `schedule_not_paused`, `invalid_cron_expression`, `invalid_timezone`, `campaign_not_found`, `campaign_not_draft`, `campaign_no_contacts`, `legal_acceptance_required`, `invitation_not_found`, `invitation_not_pending`, `invitation_expired`, `not_invitation_recipient`, `organization_suspended`, `already_organization_member`, `api_key_invalid`, `api_key_expired`, `api_key_revoked`, `api_key_not_allowed`, `api_key_insufficient_scope`, `api_key_ip_restricted`, `api_key_limit_reached`, `internal_error`, `service_error`, `service_unavailable`, `no_bots_available`, `region_saturated`, `recording_not_available`, `recording_service_not_configured`, `meta_not_configured`, `meta_page_already_connected`, `meta_form_already_mapped`, `meta_api_error`, `meta_lead_unrecoverable`, `unauthorized`
- `detail` (string, required) — Human-readable detail message for this specific error instance
- `status` (integer, required) — HTTP status code (mirrors the response status line)
- `title` (string, required) — Human-readable title for the error category
- `errors` (list of FieldError, optional, nullable) — Field-level validation errors, present when code is `validation_failed`
- `meta` (ErrorResponseMeta, optional, nullable) — Additional context metadata (e.g., retryAfterSecs for rate limits)
- `requestId` (string, optional, nullable) — Unique request identifier for debugging (also in X-Request-Id response header)

### 403 Forbidden Error

`forbidden`

- `code` (enum, required) — Machine-readable error code for programmatic handling
  - Allowed values: `invalid_credentials`, `email_already_exists`, `phone_already_exists`, `contact_phone_already_exists`, `account_suspended`, `account_access_denied`, `token_expired`, `token_invalid`, `token_missing`, `account_header_missing`, `refresh_token_invalid`, `email_already_verified`, `email_verification_code_invalid`, `email_verification_code_expired`, `email_verification_code_used`, `email_service_unavailable`, `phone_already_verified`, `phone_verification_code_invalid`, `phone_verification_code_expired`, `phone_verification_code_used`, `phone_number_missing`, `sms_service_unavailable`, `mfa_already_enabled`, `mfa_not_enabled`, `mfa_not_setup`, `mfa_code_invalid`, `password_reset_token_invalid`, `password_reset_token_expired`, `password_reset_token_used`, `password_current_incorrect`, `password_same_as_current`, `invalid_o_auth_state`, `o_auth_provider_error`, `o_auth_already_linked`, `provider_already_connected`, `o_auth_not_linked`, `cannot_unlink_only_auth`, `validation_failed`, `bad_request`, `invalid_json`, `resource_not_found`, `not_found`, `forbidden`, `insufficient_permissions`, `conflict`, `resource_already_exists`, `insufficient_balance`, `payment_required`, `subscription_required`, `feature_not_available`, `payment_failed`, `business_rule_violation`, `invalid_state_transition`, `unprocessable_entity`, `rate_limit_exceeded`, `queue_full`, `assistant_quota_exceeded`, `user_phone_not_verified`, `account_not_verified`, `payment_method_required`, `trial_already_claimed`, `promotion_not_eligible`, `coupon_not_found`, `coupon_not_redeemable`, `coupon_already_redeemed`, `phone_number_not_active`, `phone_number_not_verified`, `phone_number_cannot_initiate_calls`, `flow_not_published`, `provider_call_rejected`, `concurrent_call_limit_exceeded`, `daily_call_limit_exceeded`, `contact_on_dnc_list`, `outside_callable_hours`, `call_already_completed`, `phone_provider_not_active`, `phone_number_already_connected`, `phone_number_not_connected`, `provider_must_be_sip`, `verification_only_for_sip`, `phone_verification_not_started`, `twilio_credentials_required`, `byoc_only`, `phone_already_registered`, `cannot_delete_system_provider`, `flow_name_already_exists`, `flow_structure_invalid`, `flow_has_connected_phones`, `flow_version_invalid`, `flow_version_conflict`, `flow_function_name_exists`, `flow_function_not_found`, `flow_generation_failed`, `payment_method_card_only`, `template_variable_resolution_failed`, `phone_number_in_use`, `mfa_token_invalid`, `invalid_id_format`, `verification_code_invalid`, `cannot_delete_has_dependencies`, `in_use`, `unsupported_kind`, `offer_taken`, `offer_taken_self`, `offer_expired`, `already_taken`, `takeover_unsupported`, `schedule_not_found`, `schedule_already_paused`, `schedule_not_paused`, `invalid_cron_expression`, `invalid_timezone`, `campaign_not_found`, `campaign_not_draft`, `campaign_no_contacts`, `legal_acceptance_required`, `invitation_not_found`, `invitation_not_pending`, `invitation_expired`, `not_invitation_recipient`, `organization_suspended`, `already_organization_member`, `api_key_invalid`, `api_key_expired`, `api_key_revoked`, `api_key_not_allowed`, `api_key_insufficient_scope`, `api_key_ip_restricted`, `api_key_limit_reached`, `internal_error`, `service_error`, `service_unavailable`, `no_bots_available`, `region_saturated`, `recording_not_available`, `recording_service_not_configured`, `meta_not_configured`, `meta_page_already_connected`, `meta_form_already_mapped`, `meta_api_error`, `meta_lead_unrecoverable`, `unauthorized`
- `detail` (string, required) — Human-readable detail message for this specific error instance
- `status` (integer, required) — HTTP status code (mirrors the response status line)
- `title` (string, required) — Human-readable title for the error category
- `errors` (list of FieldError, optional, nullable) — Field-level validation errors, present when code is `validation_failed`
- `meta` (ErrorResponseMeta, optional, nullable) — Additional context metadata (e.g., retryAfterSecs for rate limits)
- `requestId` (string, optional, nullable) — Unique request identifier for debugging (also in X-Request-Id response header)

### 429 Too Many Requests Error

Rate limit exceeded — retry after the delay in the response

- `code` (enum, required) — Machine-readable error code for programmatic handling
  - Allowed values: `invalid_credentials`, `email_already_exists`, `phone_already_exists`, `contact_phone_already_exists`, `account_suspended`, `account_access_denied`, `token_expired`, `token_invalid`, `token_missing`, `account_header_missing`, `refresh_token_invalid`, `email_already_verified`, `email_verification_code_invalid`, `email_verification_code_expired`, `email_verification_code_used`, `email_service_unavailable`, `phone_already_verified`, `phone_verification_code_invalid`, `phone_verification_code_expired`, `phone_verification_code_used`, `phone_number_missing`, `sms_service_unavailable`, `mfa_already_enabled`, `mfa_not_enabled`, `mfa_not_setup`, `mfa_code_invalid`, `password_reset_token_invalid`, `password_reset_token_expired`, `password_reset_token_used`, `password_current_incorrect`, `password_same_as_current`, `invalid_o_auth_state`, `o_auth_provider_error`, `o_auth_already_linked`, `provider_already_connected`, `o_auth_not_linked`, `cannot_unlink_only_auth`, `validation_failed`, `bad_request`, `invalid_json`, `resource_not_found`, `not_found`, `forbidden`, `insufficient_permissions`, `conflict`, `resource_already_exists`, `insufficient_balance`, `payment_required`, `subscription_required`, `feature_not_available`, `payment_failed`, `business_rule_violation`, `invalid_state_transition`, `unprocessable_entity`, `rate_limit_exceeded`, `queue_full`, `assistant_quota_exceeded`, `user_phone_not_verified`, `account_not_verified`, `payment_method_required`, `trial_already_claimed`, `promotion_not_eligible`, `coupon_not_found`, `coupon_not_redeemable`, `coupon_already_redeemed`, `phone_number_not_active`, `phone_number_not_verified`, `phone_number_cannot_initiate_calls`, `flow_not_published`, `provider_call_rejected`, `concurrent_call_limit_exceeded`, `daily_call_limit_exceeded`, `contact_on_dnc_list`, `outside_callable_hours`, `call_already_completed`, `phone_provider_not_active`, `phone_number_already_connected`, `phone_number_not_connected`, `provider_must_be_sip`, `verification_only_for_sip`, `phone_verification_not_started`, `twilio_credentials_required`, `byoc_only`, `phone_already_registered`, `cannot_delete_system_provider`, `flow_name_already_exists`, `flow_structure_invalid`, `flow_has_connected_phones`, `flow_version_invalid`, `flow_version_conflict`, `flow_function_name_exists`, `flow_function_not_found`, `flow_generation_failed`, `payment_method_card_only`, `template_variable_resolution_failed`, `phone_number_in_use`, `mfa_token_invalid`, `invalid_id_format`, `verification_code_invalid`, `cannot_delete_has_dependencies`, `in_use`, `unsupported_kind`, `offer_taken`, `offer_taken_self`, `offer_expired`, `already_taken`, `takeover_unsupported`, `schedule_not_found`, `schedule_already_paused`, `schedule_not_paused`, `invalid_cron_expression`, `invalid_timezone`, `campaign_not_found`, `campaign_not_draft`, `campaign_no_contacts`, `legal_acceptance_required`, `invitation_not_found`, `invitation_not_pending`, `invitation_expired`, `not_invitation_recipient`, `organization_suspended`, `already_organization_member`, `api_key_invalid`, `api_key_expired`, `api_key_revoked`, `api_key_not_allowed`, `api_key_insufficient_scope`, `api_key_ip_restricted`, `api_key_limit_reached`, `internal_error`, `service_error`, `service_unavailable`, `no_bots_available`, `region_saturated`, `recording_not_available`, `recording_service_not_configured`, `meta_not_configured`, `meta_page_already_connected`, `meta_form_already_mapped`, `meta_api_error`, `meta_lead_unrecoverable`, `unauthorized`
- `detail` (string, required) — Human-readable detail message for this specific error instance
- `status` (integer, required) — HTTP status code (mirrors the response status line)
- `title` (string, required) — Human-readable title for the error category
- `errors` (list of FieldError, optional, nullable) — Field-level validation errors, present when code is `validation_failed`
- `meta` (ErrorResponseMeta, optional, nullable) — Additional context metadata (e.g., retryAfterSecs for rate limits)
- `requestId` (string, optional, nullable) — Unique request identifier for debugging (also in X-Request-Id response header)

### 500 Internal Server Error

Internal server error — contact support with the requestId

- `code` (enum, required) — Machine-readable error code for programmatic handling
  - Allowed values: `invalid_credentials`, `email_already_exists`, `phone_already_exists`, `contact_phone_already_exists`, `account_suspended`, `account_access_denied`, `token_expired`, `token_invalid`, `token_missing`, `account_header_missing`, `refresh_token_invalid`, `email_already_verified`, `email_verification_code_invalid`, `email_verification_code_expired`, `email_verification_code_used`, `email_service_unavailable`, `phone_already_verified`, `phone_verification_code_invalid`, `phone_verification_code_expired`, `phone_verification_code_used`, `phone_number_missing`, `sms_service_unavailable`, `mfa_already_enabled`, `mfa_not_enabled`, `mfa_not_setup`, `mfa_code_invalid`, `password_reset_token_invalid`, `password_reset_token_expired`, `password_reset_token_used`, `password_current_incorrect`, `password_same_as_current`, `invalid_o_auth_state`, `o_auth_provider_error`, `o_auth_already_linked`, `provider_already_connected`, `o_auth_not_linked`, `cannot_unlink_only_auth`, `validation_failed`, `bad_request`, `invalid_json`, `resource_not_found`, `not_found`, `forbidden`, `insufficient_permissions`, `conflict`, `resource_already_exists`, `insufficient_balance`, `payment_required`, `subscription_required`, `feature_not_available`, `payment_failed`, `business_rule_violation`, `invalid_state_transition`, `unprocessable_entity`, `rate_limit_exceeded`, `queue_full`, `assistant_quota_exceeded`, `user_phone_not_verified`, `account_not_verified`, `payment_method_required`, `trial_already_claimed`, `promotion_not_eligible`, `coupon_not_found`, `coupon_not_redeemable`, `coupon_already_redeemed`, `phone_number_not_active`, `phone_number_not_verified`, `phone_number_cannot_initiate_calls`, `flow_not_published`, `provider_call_rejected`, `concurrent_call_limit_exceeded`, `daily_call_limit_exceeded`, `contact_on_dnc_list`, `outside_callable_hours`, `call_already_completed`, `phone_provider_not_active`, `phone_number_already_connected`, `phone_number_not_connected`, `provider_must_be_sip`, `verification_only_for_sip`, `phone_verification_not_started`, `twilio_credentials_required`, `byoc_only`, `phone_already_registered`, `cannot_delete_system_provider`, `flow_name_already_exists`, `flow_structure_invalid`, `flow_has_connected_phones`, `flow_version_invalid`, `flow_version_conflict`, `flow_function_name_exists`, `flow_function_not_found`, `flow_generation_failed`, `payment_method_card_only`, `template_variable_resolution_failed`, `phone_number_in_use`, `mfa_token_invalid`, `invalid_id_format`, `verification_code_invalid`, `cannot_delete_has_dependencies`, `in_use`, `unsupported_kind`, `offer_taken`, `offer_taken_self`, `offer_expired`, `already_taken`, `takeover_unsupported`, `schedule_not_found`, `schedule_already_paused`, `schedule_not_paused`, `invalid_cron_expression`, `invalid_timezone`, `campaign_not_found`, `campaign_not_draft`, `campaign_no_contacts`, `legal_acceptance_required`, `invitation_not_found`, `invitation_not_pending`, `invitation_expired`, `not_invitation_recipient`, `organization_suspended`, `already_organization_member`, `api_key_invalid`, `api_key_expired`, `api_key_revoked`, `api_key_not_allowed`, `api_key_insufficient_scope`, `api_key_ip_restricted`, `api_key_limit_reached`, `internal_error`, `service_error`, `service_unavailable`, `no_bots_available`, `region_saturated`, `recording_not_available`, `recording_service_not_configured`, `meta_not_configured`, `meta_page_already_connected`, `meta_form_already_mapped`, `meta_api_error`, `meta_lead_unrecoverable`, `unauthorized`
- `detail` (string, required) — Human-readable detail message for this specific error instance
- `status` (integer, required) — HTTP status code (mirrors the response status line)
- `title` (string, required) — Human-readable title for the error category
- `errors` (list of FieldError, optional, nullable) — Field-level validation errors, present when code is `validation_failed`
- `meta` (ErrorResponseMeta, optional, nullable) — Additional context metadata (e.g., retryAfterSecs for rate limits)
- `requestId` (string, optional, nullable) — Unique request identifier for debugging (also in X-Request-Id response header)

## Types

### CallWindowRequest

Request to create/update a call window

- `endTime` (string, required) — End time in HH:MM format (UTC), must be after start_time
- `startTime` (string, required) — Start time in HH:MM format (UTC)
- `dayOfWeek` (integer, optional, nullable) — Day of week constraint, null means all days (1=Monday through 7=Sunday)

### CallWindowResponse

Response for a call window

- `endTime` (string, required) — End time in HH:MM format (UTC)
- `id` (string, required) — Unique identifier for this call window
- `startTime` (string, required) — Start time in HH:MM format (UTC)
- `dayOfWeek` (integer, optional, nullable) — Day of week constraint, null means all days (1=Monday through 7=Sunday)

### CampaignProgress

Campaign progress counters

- `activeCalls` (integer, required) — Number of currently active (in-progress) calls
- `completed` (integer, required) — Contacts whose calls completed successfully
- `failed` (integer, required) — Contacts whose calls failed due to errors
- `noAnswer` (integer, required) — Contacts who did not answer or had busy lines
- `notCalled` (integer, required) — Contacts never called because the campaign ended before reaching them
- `pending` (integer, required) — Contacts waiting to be called
- `percentage` (double, required) — Percentage of contacts processed (0.0-100.0)
- `skipped` (integer, required) — Contacts skipped due to DNC, opt-out, or manual skip
- `total` (integer, required) — Total number of contacts in the campaign

### CampaignMetrics

Aggregated call metrics for a campaign

- `avgCostPerCall` (string, required) — Average cost per call
- `avgDurationSeconds` (long, required) — Average call duration in seconds
- `successRate` (double, required) — Percentage of calls that completed successfully (0-100)
- `totalCost` (string, required) — Total cost of all calls in the campaign
- `totalDurationSeconds` (long, required) — Total duration of all calls in seconds
- `avgFirstSpeechMs` (integer, optional, nullable) — Average first speech latency in milliseconds
- `avgInterruptionRate` (double, optional, nullable) — Average interruption rate (0.0-1.0)
- `avgTurnCount` (double, optional, nullable) — Average conversation turns per call

### FieldError

Individual field error for validation responses Appears in the `errors[]` array when `code` is `validation_failed` # Example ```json { "field": "email", "code": "invalid_format", "message": "Email format is invalid" } ```

- `code` (string, required) — Specific error code for this field
- `field` (string, required) — The field name that failed validation
- `message` (string, required) — Human-readable error message

### ErrorResponseMeta

Additional context metadata (e.g., retryAfterSecs for rate limits)

## Examples

**Request**

```json
{
  "flowId": "550e8400-e29b-41d4-a716-446655440000",
  "fromPhoneNumber": "+15551234567",
  "name": "January Outreach",
  "providerId": "550e8400-e29b-41d4-a716-446655440000"
}
```

**Response**

```json
{
  "allowedDays": [
    1
  ],
  "callWindows": [
    {
      "endTime": "17:00",
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "startTime": "09:00",
      "dayOfWeek": 1
    }
  ],
  "concurrentCalls": 5,
  "createdAt": "2026-01-15T10:30:00Z",
  "earliestCallTime": "09:00",
  "flowId": "550e8400-e29b-41d4-a716-446655440000",
  "fromPhoneNumber": "+15551234567",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "latestCallTime": "17:00",
  "name": "January Outreach",
  "progress": {
    "activeCalls": 3,
    "completed": 250,
    "failed": 10,
    "noAnswer": 30,
    "notCalled": 5,
    "pending": 200,
    "percentage": 60,
    "skipped": 5,
    "total": 500
  },
  "providerId": "550e8400-e29b-41d4-a716-446655440000",
  "respectContactTimezone": true,
  "source": "user",
  "status": "draft",
  "completedAt": "2024-01-15T09:30:00Z",
  "description": "string",
  "endAt": "2024-01-15T09:30:00Z",
  "flowName": "Q1 Outreach Script",
  "flowVersion": "string",
  "metrics": null,
  "pauseReason": null,
  "pausedAt": "2024-01-15T09:30:00Z",
  "startAt": "2024-01-15T09:30:00Z",
  "startedAt": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.talkif.ai/api/v1/campaigns"

payload = {
    "flowId": "550e8400-e29b-41d4-a716-446655440000",
    "fromPhoneNumber": "+15551234567",
    "name": "January Outreach",
    "providerId": "550e8400-e29b-41d4-a716-446655440000"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.talkif.ai/api/v1/campaigns';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"flowId":"550e8400-e29b-41d4-a716-446655440000","fromPhoneNumber":"+15551234567","name":"January Outreach","providerId":"550e8400-e29b-41d4-a716-446655440000"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.talkif.ai/api/v1/campaigns"

	payload := strings.NewReader("{\n  \"flowId\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"fromPhoneNumber\": \"+15551234567\",\n  \"name\": \"January Outreach\",\n  \"providerId\": \"550e8400-e29b-41d4-a716-446655440000\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.talkif.ai/api/v1/campaigns")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"flowId\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"fromPhoneNumber\": \"+15551234567\",\n  \"name\": \"January Outreach\",\n  \"providerId\": \"550e8400-e29b-41d4-a716-446655440000\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.talkif.ai/api/v1/campaigns")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"flowId\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"fromPhoneNumber\": \"+15551234567\",\n  \"name\": \"January Outreach\",\n  \"providerId\": \"550e8400-e29b-41d4-a716-446655440000\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.talkif.ai/api/v1/campaigns', [
  'body' => '{
  "flowId": "550e8400-e29b-41d4-a716-446655440000",
  "fromPhoneNumber": "+15551234567",
  "name": "January Outreach",
  "providerId": "550e8400-e29b-41d4-a716-446655440000"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.talkif.ai/api/v1/campaigns");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"flowId\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"fromPhoneNumber\": \"+15551234567\",\n  \"name\": \"January Outreach\",\n  \"providerId\": \"550e8400-e29b-41d4-a716-446655440000\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "flowId": "550e8400-e29b-41d4-a716-446655440000",
  "fromPhoneNumber": "+15551234567",
  "name": "January Outreach",
  "providerId": "550e8400-e29b-41d4-a716-446655440000"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.talkif.ai/api/v1/campaigns")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```