Skip to content

API Reference

The main client class. All API interactions go through this object.

new AcmeClient(options: ClientOptions)
ParameterTypeRequiredDefaultDescription
apiKeystringYes*Your API key
accessTokenstringYes*OAuth access token
baseUrlstringNoAPI URLCustom API endpoint
timeoutnumberNo30000Request timeout in ms
maxRetriesnumberNo3Max retry attempts
retryDelaynumberNo1000Base retry delay in ms

Returns a paginated list of resources.

const result = await client.resources.list({
limit: 20,
cursor: undefined,
filter: { status: "active" },
});

Parameters:

ParameterTypeRequiredDescription
limitnumberNoItems per page (max 100)
cursorstringNoPagination cursor
filterobjectNoFilter criteria

Returns: PaginatedResponse<Resource>


Retrieves a single resource by ID.

const resource = await client.resources.get("res_abc123");

Parameters:

ParameterTypeRequiredDescription
idstringYesResource ID

Returns: Resource


Creates a new resource.

const resource = await client.resources.create({
name: "My Resource",
type: "standard",
metadata: { key: "value" },
});

Parameters:

ParameterTypeRequiredDescription
namestringYesDisplay name
typestringYesResource type
metadataobjectNoArbitrary key-value pairs

Returns: Resource


Updates an existing resource.

const resource = await client.resources.update("res_abc123", {
name: "Updated Name",
});

Returns: Resource


Deletes a resource. This action is irreversible.

await client.resources.delete("res_abc123");

Returns: void


interface Resource {
id: string;
name: string;
type: "standard" | "premium" | "enterprise";
status: "active" | "archived" | "deleted";
metadata: Record<string, unknown>;
createdAt: string;
updatedAt: string;
}
interface PaginatedResponse<T> {
data: T[];
nextCursor: string | null;
hasMore: boolean;
total: number;
}
interface AcmeError {
code: string;
message: string;
status: number;
requestId: string;
}