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

# SDK Reference

> @jedify/sdk — call semantic functions from your app.

`@jedify/sdk` calls [semantic functions](/mcp/builder/semantic-functions) from a running app. Your agent generates this code; this page is the reference for it.

```bash theme={null}
npm install @jedify/sdk
```

```typescript theme={null}
import { Jedify } from '@jedify/sdk';

const jedify = new Jedify({ apiKey: process.env.JEDIFY_API_KEY });

const data = await jedify.call('_COMPLETION_BY_DEPARTMENT', {
  department: 'R&D',
  start_date: '2026-01-01',
  end_date: '2026-06-30',
});
```

<Note>
  Match returned column names exactly. They follow the function's query — often uppercase (`TOTAL_REVENUE`) but not always — and a numeric value can arrive as text, so coerce numbers where you do math.
</Note>

## Configuration

`new Jedify(config)`:

| Option       | Type    | Required | Default                  | Description                     |
| ------------ | ------- | -------- | ------------------------ | ------------------------------- |
| `apiKey`     | string  | Yes      | —                        | Your Jedify API key             |
| `baseUrl`    | string  | No       | `https://api.jedify.com` | API base URL                    |
| `timeout`    | number  | No       | `30000`                  | Request timeout (ms)            |
| `maxRetries` | number  | No       | `3`                      | Retries on 5xx errors           |
| `headers`    | object  | No       | —                        | Custom headers on every request |
| `debug`      | boolean | No       | `false`                  | Verbose logging                 |

Get an API key from [app.jedify.com/settings/api-keys](https://app.jedify.com/settings/api-keys). `baseUrl` defaults to production.

## Methods

### `listFunctions(filters?)`

```typescript theme={null}
const { functions } = await jedify.listFunctions({ search: 'revenue' });
```

### `getSchema(functionName)`

Returns a function's parameters, output columns, and example usage.

```typescript theme={null}
const schema = await jedify.getSchema('_REVENUE_BY_REGION');
```

### `call(functionName, parameters?, options?)`

Runs a function, returns the rows, and throws on error.

```typescript theme={null}
const data = await jedify.call('_REVENUE_BY_REGION', { region: 'US', start_date: '2026-01-01', end_date: '2026-06-30' });
```

Options: `fetchAll` (auto-page), `page` / `limit` (manual paging), `timeout`, `signal` (cancel).

## Errors

`call()` throws typed errors:

| Class                   | Meaning                     |
| ----------------------- | --------------------------- |
| `JedifyExecutionError`  | The query failed to execute |
| `JedifyValidationError` | Invalid parameters          |
| `JedifyHttpError`       | HTTP error (401, 404, …)    |
| `JedifyTimeoutError`    | Request timed out           |
| `JedifyNetworkError`    | Network failure             |

## TypeScript

```typescript theme={null}
interface RevenueRow { REGION: string; TOTAL_REVENUE: number; }
const data = await jedify.call<RevenueRow>('_REVENUE_BY_REGION', {});
```
