Skip to content

Backfill historical events (synchronous, up to 1000)

Bulk-loads historical events. Same batch shapes as /api/v1/t but the cap is 1000 (over → 400). Processing is synchronous and always returns processed:true.

Metering (conversion) events MUST carry a client-provided eventId (format ^[A-Za-z0-9_.-]{8,64}$) so the ledger can deduplicate; any missing one fails the whole request with 400 MISSING_EVENT_ID and the 0-based affectedIndices.

Auth: X-API-Key (also ?_ak / ?key), no extra scope gate.

Single event, array, or { "events": [...] } wrapper (max 1000).

Media typeapplication/json
One of:

A single tracking event. eventName is required; everything else is optional. Every field accepts both camelCase and snake_case aliases (e.g. visitorId/visitor_id). Unknown top-level keys are preserved as part of the raw envelope, except the internal derived-event provenance fields (source, derivedRuleId, derivationDepth) which are hard-stripped from external payloads.

object
eventName
required

Event name (aliases event / event_name). Envelope validation expects ^[a-z0-9_]{1,100}$; a non-matching name is a warn-level error (still processed). A missing eventName marks the event invalid.

string
visitorId

Device/browser-level ID (alias visitor_id). Defaults to "anon" if omitted (warn-level).

string
userId

Logged-in user ID (alias user_id).

string
sessionId

Session ID (alias session_id). Tier-1 attribution key.

string
properties

Custom key-value payload. Monetary amounts go in amount (or value) in minor units (cents). currency defaults to CNY. Max ~32 KB serialized (warn-level properties_too_large over the limit).

object
key
additional properties
any
clientTimestamp

Event time, ISO 8601 (aliases client_timestamp / timestamp). Unparseable values are a warn-level error.

string
eventId

Optional client-supplied idempotency/dedup key (alias event_id). Must match ^[A-Za-z0-9_.-]{8,64}$; otherwise it is ignored (with a warning) and the server generates one. REQUIRED for metering events on the backfill endpoint.

string
shortLinkId

Short-link ID for explicit attribution (alias short_link_id).

string
shortLinkCode

Short code for direct-landing attribution (aliases _tk / short_link_code).

string
clickIds

Recommended unified Click ID map covering all 29 ad platforms, e.g. { "bd_vid": "...", "gclid": "..." }. Alternatives: a top-level click_id, or legacy strongly-typed top-level fields (bdVid, gclid, fbclid, … — cover only the earlier ~15 platforms).

object
key
additional properties
string
url

Full page URL; Click IDs are auto-extracted from its query string.

string
landingUrl
string
referrer
string
utmSource

Alias utm_source

string
utmMedium

Alias utm_medium

string
utmCampaign

Alias utm_campaign

string
utmTerm

Alias utm_term

string
utmContent

Alias utm_content

string
Example
json
{
"events": [
{
"eventName": "user_paid",
"visitorId": "vid_abc123",
"eventId": "order-2026-0001",
"properties": {
"amount": 9900,
"currency": "CNY"
},
"clientTimestamp": "2026-06-01T08:00:00Z"
}
]
}

Backfill processed.

Media typeapplication/json
object
accepted
required
integer
failed
required
integer
processed
required
boolean
mode
required
string
Allowed value: backfill

Invalid JSON, batch over 1000, or metering events missing eventId.

Media typeapplication/json
One of:
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Examples
json
{
"error": "单次最多提交 1000 个事件"
}

Missing or invalid API key.

Media typeapplication/json
object
error
required

Human-readable error message.

string
retryAfter

Seconds to wait before retrying (present on 429/503).

integer
message
string
affectedIndices
Array<integer>
Examplegenerated
json
{
"error": "example",
"retryAfter": 1,
"message": "example",
"affectedIndices": [
1
]
}

Metering-selector lookup failed (fail-closed). Retry after 30s.

Media typeapplication/json

503 transient error with a suggested retry delay.

object
error
required
string
Allowed values: SELECTOR_LOOKUP_FAILED QUEUE_UNAVAILABLE
retryAfter
required

Suggested seconds to wait before retrying (30 or 60).

integer
Example
json
{
"error": "SELECTOR_LOOKUP_FAILED",
"retryAfter": 30
}