Skip to content

createClient

Create an authenticated Acme API client for REST and resource helpers.

createClient

Creates an authenticated Acme API client.

createClient
createClient(options: ClientOptions): Client

Parameters#

ParameterTypeDescription
apiKey *stringSecret API key from the Acme dashboard.
baseUrlstringOverride the API base URL. Default: https://api.acme.dev.
timeoutnumberRequest timeout in ms. Default: 30000.

Returns#

Client — an object with resource namespaces (users, projects, webhooks).

Example#

Basic usage
import { createClient } from "@acme/client";

const client = createClient({ apiKey: process.env.ACME_API_KEY! });
await client.ping();

Errors#

| Code | Status | When | | ----------------- | ------ | ------------------------------- | | invalid_api_key | 401 | API key is missing or revoked | | rate_limited | 429 | Too many requests in the window |

See also#