> 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/references/interfaces/apis/getting-started/sdks/typescript-sdk.md).

# TypeScript SDK

The TypeScript SDK wraps the Data Product API with a typed client built on native `fetch`.

It builds the base URL for you. It also sets `Accept: application/json` on every request.

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

### Install

```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",
});
```

Base URL:

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

### Available clients

<table><thead><tr><th width="218.4482421875">Client</th><th>Methods</th></tr></thead><tbody><tr><td><code>client.metadata</code></td><td><code>.get()</code> · <code>.getSemantic()</code> · <code>.downloadPowerBI()</code> · <code>.downloadTableau()</code></td></tr><tr><td><code>client.activity</code></td><td><code>.listPlans()</code> · <code>.getPlan(id)</code> · <code>.getPlanGitDiff(id)</code> · <code>.listRuns()</code> · <code>.getRun(id)</code> · <code>.listModels()</code> · <code>.getModelRuns(name)</code></td></tr><tr><td><code>client.dq</code></td><td><code>.getSummary()</code> · <code>.listRules()</code> · <code>.getRule(id)</code> · <code>.getRuleByName(model, dim, name)</code></td></tr><tr><td><code>client.query</code></td><td><code>.submitStatement({sql})</code> · <code>.getStatement(id)</code> · <code>.getStatementResult(id)</code> · <code>.submitSemanticRest({query})</code> · <code>.submitSemanticSQL({sql})</code> · <code>.getMetric(name)</code> · <code>.getUsageMetrics()</code></td></tr><tr><td><code>client.perspectives</code></td><td><code>.list()</code> · <code>.get(slug)</code> · <code>.getResult(slug)</code> · <code>.create(slug, body)</code> · <code>.update(slug, body)</code> · <code>.delete(slug)</code> · <code>.checkAvailability(slug)</code></td></tr><tr><td><code>client.notifications</code></td><td><code>.list()</code></td></tr><tr><td><code>client.followers</code></td><td><code>.follow()</code> · <code>.unfollow()</code> · <code>.getFollowStatus()</code> · <code>.list()</code> · <code>.getAnalytics()</code></td></tr></tbody></table>

### Query example

```typescript
const stmt = await client.query.submitStatement({
  sql: "SELECT country, COUNT(*) AS users FROM users GROUP BY 1"
});

const done = new Set(["SUCCESS", "FAILED"]);
let detail = await client.query.getStatement(stmt.id);
while (!done.has(detail.status)) {
  await new Promise(r => setTimeout(r, 2000));
  detail = await client.query.getStatement(stmt.id);
}

const result = await client.query.getStatementResult(stmt.id);
console.log(result.cols);
result.rows.forEach(r => console.log(r));
```

### Error handling

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

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

### Notes

* Uses native `fetch` with zero runtime dependencies.
* Supports Node.js 18+.
* Supports TypeScript 5.0+.
* Supports `AbortSignal` on every method.


---

# 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/references/interfaces/apis/getting-started/sdks/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.
