Skip to content

Bulk Add Contacts

This API allows you to add multiple contacts in bulk to your Cellcast account.

Parameters for Bulk Add Contacts API

Headers Parameters

ParametersDescription
AuthorizationPlease add provided Bearer token - linked to your Cellcast account. Check here

Request Body Parameters

NameExampleDescription
contacts[{"first_name": "John","last_name": "Doe","phone_number": "+61400000000","birthday": "1990-05-14","address": "123 Main St, Sydney, NSW","email": "[email protected]","postal_code": "2000","gender": "male","purchase": "paypal"}]The body of the request should contain an array of contact objects. Each contact object can include the following properties:

- first_name: The first name of the contact.
- last_name: The last name of the contact.
- phone_number: The phone number of the contact.
- birthday: The birth date of the contact.
- address: The address of the contact.
- email: The email of the contact.
- postal_code: The postal code of the contact.
- gender: The gender of the contact.
- purchase: The purchase information of the contact.
tags[ "Example Tag", "New User Tag" ]Include this in your request to add Tags to the uploaded contacts. You can add multiple tags to the contacts.
list[ "Example List", "New User List" ]Include this in your request to add the uploaded contacts into Lists. You can add the contacts to multiple Lists.

Code Samples

Post https://api.cellcast.com/api/v1/contact/bulk

bash
curl --location 'https://api.cellcast.com/api/v1/contact/bulk' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: {{API_KEY}}' \
--data '{
    "contacts": [
        {
            "first_name": "John",
            "last_name": "Doe",
            "phone_number": "+61400000000",
            "birthday": "1990-05-14",
            "address": "123 Main St, Sydney, NSW",
            "email": "[email protected]",
            "postal_code": "2000",
            "gender": "male",
            "purchase": "paypal"
        },
        {
            "first_name": "Jonh",
            "last_name": "Pilate",
            "phone_number": "+61400000001",
            "birthday": "1988-11-23",
            "address": "456 High St, Melbourne, VIC",
            "email": "[email protected]",
            "postal_code": "3000",
            "gender": "female",
            "purchase": "mastercard"
        }
    ],
    "tags": [
        "Example Tag", 
        "New User Tag"
    ],
    "list": [
        "Example List", 
        "New User List"
    ]
}'
js
const axios = require("axios");

const addBulkContacts = async () => {
  try {
    const response = await axios.post(
      "https://api.cellcast.com/api/v1/contact/bulk",
      {
        contacts: [
          {
            first_name: "John",
            last_name: "Doe",
            phone_number: "+61400000000",
            birthday: "1990-05-14",
            address: "123 Main St, Sydney, NSW",
            email: "[email protected]",
            postal_code: "2000",
            gender: "male",
            purchase: "paypal"
          },
          {
            first_name: "Jonh",
            last_name: "Pilate",
            phone_number: "+61400000001",
            birthday: "1988-11-23",
            address: "456 High St, Melbourne, VIC",
            email: "[email protected]",
            postal_code: "3000",
            gender: "female",
            purchase: "mastercard"
          }
        ],
        tags: [
            "Example Tag", 
            "New User Tag"
        ],
        list: [
            "Example List", 
            "New User List"
        ]
      },
      {
        headers: {
          "Content-Type": "application/json",
          Accept: "application/json",
          Authorization: "Bearer {{API_KEY}}",
        },
      }
    );
    console.log(JSON.stringify(response.data));
  } catch (error) {
    console.log(error);
  }
};

Replace with the actual API key that you own.

Response

200 Success

json
}
    "message": "success",
    "data": {
        "message": "all data success to process",
        "success_data": 2,
        "failed_data": 0,
        "errors": []
    }
}

200 Partial Success

json
}
    "message": "partial_success",
    "data": {
        "message": "The data was successfully processed, but there was some data that was not processed because it was invalid",
        "success_data": 2,
        "failed_data": 2,
        "errors": [
            "contact[1] error : phone_number empty",
            "contact[3] error : phone_number is not valid"
        ]
    }
}

400 Bad Request

json
{
    "message": "fail",
    "data": {
        "message": "fail process data",
        "errors": [
            "contact[0] error : phone_number empty",
            "contact[1] error : phone_number is not valid"
        ]
    }
}