Create bulk contacts

POST /v1/Contacts/Bulk
application/x-www-form-urlencoded

Body

  • Items array Required

    A list of objects where each object represents a contact's details. Each object includes the following fields: contact_id, which must be a string representing phone number in E.164 format; correlation_id, a unique 32-character UUID that maps the response to the original request; country_iso_code, a string representing the country using the ISO format (e.g., US for the United States); and zip_code, a string representing the postal code.

Responses

  • 201 application/json

    Created

    Hide headers attributes Show headers attributes
    • Access-Control-Allow-Origin string

      Specify the origin(s) allowed to access the resource

    • Access-Control-Allow-Methods string

      Specify the HTTP methods allowed when accessing the resource

    • Access-Control-Allow-Headers string

      Specify the headers allowed when accessing the resource

    • Access-Control-Allow-Credentials boolean

      Indicates whether the browser should include credentials

    • Access-Control-Expose-Headers string

      Headers exposed to the client

    Hide response attribute Show response attribute object
    • items

      A list of objects where each object represents the result of processing a correlation_id. Each object contains the following fields: correlation_id, a unique 32-character UUID that maps the response to the original request; error_code, an integer where 0 indicates success and any non-zero value represents an error; and error_messages, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.

POST /v1/Contacts/Bulk
curl \
 --request POST 'https://accounts.twilio.com/v1/Contacts/Bulk' \
 --user "username:password" \
 --header "Content-Type: application/x-www-form-urlencoded" \
 --data 'Items=%7B%22contact_id%22%3A%22%2B19999999999%22%2C%22correlation_id%22%3A%22ad388b5a46b33b874b0d41f7226db2eh%22%2C%22country_iso_code%22%3A%22US%22%2C%22zip_code%22%3A%2212345%22%7D&Items=%7B%22contact_id%22%3A%22%2B19%22%2C%22correlation_id%22%3A%2202520cfa6c432f0e3ec3a38c122d428a%22%2C%22country_iso_code%22%3A%22US%22%2C%22zip_code%22%3A%2212345%22%7D'
Request example
{"Items"=>["{\"contact_id\":\"+19999999999\",\"correlation_id\":\"ad388b5a46b33b874b0d41f7226db2eh\",\"country_iso_code\":\"US\",\"zip_code\":\"12345\"}", "{\"contact_id\":\"+19\",\"correlation_id\":\"02520cfa6c432f0e3ec3a38c122d428a\",\"country_iso_code\":\"US\",\"zip_code\":\"12345\"}"]}
Response examples (201)
{
  "items": [
    {
      "error_code": 0,
      "correlation_id": "ad388b5a46b33b874b0d41f7226db2eh",
      "error_messages": []
    },
    {
      "error_code": 30647,
      "correlation_id": "02520cfa6c432f0e3ec3a38c122d428a",
      "error_messages": [
        "INVALID_CONTACT_ID"
      ]
    }
  ]
}