> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/consume/activate/apis/sdk/typescript-sdk.md).

# TypeScript SDK

Use the TypeScript SDK when a Node.js or TypeScript application needs typed access to Data Product APIs.

The SDK wraps the API groups into a single `VulcanClient` and uses the native `fetch` API in Node.js 18 and later.

## Installation

Download the SDK package, then install it locally:

{% file src="/files/cck78kj9GqWypZltGBfJ" %}

```bash
npm install vulcan-sdk-0.1.0.tgz
```

## Create a client

```typescript
import { VulcanClient } from "vulcan-sdk";

const client = new VulcanClient({
  fqdn: "example.dataos.io",
  dpName: "b2b_saas",
  accessToken: "<your-dataos-api-token>",
  tenant: "public",
});
```

The SDK builds the base URL automatically:

```
https://{fqdn}/vulcan/tenants/{tenant}/data-products/{tenant}-{dpName}/api/v1
```

## Constructor options

<table><thead><tr><th width="141.2998046875">Option</th><th width="115.6876220703125">Type</th><th width="108.830322265625">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>fqdn</code></td><td><code>string</code></td><td>Yes</td><td>DataOS FQDN, for example <code>example.dataos.io</code>.</td></tr><tr><td><code>dpName</code></td><td><code>string</code></td><td>Yes</td><td>Data Product name, for example <code>b2b_saas</code>.</td></tr><tr><td><code>accessToken</code></td><td><code>string</code></td><td>Yes</td><td><a href="/pages/7rh6mFCr0rhl6vO76XjW#get-a-dataos-api-token">DataOS API token</a>.</td></tr><tr><td><code>tenant</code></td><td><code>string</code></td><td>Yes</td><td>Tenant name, for example <code>public</code>.</td></tr></tbody></table>

## Query example

```typescript
const stmt = await client.query.submitStatement({
  sql: "SELECT order_id, total FROM orders LIMIT 100",
});

const terminal = new Set(["SUCCESS", "FAILED", "CANCELLED", "SUCCEEDED"]);
let detail = await client.query.getStatement(stmt.id);

while (!terminal.has(detail.status?.toUpperCase() ?? "")) {
  await new Promise((resolve) => setTimeout(resolve, 2000));
  detail = await client.query.getStatement(stmt.id);
}

const result = await client.query.getStatementResult(stmt.id);
console.log(result.cols);
for (const row of result.rows ?? []) {
  console.log(row);
}
```

## API groups

<table><thead><tr><th width="179.36798095703125">Group</th><th>Access via</th></tr></thead><tbody><tr><td>Metadata</td><td><code>client.metadata</code></td></tr><tr><td>Query</td><td><code>client.query</code></td></tr><tr><td>Activity</td><td><code>client.activity</code></td></tr><tr><td>Data Quality</td><td><code>client.dq</code></td></tr><tr><td>Quality (legacy)</td><td><code>client.quality</code></td></tr><tr><td>Perspectives</td><td><code>client.perspectives</code></td></tr><tr><td>Notifications</td><td><code>client.notifications</code></td></tr><tr><td>Followers</td><td><code>client.followers</code></td></tr></tbody></table>

## Troubleshooting

The SDK raises `VulcanAPIError` for API failures, authentication failures, invalid requests, missing parameters, and unexpected API responses.

```typescript
import { VulcanAPIError } from "vulcan-sdk";

try {
  const plan = await client.activity.getPlan("nonexistent-id");
} catch (error) {
  if (error instanceof VulcanAPIError) {
    console.log(error.statusCode);
    console.log(error.detail);
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/consume/activate/apis/sdk/typescript-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
