Skip to main content
POST
/
accounts
/
{account_id}
/
contacts
JavaScript
import Surge from '@surgeapi/node';

const client = new Surge({
  apiKey: 'My API Key',
});

const contact = await client.contacts.create('acct_01j9a43avnfqzbjfch6pygv1td', {
  phone_number: '+18015551234',
});

console.log(contact.id);
{
  "email": "dom@toretto.family",
  "first_name": "Dominic",
  "id": "ctc_01j9dy8mdzfn3r0e8x1tbdrdrf",
  "last_name": "Toretto",
  "metadata": {
    "car": "1970 Dodge Charger R/T"
  },
  "phone_number": "+18015551234"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

account_id
string
required

The account for which the contact should be created.

Example:

"acct_01j9a43avnfqzbjfch6pygv1td"

Body

application/json

Parameters for creating a contact

phone_number
string<phone-number>
required

The contact's phone number in E.164 format.

Example:

"+18015551234"

email
string<email>

The contact's email address.

first_name
string

The contact's first name.

last_name
string

The contact's last name.

metadata
object

Set of key-value pairs that will be stored with the object.

Response

Created contact

A contact who has consented to receive messages

id
string
required

Unique identifier for the object.

phone_number
string<phone-number>
required

The contact's phone number in E.164 format.

Example:

"+18015551234"

email
string<email>

The contact's email address.

first_name
string

The contact's first name.

last_name
string

The contact's last name.

metadata
object

Set of key-value pairs that will be stored with the object.