# Metrics API

> Send customer metrics to CustomerCatalyst for product usage scoring.

Send customer metrics to CustomerCatalyst for product usage scoring from your server. Version 2.0.0. To send events from your product's pages instead, use the [tracking SDK](/developers/tracking-sdk/).

**Base URL:** `https://app.customercatalyst.io/api/1.1/wf`

Every call except `/auth` needs a bearer token in the `Authorization` header.

## Limits

- Up to **2,000 metrics** per call.
- Metrics are processed in batches of **500**.

## Authenticate — `POST /auth`

Signs in an organization admin and returns an access token. The token is valid for **24 hours** (86,400 seconds).

**Request body** (JSON, both required):

| Field | Type | Example |
|---|---|---|
| `email` | string (email) | `admin@yourorganization.com` |
| `password` | string | |

```bash
curl -X POST https://app.customercatalyst.io/api/1.1/wf/auth \
  -H "Content-Type: application/json" \
  -d '{"email": "admin@yourorganization.com", "password": "…"}'
```

**200 — authentication successful:**

```json
{
  "status": "success",
  "response": {
    "token": "bus|12345x67890",
    "user_id": "1729752661023x277131438299202960",
    "expires": 86400
  }
}
```

**401** — authentication failed.

## Upload metrics — `POST /upload_metrics`

Sends customer metrics for product usage scoring. Needs `Authorization: Bearer <token>`.

**Request body** (JSON):

| Field | Type | Required | |
|---|---|---|---|
| `organization_id` | string | yes | e.g. `1755330002129x611465252565155800` |
| `metrics` | array of Metric | yes | Up to 2,000 items. |

**Metric** (all required):

| Field | Type |
|---|---|
| `customer_id` | string |
| `metric_slug` | string |
| `value` | number |

```bash
curl -X POST https://app.customercatalyst.io/api/1.1/wf/upload_metrics \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "organization_id": "1755330002129x611465252565155800",
    "metrics": [
      { "customer_id": "customer_123", "metric_slug": "number_of_logins", "value": 45 }
    ]
  }'
```

**200 — metrics accepted:**

| Field | Type |
|---|---|
| `success` | boolean |
| `total_metrics` | integer |
| `total_batches` | integer |
| `message` | string |

## Questions

Email [support@customercatalyst.io](mailto:support@customercatalyst.io).
