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
sourcestring
default: "other"
Allowed:dashboard,www,cli,domain-ssh,control-plane,othereventsobject[] required
min items 1 · max items 20
Array ofobjectidstring
min length 1 · max length 128namestring 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_trippedactorobject required
One of:- object
typestring requiredidstring required
Opaque analytics id minted by the platform; never an email or a name.
min length 1 · max length 64
- object
typestring requiredidstring required
min length 1 · max length 128
- object
typestring requiredidstring required
min length 1 · max length 128
- object
typestring requirednamespacestring required
min length 1 · max length 64idstring required
min length 1 · max length 128
- object
typestring requiredidstring required
min length 1 · max length 128
- object
contextobject
default: {}team_idstring | any- Any of:
- string
- any
- Any of:
space_idstring | any- Any of:
- string
- any
- Any of:
user_idstring | any- Any of:
- string
- any
- Any of:
version_idstring | any- Any of:
- string
- any
- Any of:
clientstring | any- Any of:
- string
- any
- Any of:
surfacestring | any- Any of:
- string
- any
- Any of:
propertiesobject
default: {}occurredAtstring
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
schemastring
Canonical JSON Schema URL for this response body. The server also sends it in theLink: rel="describedby"response header.dataobject requiredacceptedinteger required
min 0 · max 9007199254740991defaultError. Every 4xx and 5xx response is one RFC 9457 problem document served asapplication/problem+json.
schemastring
Canonical JSON Schema URL for this response body. The server also sends it in theLink: rel="describedby"response header.typestring required
URL of the documentation page for this error. Derived fromcode.titlestring required
Human-readable name of the error type. Derived fromcode.statusinteger required
HTTP status of the response, repeated in the body. min -9007199254740991 · max 9007199254740991detailstring required
What went wrong in this request.codestring required
Stable snake_case error code. Match on this, not ondetail.pointerstring RFC 6901 JSON Pointer to the request field or batch entry that failed, for example/files/37/path. Present on validation failures.detailsobject Machine-readable context keyed by the error code.suggestionsstring[] Recovery steps safe to show to a person.nextstring[] Commands or API requests to run next, usable as written.requestIdstring required
ID of this request, from theX-Request-Idheader 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
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"
}