TypeScript client
Use the generated REST client and handle typed responses
Aura maintains a generated TypeScript REST client in the repository at
packages/aura-sdk-typescript. It is generated from the canonical OpenAPI
artifact and provides typed paths, parameters and response shapes.
The generated package is named @aura-app/sdk. Public npm installation is not
currently verified. Obtain the package artifact from your Aura integration
contact before adding it to an external project. Generating this client does
not publish a package or make a release available to consumers.
Read leads
Once the package artifact is installed or linked in your project:
import { createClient } from "@aura-app/sdk";
const apiKey = process.env.AURA_API_KEY;
if (!apiKey) throw new Error("Set AURA_API_KEY before running this example");
const aura = createClient({ apiKey });
const { data, error, response } = await aura.GET("/v1/leads", {
params: { query: { limit: 50 } },
});
if (error) {
throw new Error(`${response.status}: ${error.code} (${error.requestId})`);
}
console.log(data);The client defaults to the production API. To test against staging, pass
baseUrl: "https://staging-api.aura-app.ai" to createClient. Keep your key on
the server. The same scopes, test-key restrictions and rate limits described
in Making requests apply to client calls.
Responses and pagination
Methods return { data, error, response }. Check error before consuming
data, and use response for status and headers. For list requests, send the
returned pagination.next_cursor as the next request's cursor, keeping your
filters unchanged. See List leads for the full response.
Choosing an interface
Use the client for typed REST requests. Use the GraphQL endpoint when you need a GraphQL operation. The TypeScript client does not generate GraphQL query types. Both interfaces document the same underlying resources; their field names and transport envelopes differ.