@datalyr/client is the official TypeScript client for the Datalyr API. It types every
endpoint from the OpenAPI contract: reads, metric queries, attribution, and the scoped
write API.
Install
Quick start
What the client handles for you
- Auth. Sends your key as a bearer token on every request.
- Types. The request parameters and the response shape for each path come from the published OpenAPI contract. A wrong parameter fails at compile time, not at runtime.
- Retries. Retries
429and503responses, and it honors theRetry-Afterheader. Every other error throws immediately with the response body attached. - Idempotency. Pass an
Idempotency-Keyon create requests to make retries safe. - Rate-limit visibility. Read
datalyr.rateLimitafter any request to see your remaining budget, and whether the limiter is degraded.
Writes
Write endpoints need a named key with the matching scope. See API keys for how to create one, and the API reference for which scope each endpoint needs.Errors
The client throwsDatalyrApiError with the status, the error code, and the parsed
body. A 403 with code: "insufficient_scope" names the scope your key is missing in
requiredScope.
Source
The client is generated from the same OpenAPI file this reference is built from, so the two cannot drift. The package lives in the Datalyr repository underpackages/datalyr-api-client.