Skip to content

Get event metadata schema

GET
/triggers/{id}/metadata
curl --request GET \
--url https://localhost:3000/api/v1/triggers/example/metadata \
--header 'Authorization: <Authorization>'

Returns discovered metadata fields and their inferred types from events of a trigger. field_stats gives, for each key of fields and over the same 1000 most recent events sampled for the types, present (events holding the key) and distinct (distinct values, capped at 1000 with distinct_capped=true), same computation as GET /events/schema. If the trigger is only readable through its public visibility (other owner), all _* server fields are removed from fields and field_stats.

id
required
string

Trigger ID (UUID)

Metadata schema with field types

Media typeapplication/json
object
field_stats
required

FieldStats maps each key of fields to its coverage and cardinality over the 1000 most recent events sampled for the types.

object
key
additional properties
object
distinct
required

Distinct is the number of distinct values of the key, at most 1000.

integer
distinct_capped
required

DistinctCapped is true when the key has more than 1000 distinct values: distinct is then the cap.

boolean
present
required

Present is the number of sampled events holding the key.

integer
fields
required
object
key
additional properties
string
total_events_analyzed
required
integer
trigger_id
required
string format: uuid

Example

{
"field_stats": {
"additionalProperty": {
"distinct": 12,
"distinct_capped": false,
"present": 14000
}
},
"fields": {
"count": "number",
"page": "string",
"userId": "string"
},
"total_events_analyzed": 15234,
"trigger_id": "550e8400-e29b-41d4-a716-446655440000"
}

Invalid request

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Unauthorized

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Insufficient permissions

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Trigger not found

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Internal error

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}