Skip to main content
@nylon/sdk is a typed client over the same REST API these docs describe. It has no runtime dependencies, and its types are generated from Nylon’s OpenAPI specification, so they cannot drift from the API.
Node 18+, Bun, Deno, Cloudflare Workers and Vercel’s edge runtime.

Your first post

apiKey defaults to process.env.NYLON_API_KEY, so new Nylon() is enough when that is set.
Server-side only. A key can publish to every social account your organization has connected, so anything shipped to a browser or a mobile app can be read off it.

What the SDK adds over fetch

Everything here is reachable with raw HTTP — these are the parts that are easy to get wrong by hand.
posts.create generates an idempotency_key for you, so a retry after a network blip returns the original post instead of publishing a second time. Retries use exponential backoff with full jitter and honour Retry-After.Supply your own key when the natural one lives in your system, so your retries collapse too:
Branch with instanceof rather than on a string. code is stable; message is for humans.
One class per error code, plus NylonConnectionError and NylonTimeoutError for requests that never arrived.
verifyWebhook signs the raw body, checks the timestamp against a 5-minute tolerance, and compares in constant time — the three things hand-rolled verification usually gets wrong. It is a pure WebCrypto function, so it needs no API key and runs on every supported runtime.
See Webhooks for the payload shapes and the retry schedule.
listAll fetches each page only as you consume it, so a large account holds one page in memory rather than all of it. Breaking out stops the requests.

Resources

Handling a partial failure

A post to four profiles is four independent attempts, and three succeeding while one fails is a normal outcome. Retry only the failed targets — re-sending the whole post would publish it twice on the ones that already worked.

Configuration

Per call, including your own AbortSignal:
Your remaining budget from the most recent response, read from the API’s own headers:

Types

Every schema is exported, generated from the OpenAPI specification:
The raw paths, components and operations are exported too, for reaching past the SDK.

Next

Quickstart

The same first steps in raw HTTP.

API reference

Every endpoint the SDK wraps.

Errors

The error taxonomy behind the typed classes.

Webhooks

Payloads, retries and signature verification.