API ReferenceapianalyticsPOST /v1/events/track

POST /v1/events/track

Service: analytics · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "event_name": {
      "type": "string",
      "minLength": 1
    },
    "distinct_id": {
      "type": "string",
      "minLength": 1
    },
    "brand_id": {
      "type": "string",
      "minLength": 1
    },
    "properties": {
      "type": "object",
      "additionalProperties": {},
      "default": {}
    },
    "context": {
      "type": "object",
      "additionalProperties": {},
      "default": {}
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "event_name",
    "distinct_id",
    "brand_id"
  ]
}

Responses

200 Event tracked successfully

{
  "type": "object",
  "properties": {
    "event_id": {
      "type": "string"
    },
    "event_name": {
      "type": "string"
    },
    "distinct_id": {
      "type": "string"
    },
    "brand_id": {
      "type": "string"
    },
    "posthog_status": {
      "type": "string"
    },
    "tracked_at": {
      "type": "string"
    }
  },
  "required": [
    "event_id",
    "event_name",
    "distinct_id",
    "brand_id",
    "posthog_status",
    "tracked_at"
  ]
}

204 Request filtered (bot traffic)

500 Internal error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://analytics.platform.loop.health/v1/events/track \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'