Skip to main content
The official Gumnut TypeScript SDK provides typed requests and responses for server-side TypeScript and JavaScript. It supports TypeScript 4.9 and later and Node.js 20 LTS or later. The generated SDK also supports current web browsers, Deno 1.28+, Bun 1+, Cloudflare Workers, Vercel Edge Runtime, and Nitro 2.6+. React Native and Jest’s jsdom environment are not supported.

Installation

Or with Bun:

Create a client

In Node.js, Bun, and Deno, set GUMNUT_API_KEY in the environment and the client reads it automatically. Do not embed an API key in browser code. For a browser integration, use OAuth or call the SDK through a backend proxy that keeps the API key server-side.
Keep API keys in environment variables or a secrets manager. Never expose an API key in browser code. See API keys for creation and scoping.

Upload and organize a photo

Generated request fields use snake_case, while resource methods use camelCase.
library_id is optional for accounts with one library and required when an account has multiple libraries. Uploads accept an fs.ReadStream, a web File, a fetch Response, or the result of the exported toFile helper. See the generated API reference for the complete parameter types.
Search supports natural-language content queries and structured filters. See Pagination and filtering for the API’s search and filtering behavior.

Pagination

List methods return async-iterable cursor pages. A for await loop fetches subsequent pages as needed.
For explicit page control, use hasNextPage() and getNextPage():

Retries and timeouts

The SDK retries connection errors, HTTP 408, 409, 429, and 5xx responses twice by default. Configure retries and the timeout on the client:

Error handling

All SDK errors extend Gumnut.APIError. HTTP failures expose a status code; connection failures use APIConnectionError subclasses.

Reference