PATCH
/
users
/
{id}
JavaScript
import Surge from '@surgeapi/node';

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

const user = await client.users.update('usr_01j9dwavghe1ttppewekjjkfrx', { first_name: 'Brian' });

console.log(user.id);
{
  "first_name": "Brian",
  "id": "usr_01j9dwavghe1ttppewekjjkfrx",
  "last_name": "O'Conner",
  "metadata": {
    "email": "boconner@toretti.family",
    "user_id": 1234
  },
  "photo_url": "https://toretti.family/people/brian.jpg"
}

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

The ID of the user to update.

Example:

"usr_01j9dwavghe1ttppewekjjkfrx"

Body

application/json

POST body for creating a user

first_name
string
required

The user's first name.

last_name
string

The user's last name.

metadata
object

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

photo_url
string<uri>

URL of a photo to be used as the user's avatar.

Response

Updated user

A user of the app

first_name
string
required

The user's first name.

id
string

Unique identifier for the object.

last_name
string

The user's last name.

metadata
object

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

photo_url
string<uri>

URL of a photo to be used as the user's avatar.