Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Any other operation

Every other fastn API operation from the SDK: by area, by name with call(), for one customer, and with paginate().

The pages before this one cover the common tasks. The SDK also has a method for every other operation of the fastn API that your key can call.

By area

Operations are grouped in areas on the client, and each method has the same name as the operation:

await fastn.orgs.getTenant({ id: "acme_customer_42" });
await fastn.connections.listConnections({ orgId: "acme_customer_42" });
await fastn.events.listEventSubscriptions();
await fastn.embed.listWidgets();

Some areas: orgs, embed, connections, connectors, unified, events, workflows. Your editor lists every area and method, with typed inputs. fastn.api holds the same areas (fastn.api.orgs is fastn.orgs).

Inputs are one object. Path, query, body and header fields all go in it by name; the SDK puts each where the API expects it.

Wherever an input names a customer (id on the customer routes, orgId elsewhere), pass your own customer id, as above. To run any operation for one customer, call it on fastn.customer("acme_customer_42").api, which fills in the customer for you.

By name: call()

const orgs = await fastn.call("listOrgs", { type: "end_org" });

fastn.call(operationId, input, options) runs any operation by its name. Use it when the name comes from data, for example a list of operations.

For one customer: customer.api

customer.api.<area>.<operation>() runs an operation for one customer. Each call carries your customer id, and on routes that take the customer in the body, the SDK fills that field too.

await customer.api.events.createEventSubscription({ url: "https://hooks.example.com/fastn/events" });

Page through lists: paginate()

paginate(fn, input, options) calls a list operation page after page and yields one row at a time. It stops on a short page, when there is no next cursor, or when the list ignores paging.

Option
Default
Meaning

pageSize

100

Rows per request.

limitKey

limit

The input name for the page size.

offsetKey

offset

The input name for the offset. Set it to null for cursor-only lists.

cursorKey

cursor

The input name for the cursor.

rows

data, data.items, items or records

A function that picks the rows out of an answer.

nextCursor

nextCursor, data.nextCursor, pagination.nextCursor or data.pagination.nextCursor (never cursor)

A function that picks the next cursor out of an answer.

maxPages

1000

A safety cap on pages.

For unified records, page with cursor and hasMore as shown in Unified records.

See HTTP API for the same API over plain HTTP.

Last updated

Was this helpful?