Skip to main content
Every request to a /v1/* endpoint must carry a valid API key. Pecta issues two key types with different trust levels, and the @pecta/core SDK optionally signs telemetry payloads with an HMAC signature for additional integrity guarantees.

Key types

Pecta API keys follow the format pk_live_<32 chars> or sk_live_<32 chars>. The prefix tells you what the key is allowed to do. Keys are shown only once at creation time and stored as SHA-256 hashes in Pecta’s database.
Never embed a sk_live_ key in client-side code, browser bundles, or any repository that is or could become public. If a secret key is exposed, revoke it immediately from the dashboard.

Authorization header

Pass your key as a Bearer token on every /v1/* request:
Full example with curl:

HMAC signing for telemetry

When the @pecta/core SDK is configured with a secretKey, it signs every ingest payload with HMAC-SHA256 and includes the signature in the X-Pecta-Signature request header. This lets Pecta verify the payload was not tampered with in transit. The header format is:
The digest is computed as:
Pecta computes the expected digest server-side and compares it using a constant-time comparison (timingSafeEqual) to prevent timing attacks. If the header is present but the digest does not match, the request is rejected:
The X-Pecta-Signature header is optional. If you omit it, ingest proceeds without signature verification. Enable HMAC in the SDK with:
Enable HMAC signing whenever you use @pecta/core in an RTB or otherwise latency-critical environment where payload integrity matters.

401 response

When authentication fails, the API returns 401 with a machine-readable code field: