Surge

Update user

PATCH
/users/{id}

Updates an existing User object.

Authorization

authorization
AuthorizationBearer <token>

In: header

Path Parameters

id*string

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