Surge

List users

GET
/accounts/{account_id}/users

List all users for an account with cursor-based pagination.

Authorization

authorization
AuthorizationBearer <token>

In: header

Path Parameters

account_id*string

The account ID to list users for.

Query Parameters

after?string

Cursor for forward pagination. Use the next_cursor from a previous response.

before?string

Cursor for backward pagination. Use the previous_cursor from a previous response.

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
});

// Automatically fetches more pages as needed.
for await (const user of client.users.list('acct_01j9a43avnfqzbjfch6pygv1td')) {
  console.log(user.id);
}
{
  "data": [
    {
      "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"
    }
  ],
  "pagination": {
    "next_cursor": "g3QAAAABZAACaWRtAAAAGnBuXzAxamtzY2s5eDdkeW0wZnBxZjdjYmRyeQ==",
    "previous_cursor": null
  }
}
{
  "error": {
    "message": "The requested resource could not be found.",
    "type": "not_found"
  }
}