Every request to aDocumentation Index
Fetch the complete documentation index at: https://docs.pecta.ai/llms.txt
Use this file to discover all available pages before exploring further.
/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 formatpk_live_<32 chars> or sk_live_<32 chars>. The prefix tells you what the key is allowed to do.
| Prefix | Type | Safe to expose? | Use for |
|---|---|---|---|
pk_live_ | Publishable | Yes — config files, .env on client | Reads, /v1/evaluate, telemetry ingest, MCP proxy |
sk_live_ | Secret | No — server environment only | Admin operations, HMAC signing |
Authorization header
Pass your key as a Bearer token on every/v1/* request:
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:
timingSafeEqual) to prevent timing attacks. If the header is present but the digest does not match, the request is rejected:
X-Pecta-Signature header is optional. If you omit it, ingest proceeds without signature verification. Enable HMAC in the SDK with:
401 response
When authentication fails, the API returns401 with a machine-readable code field:
| Code | Cause |
|---|---|
auth_missing | No Authorization header, or header is malformed |
auth_format | Key does not match the pk_live_ / sk_live_ format |
auth_invalid | Key not found in the database |
auth_revoked | Key exists but has been revoked |
hmac_no_secret | HMAC header was sent but no secret key is on file |
hmac_invalid | HMAC digest does not match the request body |