> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bullionwale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK

> An official TypeScript client for the Bullionwale API is coming soon.

> [!NOTE]
>
> **Coming soon.** There is no official TypeScript package yet. Until there is, call the API with `fetch` or generate a client from the OpenAPI spec, as below.

## Use the API directly

Call the API from your **server**, never from a browser or mobile app: the key must stay secret.

```typescript theme={null}
const BASE = "https://api.bullionwale.com/api/trading/test/v1";

const res = await fetch(`${BASE}/me`, {
  headers: { "X-API-Key": process.env.BULLIONWALE_API_KEY! },
});
console.log(res.status, await res.json());
```

* Keep amounts and weights as the **strings** the API returns, or parse them with a decimal library. JavaScript numbers are floating point and lose precision (see [Units and pricing](/units-and-pricing)).
* Generate one `Idempotency-Key` per order (for example with `crypto.randomUUID()`), store it with the order, and reuse it on every retry (see [Idempotency and safe retries](/idempotency)).

## Generate a client

The [OpenAPI spec](/openapi-and-postman) describes every endpoint, request and response. Any OpenAPI 3.1 client or type generator for TypeScript can turn `https://docs.bullionwale.com/openapi.json` into typed calls. Regenerate it when the spec changes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.