Skip to main content
POST
Python (SDK)

Authorizations

Authorization
string
header
required

Gateway auth: send Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, you can also send X-On-Behalf-Of: <external-user-id>.

Path Parameters

id
string
required

ID of the analytics project.

Required string length: 1 - 128
Pattern: ^[^\u0000]*$

Body

application/json
metric
enum<string>
required

count counts events. unique_visitors counts distinct values of distinct_id. Both deduplicate event IDs first.

Available options:
count,
unique_visitors
from
string<date-time>
required

Start of the time range, inclusive. Use an ISO 8601 timestamp with Z for UTC or an offset such as -07:00. Must be before to.

Example:

"2026-09-01T00:00:00Z"

to
string<date-time>
required

End of the time range, exclusive. Use an ISO 8601 timestamp with Z for UTC or an offset such as -07:00. Must be after from.

Example:

"2026-09-02T00:00:00Z"

event_name
string

Only include events with this exact name. Omit to include all event names.

Required string length: 1 - 255
Example:

"page_view"

bucket
enum<string>

Split results into time buckets. Hours, days, and Monday-start weeks begin on the clock of timezone, which defaults to UTC. Empty buckets are omitted.

Available options:
hour,
day,
week
timezone
string

IANA time zone name that sets where buckets start. Defaults to UTC. A day is a local calendar day and lasts 23 or 25 hours when the clocks change. In zones offset by 30 or 45 minutes, hours start on the local clock. UTC offsets such as +05:30 are rejected, as are identifiers outside the IANA database such as PST or BST, and names the service's time zone database does not know, which can lag the newest IANA zones; fall back to UTC when the 400 names timezone. Only bucket boundaries change: from, to, filters, and the UTC format of each row's bucket stay the same. Has no effect without bucket.

Required string length: 1 - 64
Examples:

"America/Los_Angeles"

"Asia/Kolkata"

"UTC"

group_by
string

Group results by one event property. Missing values and null share a group.

Required string length: 1 - 128
Pattern: ^[^\u0000]*$
Example:

"pathname"

filters
object[]

Property filters combined with AND. An event must match every filter.

Maximum array length: 10
limit
integer
default:100

Maximum number of result rows, including rows created by time buckets and property groups.

Required range: 1 <= x <= 1000

Response

Success

metric
enum<string>
required
Available options:
count,
unique_visitors
rows
object[]
required