Skip to main content
API Reference/Customers

Customers API

View customer records, look up purchase history, and manage your blacklist. Customer records are created automatically from orders.

GET/v1/customers

List customers

Returns a paginated list of your customers, sorted by most recent order.

Query parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
limitintegerItems per page, max 100 (default: 25)
emailstringSearch by email address
blacklistedbooleanFilter by blacklist status
const res = await fetch("https://api.sellvy.io/v1/customers?limit=20", {
  headers: { "Authorization": "Bearer sk_live_..." }
});

const { data, meta } = await res.json();

Response

json
{
  "data": [
    {
      "id": "cus_abc123",
      "email": "customer@example.com",
      "total_spent": 149.97,
      "order_count": 5,
      "country": "US",
      "blacklisted": false,
      "first_order_at": "2025-01-10T08:00:00Z",
      "last_order_at": "2025-03-20T14:22:00Z"
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 89
  }
}
GET/v1/customers/:id

Get a customer

Retrieve a customer record by ID, including their full order history.

const res = await fetch("https://api.sellvy.io/v1/customers/cus_abc123", {
  headers: { "Authorization": "Bearer sk_live_..." }
});

const customer = await res.json();
console.log(customer.email);       // "customer@example.com"
console.log(customer.orders);      // Array of order summaries
POST/v1/customers/:id/blacklist

Blacklist a customer

Add or remove a customer from your blacklist. Blacklisted customers cannot place new orders on your store.

Request body

FieldTypeDescription
blacklistedbooleanSet to true to blacklist, false to remove from blacklist
reasonstringOptional reason for blacklisting
// Blacklist a customer
const res = await fetch(
  "https://api.sellvy.io/v1/customers/cus_abc123/blacklist",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer sk_live_...",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      blacklisted: true,
      reason: "Chargeback fraud"
    })
  }
);

const result = await res.json();
console.log(result.blacklisted); // true
Was this page helpful?