Skip to content
Get started

Get a customer by ID

client.customers.retrieve(stringid, CustomerRetrieveParams { rotorAPIVersion } params, RequestOptionsoptions?): CustomerRetrieveResponse { data, status }
GET/customers/{id}

Get a customer by ID

ParametersExpand Collapse
id: string
params: CustomerRetrieveParams { rotorAPIVersion }
rotorAPIVersion: "1.1.0"

Required OpenAPI version header.

ReturnsExpand Collapse
CustomerRetrieveResponse { data, status }
data?: Data { id, address, company_name, 11 more }
id?: string
address?: Address { city, country, state, 3 more }
city: string
country: string
state: string
street1: string
zip: string
street2?: string | null
company_name?: string
created_at?: string
email?: string
first_name?: string
has_payment_method?: boolean

Whether the customer has at least one saved payment method on file

last_name?: string
location?: Array<number> | null
notes?: string | null
phone?: string
source?: string
status?: "active" | "inactive"
One of the following:
"active"
"inactive"
tags?: Array<string> | null
status?: string

Get a customer by ID

import Rotor from 'getrotor';

const client = new Rotor({
  rotorAPIVersion: '1.1.0',
  apiKey: process.env['ROTOR_API_KEY'], // This is the default and can be omitted
});

const customer = await client.customers.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
  'rotor-api-version': '1.1.0',
});

console.log(customer.data);
{
  "data": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "address": {
      "city": "city",
      "country": "country",
      "state": "state",
      "street1": "street1",
      "zip": "zip",
      "street2": "street2"
    },
    "company_name": "company_name",
    "created_at": "2019-12-27T18:11:19.117Z",
    "email": "dev@stainless.com",
    "first_name": "first_name",
    "has_payment_method": true,
    "last_name": "last_name",
    "location": [
      0
    ],
    "notes": "notes",
    "phone": "phone",
    "source": "source",
    "status": "active",
    "tags": [
      "string"
    ]
  },
  "status": "success"
}
{
  "status": "error",
  "message": "Authentication required. Provide x-api-key header.",
  "error_code": "AUTHENTICATION_REQUIRED"
}
{
  "status": "error",
  "message": "Forbidden: required scope 'leads:read' not granted for this API key",
  "error_code": "INSUFFICIENT_SCOPE"
}
{
  "status": "error",
  "message": "Not found"
}
{
  "status": "error",
  "message": "Daily API key request limit of 1000 exceeded",
  "error_code": "RATE_LIMIT_EXCEEDED"
}
{
  "status": "error",
  "message": "Internal server error"
}
Returns Examples
{
  "data": {
    "id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "address": {
      "city": "city",
      "country": "country",
      "state": "state",
      "street1": "street1",
      "zip": "zip",
      "street2": "street2"
    },
    "company_name": "company_name",
    "created_at": "2019-12-27T18:11:19.117Z",
    "email": "dev@stainless.com",
    "first_name": "first_name",
    "has_payment_method": true,
    "last_name": "last_name",
    "location": [
      0
    ],
    "notes": "notes",
    "phone": "phone",
    "source": "source",
    "status": "active",
    "tags": [
      "string"
    ]
  },
  "status": "success"
}
{
  "status": "error",
  "message": "Authentication required. Provide x-api-key header.",
  "error_code": "AUTHENTICATION_REQUIRED"
}
{
  "status": "error",
  "message": "Forbidden: required scope 'leads:read' not granted for this API key",
  "error_code": "INSUFFICIENT_SCOPE"
}
{
  "status": "error",
  "message": "Not found"
}
{
  "status": "error",
  "message": "Daily API key request limit of 1000 exceeded",
  "error_code": "RATE_LIMIT_EXCEEDED"
}
{
  "status": "error",
  "message": "Internal server error"
}