# Client telemetry ingestion

Send installed-app telemetry with scoped authentication and retain queued records until their delivery is acknowledged.

Source: https://appportal.io/docs/api/client-ingestion

Use the [SDK for your framework](https://appportal.io/docs/getting-started/first-event) to send telemetry to
`https://api.appportal.io`. The [operation reference](https://appportal.io/docs/api/reference/client-ingestion) and
[OpenAPI JSON](https://appportal.io/docs/api/contracts/client-ingestion.json) describe the six v1 batch endpoints for
events, crashes, logs, sessions, performance markers and push registrations.

Deployments that enable identity associations also support v2 definition delivery and five
associated telemetry batches. Send a definition first and keep its original fields on retry.
Keep dependent records on the v2 protocol. Push registrations continue to use v1.

## Authenticate the app

Send the installed-app credential in `X-AppPortal-SDK-Key`. It authorizes telemetry for its app and
environment; caller-supplied account, app or environment values cannot redirect that authority.
It does not grant report access or customer-server Automation permissions.

An identified push-registration batch also requires a valid user-installation binding and matching
installation ID. Its reference lists the exact headers. A batch can address at most one identified
user; an SDK key alone cannot establish that user's authority.

## Send and acknowledge a batch

Each request is a JSON array. The compiled defaults allow 500 records per batch, a 6 MiB request
body and a 200 UTF-16 code-unit record ID. Deployments can configure these limits. Event and log
fields have additional acceptance bounds in their schemas.

HTTP JSON binding and record acceptance are separate. A well-formed batch can return `200` with
rejected records. Read each acknowledgement before removing the corresponding journal record;
a retry can return `AlreadyAccepted` without publishing the record twice. An intake acknowledgement
does not mean asynchronous analytics persistence has finished.

The schemas describe HTTP parsing, including case-insensitive property names and ignored unknown
properties. The `x-appportal-acceptance-rules` annotations describe domain validation. Server-owned
fields are marked read-only. Do not interpret an optional parsing field as permission to omit
identity or a stable record ID from an accepted record.

## Handle temporary failure

A `503` temporary v1 response includes `Retry-After`, `retryAfterSeconds` and `retryAt`. Keep
unacknowledged records and retry no earlier than the stated deadline; the minimum delay is one hour.
The deadline starts when the response is written, with a floor at the decision time.

This unsigned temporary response does not authorize purging the queue or disabling collection.
Authentication failures, malformed batches and oversized requests also acknowledge no records.
Correct authentication, repair a malformed request or split an oversized batch while preserving
unacknowledged journal entries.

## Verify optional permanent rejection evidence

An SDK can opt in to signed rejection evidence by sending all three attempt headers:
`X-AppPortal-Delivery-Nonce`, `X-AppPortal-Delivery-Generation` and
`X-AppPortal-Delivery-Body-SHA256`. Each is exactly one 64-character lowercase hexadecimal value.
They bind a fresh attempt nonce, the current configuration generation and the SHA-256 of the
exact request bytes; they do not authenticate an app or grant access.

Only fresh, definitive evidence that an app credential is unknown, revoked or deleted can produce
the optional `401` body with `proof`, `errorCode`, `action` and `schemaVersion`. The signed JWT must
verify against already trusted Identity keys and the exact credential, nonce, configuration,
request bytes, origin, method and path. Its validity is 120 seconds with five seconds of clock
skew. Missing trust, stale or invalid proof, user-token expiry and ordinary unsigned errors remain
non-destructive. A `401` status or an `action` string alone is never permission to clear a journal.

After successful verification for the active configuration, persist rejection and purge-pending
before clearing its queue. Verify clearing before marking completion. An old response cannot
purge a new configuration's records, and this process does not change communication consent or
erase retained server data. Availability requires existing server signing and public-origin
configuration; this reference does not activate either.

Start with [your first event](https://appportal.io/docs/getting-started/first-event), then
[inspect delivery in DevSpace](https://appportal.io/docs/getting-started/devspaces).

Use [Client controls](https://appportal.io/docs/api/client-controls) for crash diagnostic attachments and bound-user
communication preferences. Communication consent is separate from the SDK's local telemetry
collection decisions and does not erase retained server data.
