> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atlaspay.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Customers

Create and manage customer records for billing.

## Create Customer

```bash theme={null}
curl -X POST https://api.atlas.co/functions/v1/customers \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "customer@example.com",
    "name": "Jane Doe",
    "metadata": { "user_id": "123" }
  }'
```

**Parameters:**

| Parameter             | Type   | Required | Description                  |
| --------------------- | ------ | -------- | ---------------------------- |
| `email`               | string | Yes      | Customer email address       |
| `name`                | string | No       | Customer full name           |
| `phone`               | string | No       | Customer phone number        |
| `metadata`            | object | No       | Key-value pairs for your use |
| `address.line1`       | string | No       | Street address               |
| `address.city`        | string | No       | City                         |
| `address.state`       | string | No       | State or province            |
| `address.postal_code` | string | No       | ZIP or postal code           |
| `address.country`     | string | No       | Two-letter country code      |

**Response:**

```json theme={null}
{
  "id": "cus_xxx",
  "object": "customer",
  "email": "customer@example.com",
  "name": "Jane Doe",
  "metadata": { "user_id": "123" },
  "created": 1704844800
}
```

## List Customers

```bash theme={null}
curl "https://api.atlas.co/functions/v1/customers?limit=10" \
  -H "Authorization: Bearer sk_test_xxx"
```

## Retrieve Customer

```bash theme={null}
curl https://api.atlas.co/functions/v1/customers/cus_xxx \
  -H "Authorization: Bearer sk_test_xxx"
```

## Update Customer

```bash theme={null}
curl -X PATCH https://api.atlas.co/functions/v1/customers/cus_xxx \
  -H "Authorization: Bearer sk_test_xxx" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Jane Smith" }'
```

## Delete Customer

```bash theme={null}
curl -X DELETE https://api.atlas.co/functions/v1/customers/cus_xxx \
  -H "Authorization: Bearer sk_test_xxx"
```

## Node.js SDK

```typescript theme={null}
import { Atlas } from '@atlas/node';

const atlas = new Atlas('sk_test_xxx');

// Create
const customer = await atlas.customers.create({
  email: 'customer@example.com',
  name: 'Jane Doe',
});

// List
const customers = await atlas.customers.list({ limit: 10 });

// Retrieve
const cust = await atlas.customers.retrieve('cus_xxx');

// Update
await atlas.customers.update('cus_xxx', { name: 'Jane Smith' });

// Delete
await atlas.customers.delete('cus_xxx');
```
