# Submit first-party events

Send registered events from first-party clients as JSON. Limit each request to 20 events and 64 KiB. Exclude personal data. Control-plane events are server-only. Requests are rate-limited.

## POST `/v1/events`

### Request body

**required** `application/json`

- `source` **string**  
  default: "other"  
  Allowed: `dashboard`, `www`, `cli`, `domain-ssh`, `control-plane`, `other`

- `events` **object[]** **required**  
  min items 1 · max items 20  
  Array of `object`
  - `id` **string**  
    min length 1 · max length 128
  - `name` **string** **required**  
    Allowed: `client.page_viewed`, `client.web_vital.measured`, `client.error.observed`, `cli.agent_tooling.outcome`, `browser.funnel.claim_page_viewed`, `browser.funnel.claim_token_validated`, `browser.funnel.space_claimed`, `browser.funnel.start_step_viewed`, `browser.funnel.start_option_chosen`, `browser.funnel.start_prompt_copied`, `domain.search.session_started`, `domain.search.session_ended`, `domain.search.lookup_requested`, `publish.receipt.created`, `version.intent.created`, `version.finalize.queued`, `version.promote.queued`, `auth.agent_handoff.redeemed`, `auth.agent_handoff.fetched`, `feature.blocked`, `abuse.limit_tripped`
  - `actor` **object** **required**  
    One of:
    - **object**  
      - `type` **string** **required**  
      - `id` **string** **required**  
        Opaque analytics id minted by the platform; never an email or a name.  
        min length 1 · max length 64
    - **object**
      - `type` **string** **required**  
      - `id` **string** **required**  
        min length 1 · max length 128
    - **object**
      - `type` **string** **required**  
      - `id` **string** **required**  
        min length 1 · max length 128
    - **object**
      - `type` **string** **required**  
      - `namespace` **string** **required**  
        min length 1 · max length 64  
      - `id` **string** **required**  
        min length 1 · max length 128
    - **object**
      - `type` **string** **required**  
      - `id` **string** **required**  
        min length 1 · max length 128
  - `context` **object**  
    default: {}
    - `team_id` **string | any**  
      - Any of:
        - **string**  
        - **any**  
    - `space_id` **string | any**  
      - Any of:
        - **string**  
        - **any**  
    - `user_id` **string | any**  
      - Any of:
        - **string**  
        - **any**  
    - `version_id` **string | any**  
      - Any of:
        - **string**  
        - **any**  
    - `client` **string | any**  
      - Any of:
        - **string**  
        - **any**  
    - `surface` **string | any**  
      - Any of:
        - **string**  
        - **any**
  - `properties` **object**  
    default: {}
  - `occurredAt` **string<date-time>**  
    Client-side event time; server receipt time is authoritative when omitted.  
    matches ^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$

### Responses

#### 202 Response for status 202

- `schema` **string<uri>**  
  Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
- `data` **object** **required**  
  - `accepted` **integer** **required**  
    min 0 · max 9007199254740991
  - `defaultError`. Every 4xx and 5xx response is one RFC 9457 problem document served as `application/problem+json`.
- `schema` **string<uri>**  
  Canonical JSON Schema URL for this response body. The server also sends it in the `Link: rel="describedby"` response header.
- `type` **string** **required**  
  URL of the documentation page for this error. Derived from `code`.
- `title` **string** **required**  
  Human-readable name of the error type. Derived from `code`.
- `status` **integer** **required**  
  HTTP status of the response, repeated in the body.
  min -9007199254740991 · max 9007199254740991
- `detail` **string** **required**  
  What went wrong in this request.
- `code` **string** **required**  
  Stable snake_case error code. Match on this, not on `detail`.
- `pointer` **string**
  RFC 6901 JSON Pointer to the request field or batch entry that failed, for example `/files/37/path`. Present on validation failures.
- `details` **object**
  Machine-readable context keyed by the error code.
- `suggestions` **string[]**
  Recovery steps safe to show to a person.
- `next` **string[]**
  Commands or API requests to run next, usable as written.
- `requestId` **string** **required**  
  ID of this request, from the `X-Request-Id` header or generated. Quote it when contacting support.

### Try it

**Server**  
Base URL `https://api.spacefast.com`  
Custom base URL Overrides the selected server when set.

### Body
**application/json**

### Request body

### Send

### Request

#### cURL

```bash
curl -X POST "https://api.spacefast.com/v1/events" \
  -H "Content-Type: application/json" \
  -d '{
  "source": "dashboard",
  "events": [\
    {\
      "id": "string",\
      "name": "client.page_viewed",\
      "actor": {\
        "type": "analytics_id",\
        "id": "string"\
      },\
      "context": {},\
      "properties": {},\
      "occurredAt": "2019-08-24T14:15:22Z"\
    }\
  ]
}'
```

#### JavaScript

```javascript
const response = await fetch("https://api.spacefast.com/v1/events", {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: "{\n  \"source\": \"dashboard\",\n  \"events\": [\n    {\n      \"id\": \"string\",\n      \"name\": \"client.page_viewed\",\n      \"actor\": {\n        \"type\": \"analytics_id\",\n        \"id\": \"string\"\n      },\n      \"context\": {},\n      \"properties\": {},\n      \"occurredAt\": \"2019-08-24T14:15:22Z\"\n    }\n  ]\n}"  
});
```

#### Python

```python
import requests

response = requests.post(
    "https://api.spacefast.com/v1/events",
    headers={
        "Content-Type": "application/json"
    },
    data="{\n  \"source\": \"dashboard\",\n  \"events\": [\n    {\n      \"id\": \"string\",\n      \"name\": \"client.page_viewed\",\n      \"actor\": {\n        \"type\": \"analytics_id\",\n        \"id\": \"string\"\n      },\n      \"context\": {},\n      \"properties\": {},\n      \"occurredAt\": \"2019-08-24T14:15:22Z\"\n    }\n  ]\n}",
)
```

### Response

#### 202 default

```json
{
  "$schema": "http://example.com",
  "data": {
    "accepted": 9007199254740991
  }
}
```

```json
{
  "$schema": "http://example.com",
  "type": "string",
  "title": "string",
  "status": -9007199254740991,
  "detail": "string",
  "code": "string",
  "pointer": "string",
  "details": {
    "property1": null,
    "property2": null
  },
  "suggestions": [
    "string"
  ],
  "next": [
    "string"
  ],
  "requestId": "string"
}
```
