Surge

Update contact

PATCH
/contacts/{id}

Updates the specified contact by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

Authorization

authorization
AuthorizationBearer <token>

In: header

Path Parameters

id*string

The ID of the contact to update.

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.update('ctc_01j9dy8mdzfn3r0e8x1tbdrdrf', {
  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"
  }
}