> For the complete documentation index, see [llms.txt](https://docs.millimetric.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.millimetric.ai/api-reference/sources.md).

# GET /v1/sources

Top sources (and optionally source × medium) for the project. **This is the endpoint that surfaces the Facebook social-vs-paid split.**

## Auth

|                |        |
| -------------- | ------ |
| Required scope | `read` |
| Key kinds      | `rk_*` |

## Request

```http
GET /v1/sources?from=…&to=…&breakdown=source_medium
Authorization: Bearer rk_live_…
```

### Query parameters

| Name        | Required | Notes                                  |
| ----------- | -------- | -------------------------------------- |
| `from`      | **yes**  | ISO 8601 timestamp (inclusive).        |
| `to`        | **yes**  | ISO 8601 timestamp (exclusive).        |
| `breakdown` | no       | `source_medium` (default) or `source`. |
| `limit`     | no       | 1–200, default 50.                     |

## Response

```json
{
  "breakdown": "source_medium",
  "rows": [
    { "source": "facebook", "medium": "paid",   "events": 6, "uniques": 6, "paid_share": 1.0 },
    { "source": "facebook", "medium": "social", "events": 3, "uniques": 3, "paid_share": 0.0 },
    { "source": "google",   "medium": "paid",   "events": 3, "uniques": 3, "paid_share": 1.0 },
    { "source": "direct",   "medium": "direct", "events": 7, "uniques": 7, "paid_share": 0.0 }
  ]
}
```

Each row:

* `events` — total events matching the breakdown.
* `uniques` — distinct `anonymous_id`s (HyperLogLog estimate).
* `paid_share` — `count(medium='paid') / count(*)` for the row. For `breakdown=source_medium` it's trivially 0 or 1; for `breakdown=source` it reveals what fraction of a source's traffic is paid (useful for "X% of our Facebook is paid").

## Examples

### "What's our Facebook social vs paid split this month?"

```bash
curl -G "https://api.millimetric.ai/v1/sources" \
  -H "Authorization: Bearer $RK_KEY" \
  --data-urlencode "from=2026-05-01T00:00:00Z" \
  --data-urlencode "to=2026-06-01T00:00:00Z"
# rows include separate facebook/paid and facebook/social entries
```

### "Where does our traffic come from, ignoring paid/organic?"

```bash
curl -G "https://api.millimetric.ai/v1/sources" \
  -H "Authorization: Bearer $RK_KEY" \
  --data-urlencode "from=2026-05-01T00:00:00Z" \
  --data-urlencode "to=2026-06-01T00:00:00Z" \
  --data-urlencode "breakdown=source"
# rows include a paid_share column for each source
```

## Related

* For more flexible aggregations, use [`/v1/stats`](/api-reference/stats.md) with `group_by=source,medium`.
* For session-level entry source (better for revenue attribution), query `sessions_v` directly.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.millimetric.ai/api-reference/sources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
