Skip to main content
POST
/
metric-events
Ingest metric events
curl --request POST \
  --url https://app.gaintrace.com/api/v1/metric-events \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "events": [
    {
      "eventName": "<string>",
      "occurredAt": "2023-11-07T05:31:56Z",
      "companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "companyExternalId": "<string>",
      "enduserId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "enduserEmail": "[email protected]",
      "properties": {},
      "externalId": "<string>"
    }
  ],
  "source": "api",
  "strict": false
}
'
{
  "ok": true,
  "summary": {
    "received": 123,
    "ingested": 123,
    "duplicate": 123,
    "rejected": 123
  },
  "outcomes": [
    {
      "index": 123,
      "error": "<string>",
      "eventLogId": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer API key. Secret server keys start with gt_live_; client-safe browser keys start with gt_pub_ (write-only, origin-pinned). Create and scope keys in Settings → API Keys.

Body

application/json
events
object[]
required
Required array length: 1 - 500 elements
source
enum<string>
default:api
Available options:
script,
api,
segment,
pendo,
mixpanel,
import,
system
strict
boolean
default:false

When true, reject events whose eventName is not registered in event definitions.

Response

Batch processed. See outcomes for per-event status.

ok
boolean
summary
object
outcomes
object[]
Last modified on July 6, 2026