fetch. This example checks your API key, adds a timeout, validates response fields, and supports pagination.
The first-party Threetone TypeScript SDK is planned. No verified installable release has been identified. This example uses built-in Node.js APIs and has no Threetone package installation or import.
Before you start
Use Node.js 24 or later and a personal API key with permission to read agents. SetTHREETONE_API_KEY in your server environment. Do not expose it through a public environment variable or browser bundle.
The .mts example uses Node.js TypeScript support. You do not need an additional HTTP library to run it.
Read a page of agents
Save this aslist-agents.mts. It reads up to 20 agents through List agents.
list-agents.mts
Read the next page
Whenpage.has_more is true and page.next_cursor is a string, pass it to listAgents(apiKey, page.next_cursor). Continue with each newly returned cursor until has_more is false. Keep cursor values unchanged.
page_size accepts 1 to 100 and defaults to 30 when omitted. The example uses 20. Keep any filters unchanged between pages. Use Get agent to inspect one agent’s complete saved configuration.
Troubleshoot a request
For401, check the key and its expiry. For 403, check its permissions and workspace access. For 429, follow Retry-After when supplied. Read Errors and retries before adding automatic retries.
The error context includes the method, path, status, and a JSON-escaped request ID limited to 128 characters. It excludes the key and response body. A connection failure or timeout may have no response status or request ID.
Frequently asked questions
Which Threetone npm package should I install?
Which Threetone npm package should I install?
No verified first-party package release is documented yet. The SDK is planned. This example runs with Node.js and does not install a Threetone package.
Can I run this in a React component?
Can I run this in a React component?
Keep this request on your server because it uses a personal API key. Let browser code call your own authenticated server route.
Does Node.js check the TypeScript types at runtime?
Does Node.js check the TypeScript types at runtime?
No. Node.js removes the supported type syntax when running this file. The explicit response checks validate the fields used by the example. Run your project’s TypeScript checker separately.