# Client (/api/client)



```ts
import { Inklet } from "@inklethq/sdk";

const inklet = new Inklet({ pat: process.env.INKLET_PAT! });
```

`Inklet` is an alias of `InkletClient`; both are exported and identical.

## Options [#options]

<SdkType file="client" name="InkletClientOptions" />

| Option      | Default                    | Notes                                                     |
| ----------- | -------------------------- | --------------------------------------------------------- |
| `pat`       | —                          | Personal access token. Required (or `secretKey`).         |
| `secretKey` | —                          | Compatibility alias for `pat`. Do not pass both.          |
| `baseUrl`   | `https://dev.iminklet.com` | Absolute HTTP(S) URL, no credentials, query, or fragment. |
| `fetch`     | `globalThis.fetch`         | Must match the standard signature.                        |

Construction is validated but makes **no network request**. It throws
`ConfigurationError` for a missing or malformed token, a bad `baseUrl`, both
credentials at once, or a runtime with no `fetch`; and `BrowserEnvironmentError`
if a `document` exists.

## Properties [#properties]

| Property        | Type                                            |
| --------------- | ----------------------------------------------- |
| `baseUrl`       | `string` — normalized, trailing slashes removed |
| `assets`        | [`AssetsResource`](/api/assets)                 |
| `contents`      | [`ContentsResource`](/api/contents)             |
| `displays`      | [`DisplaysResource`](/api/displays)             |
| `presentations` | [`PresentationsResource`](/api/presentations)   |
| `push`          | `PushResource` — see [Pushing content](/push)   |

## Constants [#constants]

```ts
import {
  DEFAULT_INKLET_BASE_URL, // "https://dev.iminklet.com"
  MAX_ASSET_SIZE_BYTES,    // 10485760 (10 MiB)
  MAX_ASSETS_PER_CONTENT,  // 50
  ALLOWED_IMAGE_CONTENT_TYPES,
  ALLOWED_FILE_CONTENT_TYPES,
} from "@inklethq/sdk";
```

## `request()` [#request]

The transport used by every resource is public, for endpoints the typed
resources do not cover yet:

```ts
const data = await inklet.request<MyType>("/api/sdk/v1/displays");
```

<SdkType file="client" name="InkletRequestOptions" />

Pass `json` to send a JSON body — it sets `content-type` and serializes for
you. Passing both `json` and a non-null `body` throws.

Every request automatically carries `authorization: Bearer …` and
`accept: application/json`, and sets `redirect: "error"`.

<Callout type="warn">
  Paths must be relative to `baseUrl`. Absolute URLs, protocol-relative paths
  (`//host`), backslashes, and anything resolving to a different origin throw
  `ConfigurationError` rather than being sent.
</Callout>

Responses are parsed as JSON when the content type says so; `204`, `205`, `HEAD`,
and empty bodies resolve to `undefined`. Non-JSON bodies resolve as text.

## API surface [#api-surface]

All typed resources sit under one prefix:

```text
/api/sdk/v1
```

| Method | Path                                  |
| ------ | ------------------------------------- |
| `GET`  | `/displays`                           |
| `GET`  | `/displays/{id}`                      |
| `GET`  | `/displays/{id}/queue`                |
| `GET`  | `/displays/{id}/current-presentation` |
| `GET`  | `/presentations/{id}`                 |
| `POST` | `/contents`                           |
| `GET`  | `/contents`                           |
| `GET`  | `/contents/{id}`                      |
| `POST` | `/contents/{id}/confirm`              |
| `POST` | `/contents/{id}/upload-tickets`       |
