Add Contacts to Campaign
Overview
This endpoint enables bulk addition of contacts to a specified campaign. Each contact can include basic information and optional metadata.Endpoint Details
- URL:
/contacts/addToCampaign/{campaign_id}
- Method:
POST
- Authentication: Required (User authentication API KEY)
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
campaign_id | UUID | Yes | The unique identifier of the target campaign |
Request Headers
Header | Value | Description |
---|---|---|
Authorization | Bearer <api_key> | Your API KEY |
Content-Type | application/json | Request body format |
Request Body
An array of contact objects with the following structure:Request Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
firstname | string | Yes | Contact’s first name |
lastname | string | Yes | Contact’s last name |
phone_number | string | Yes | Contact’s phone number |
metadata | object | No | Additional custom data for the contact |
Response
Success Response
- Status Code: 200 OK
Error Response
- Status Code: 200 OK (with error message)
Example Request
Notes
- The endpoint validates the company ID from the user’s authentication api_key
- All contacts in the array must contain the required fields
- The campaign must exist and belong to the authenticated user’s company
- Metadata is optional and can contain any valid JSON object
- The phone number format should be consistent with your system’s requirements
Error Handling
The API will return appropriate error messages for the following scenarios:- Invalid campaign ID
- Unauthorized access
- Invalid contact data format
- Database operation failures