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

# Customer Analytics

> Query a per-customer payment breakdown scoped to your business

<span style={{display:"none"}}>For the complete documentation index, see [llms.txt](/llms.txt).</span>

Returns a per-customer breakdown of payment activity scoped to your business. Use it to power customer dashboards or to surface a customer's history in support tools.

### Path Parameters

<ParamField path="email" type="string" required>
  The customer's email address (URL-encoded)
</ParamField>

### Response

<ResponseField name="payer_email" type="string">
  The customer's email
</ResponseField>

<ResponseField name="overview" type="object">
  Transaction counts grouped by status

  <Expandable title="Fields">
    <ResponseField name="total_transactions" type="integer">
      Total number of invoices issued to this customer
    </ResponseField>

    <ResponseField name="by_status" type="object">
      Breakdown by `paid`, `pending`, `scanned`, `expired`, and `void`
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="revenue" type="object">
  Gross and net revenue from this customer (both as decimal strings)
</ResponseField>

<ResponseField name="recent_transactions" type="array">
  Up to 10 most recent invoices for this customer
</ResponseField>

<ResponseField name="last_transaction_at" type="string | null">
  ISO 8601 timestamp of the customer's last paid invoice
</ResponseField>

```javascript theme={null}
const email = encodeURIComponent("customer@example.com");
const res = await fetch(
  `https://payments.shakesco.com/analytics/customer/${email}`,
  { headers: { Authorization: `Bearer ${API_KEY}` } }
);
const analytics = await res.json();
```

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "payer_email": "customer@example.com",
    "overview": {
      "total_transactions": 8,
      "by_status": {
        "paid": 5,
        "pending": 1,
        "scanned": 0,
        "expired": 1,
        "void": 1
      }
    },
    "revenue": {
      "total_spent_gross": "7840.00",
      "total_spent_net": "7000.00"
    },
    "recent_transactions": [
      {
        "invoice_number": "INV-2026-9c8d7e6f",
        "payer_name": "Jane Doe",
        "payer_email": "customer@example.com",
        "asset": "ETH",
        "amount": "0.00045",
        "status": "paid",
        "paid_at": "2026-05-01T14:22:00.000000Z",
        "created_at": "2026-05-01T10:00:00.000000Z",
        "payer_display": "Jane Doe"
      }
    ],
    "last_transaction_at": "2026-05-01T14:22:00.000000Z"
  }
  ```

  ```json 400 Bad Request theme={null}
  { "error": "Invalid email address" }
  ```

  ```json 404 Not Found theme={null}
  { "error": "No data for this customer" }
  ```
</ResponseExample>
