Skip to main content
The Photon API clients are libraries for TypeScript, Python, and Rust that call the Photon API. Each one is generated from the API’s public OpenAPI contract, so every endpoint is a typed method and every request and response field has a type. The clients:
  • send the Authorization: Bearer header on every request: in TypeScript and Python you set the header when you create the client, and in Rust the client attaches the credential you register,
  • type every request and response with the contract’s fields and names,
  • retry reads and idempotent writes after transient errors such as 429 and 503,
  • report API errors with the problem details the API returns, and
  • give you the status, headers, and request ID of a response when you need them.
They do not run OAuth flows, and they leave validation rules such as patterns, lengths, and ranges to the API. Responses are read leniently, so an installed client keeps working as the API grows: fields the API adds later are accepted (TypeScript and Python keep them; Rust ignores them unless the object allows extra members), and new enum values are kept rather than rejected.

Packages

The three packages share one version number and are released together. See Versioning.

Install

The TypeScript client is an ES module. The Python package includes a synchronous client, Photon, and an asynchronous one, AsyncPhoton. The Rust client is async and runs on Tokio; the Rust examples in this guide also use #[tokio::main], which needs the Tokio features shown above.

Source and contract

The clients, the OpenAPI contract they are generated from (openapi/openapi.json), and the changelog are in photon-hq/api on GitHub. Report bugs there as issues. Every endpoint page in the API reference shows the call in TypeScript, Python, and Rust.

Next steps

Credentials

Choose a credential and pass it to the client.

Making requests

Call an endpoint and read the response.

Errors

Handle API, transport, and response errors.

Retries and timeouts

Know what the clients retry and how to configure it.