Client
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
interface InkletClientOptions {
pat?: string;
secretKey?: string;
baseUrl?: string;
fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
}| 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
| Property | Type |
|---|---|
baseUrl | string — normalized, trailing slashes removed |
assets | AssetsResource |
contents | ContentsResource |
displays | DisplaysResource |
presentations | PresentationsResource |
push | PushResource — see Pushing content |
Constants
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()
The transport used by every resource is public, for endpoints the typed resources do not cover yet:
const data = await inklet.request<MyType>("/api/sdk/v1/displays");interface InkletRequestOptions extends Omit<RequestInit, "body" | "headers" | "redirect"> {
headers?: HeadersInit;
body?: BodyInit | null;
json?: unknown;
}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".
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.
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
All typed resources sit under one prefix:
/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 |