Surge

Create contact

POST
/accounts/{account_id}/contacts

Creates a new Contact object.

Authorization

authorization
AuthorizationBearer <token>

In: header

Path Parameters

account_id*string

The account for which the contact should be created.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

import Surge from '@surgeapi/node';

const client = new Surge({
  apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
});

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"
}
{
  "error": {
    "message": "The requested resource could not be found.",
    "type": "not_found"
  }
}