perform.chat
Customer Users

List Users

Search and retrieve customer users

Endpoint

GET https://api.perform.chat/rest/v1/customer-users

Request Body

{
  "keyId": "your-key-id",
  "keySecret": "your-key-secret",
  "name": "John",                  // Optional: filter by name
  "email": "john@example.com",      // Optional: filter by email
  "external_id": "user_123"         // Optional: filter by your user ID
}

Query Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
limitnumber20Items per page (max 100)

Response

{
  "data": [
    {
      "id": "cu_123",
      "external_id": "user_123",
      "name": "John Doe",
      "email": "john@example.com",
      "metadata": {
        "plan": "premium",
        "country": "US"
      },
      "active": true,
      "created_at": "2025-01-10T08:20:00Z",
      "last_seen_at": "2025-01-15T14:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "total_pages": 8
  }
}

Response Fields

Customer User Object

FieldTypeDescription
idstringInternal customer user ID
external_idstringYour system's user ID
namestringUser's display name
emailstringUser's email address
metadataobjectCustom JSON data
activebooleanWhether user is active
created_atstringISO 8601 timestamp of creation
last_seen_atstringISO 8601 timestamp of last activity

Example Requests

List all users

async function listCustomerUsers(page = 1, limit = 20) {
  const response = await axios.get(
    'https://api.performchat.com/rest/v1/v1/customer-users',
    {
      params: { page, limit },
      data: {
        keyId: process.env.API_KEY_ID,
        keySecret: process.env.API_KEY_SECRET
      }
    }
  )
  return response.data
}

Search by email

async function findUserByEmail(email) {
  const response = await axios.get(
    'https://api.performchat.com/rest/v1/v1/customer-users',
    {
      params: { page: 1, limit: 1 },
      data: {
        keyId: process.env.API_KEY_ID,
        keySecret: process.env.API_KEY_SECRET,
        email: email
      }
    }
  )
  return response.data.data[0] || null
}

Search by external ID

async function findUserByExternalId(externalId) {
  const response = await axios.get(
    'https://api.performchat.com/rest/v1/v1/customer-users',
    {
      params: { page: 1, limit: 1 },
      data: {
        keyId: process.env.API_KEY_ID,
        keySecret: process.env.API_KEY_SECRET,
        external_id: externalId
      }
    }
  )
  return response.data.data[0] || null
}

Error Responses

StatusDescription
401Invalid API credentials
400Invalid query parameters
500Internal server error

Best Practices

  1. Use external_id for lookups - Fastest way to find specific users
  2. Cache user data - Reduce API calls by caching user information
  3. Limit search scope - Use specific filters to reduce result size
  4. Handle pagination - Use appropriate page sizes for your use case