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

# SDK

> Current client SDK status and dependency-free JSON and bundle examples.

Atlan does not currently publish a public Agent Registry or Skill Registry
client package. Use the HTTP API directly or connect through MCP. The curated
OpenAPI document is the source for future generated client SDKs.

<Note>
  **Preview.** The snippets below are examples, not a supported SDK. Verify
  them against the current public API before using them in production.
</Note>

## Request JSON safely

This JavaScript helper is for JSON endpoints only. It applies a timeout, checks
the response content type, and exposes the documented problem body when a
request fails.

```js theme={null}
export class AtlanApiError extends Error {
  constructor(response, body) {
    super(body?.detail ?? `Atlan API returned ${response.status}`);
    this.name = "AtlanApiError";
    this.status = response.status;
    this.code = body?.code;
    this.traceId = body?.trace_id;
  }
}

export function createAtlanJsonClient({ gatewayUrl, token, timeoutMs = 10_000 }) {
  return async function requestJson(path, init = {}) {
    const headers = new Headers(init.headers);
    headers.set("Authorization", `Bearer ${token}`);
    if (init.body != null && !headers.has("Content-Type")) {
      headers.set("Content-Type", "application/json");
    }

    const response = await fetch(new URL(path, gatewayUrl), {
      ...init,
      headers,
      signal: init.signal ?? AbortSignal.timeout(timeoutMs),
    });
    const contentType = response.headers.get("content-type") ?? "";
    const isJson = contentType.includes("application/json") ||
      contentType.includes("application/problem+json");
    const body = isJson ? await response.json() : await response.text();

    if (!response.ok) throw new AtlanApiError(response, body);
    if (!isJson) throw new TypeError("Expected a JSON response");
    return body;
  };
}
```

Create the helper with a gateway URL and token loaded from your application's
secret store, then use it for a JSON response:

```js theme={null}
const atlan = createAtlanJsonClient({
  gatewayUrl: process.env.ATLAN_GATEWAY_URL,
  token: process.env.ATLAN_TOKEN,
});

const identity = await atlan("/registry/v1/auth/whoami");
console.log(identity);
```

## Download a bundle as bytes

Use a separate helper for bundle or file endpoints. They return bytes, not a
JSON document.

```js theme={null}
import { writeFile } from "node:fs/promises";

export async function downloadSkillBundle({ gatewayUrl, token, skillId, version }) {
  const response = await fetch(
    new URL(`/skill/v1/skills/${skillId}/versions/${version}/bundle`, gatewayUrl),
    { headers: { Authorization: `Bearer ${token}` }, signal: AbortSignal.timeout(10_000) },
  );
  if (!response.ok) {
    const body = await response.json().catch(() => undefined);
    throw new AtlanApiError(response, body);
  }
  if (!response.headers.get("content-type")?.includes("application/zip")) {
    throw new TypeError("Expected an application/zip response");
  }
  await writeFile("./skill-bundle.zip", Buffer.from(await response.arrayBuffer()));
}
```

<Note>
  Agent Gateway also contains a Rust extension SDK for Atlan service authors.
  That crate is repository-internal and is not a public client SDK or a
  supported external package.
</Note>
