# REST API

Server-side ingest only. Not a read API. Query analytics via MCP (https://www.eventda.sh/docs/mcp.md).

## Endpoints

- `POST https://www.eventda.sh/api/events`
- `POST https://www.eventda.sh/api/goals`
- `POST https://www.eventda.sh/api/server/events` (`eds_` key, Standard+ revenue)

Auth: `X-API-Key: ed_...` or `Authorization: Bearer ed_...`. Server ingest: `Authorization: Bearer eds_...`

## Events batch

## Events batch

```json
{
  "id": "batch_123",
  "sessionId": "session_abc",
  "anonymousId": "anon_xyz",
  "timestamp": 1234567890000,
  "compressed": false,
  "events": [
    {
      "type": "pageview",
      "timestamp": 1234567890000,
      "pageUrl": "https://example.com/page",
      "pageTitle": "Page Title",
      "referrer": "https://google.com"
    }
  ]
}
```

## Goal payload

```json
{
  "goal_name": "signup",
  "anonymous_id": "anon_xyz",
  "page_url": "https://example.com/pricing",
  "metadata": { "plan": "pro" }
}
```

Responses: 200 ok (or sampled at quota), 400 invalid, 401 bad key, 403 plan restriction, 429 rate limit.

Trusted revenue: `POST https://www.eventda.sh/api/server/events` with `identifiedUserId`, `amount` or `revenue_cents`, and ISO `currency`. Public `/api/events` strips amounts.
