Submit first-party events - Spacefast Docs

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

Responses

202 Response for status 202

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

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

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

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

{
  "$schema": "http://example.com",
  "data": {
    "accepted": 9007199254740991
  }
}
{
  "$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"
}