Skip to content
Reading with an AI assistant?View as MarkdownOpen in ClaudeOpen in ChatGPT

Guides

Social media TypeScript SDK: generated client libraries

Updated

SkedCast does not publish an installable social media TypeScript SDK, but its REST API is described by an OpenAPI 3.1 document at https://skedcast.com/openapi.json. Generate fully typed TypeScript in one command with openapi-typescript, or a Python, Go, Java or C# client with OpenAPI Generator or Kiota.

Browse docs

What it does#

SkedCast publishes no SDK to npm. Generate a typed client for every route, body and response from the OpenAPI 3.1 document at https://skedcast.com/openapi.json. The client libraries overview explains the choice for non-developers.

Prerequisites#

  • An API key on a plan with API access, kept on a server: never in a browser.
  • Node.js 20 or higher for openapi-typescript. Regenerate to pick up new endpoints and fields.

Social media TypeScript SDK: choose a generator#

Social media TypeScript SDK: choose a generator
ToolLanguagesInstallCommit
openapi-typescript + openapi-fetchTypeScript, JavaScriptNode.js 20 or higher for the generator, and the 6 kB openapi-fetch package at run timeOne generated .d.ts file of types
OpenAPI GeneratorMany, including Python, Go, Java, C# and PHPThe npm wrapper plus Java 11 or higher, or the Docker imageA generated client library
KiotaMany, including C#, Go, Java, PHP, Python, Ruby and TypeScriptThe Kiota tool, and for TypeScript @microsoft/kiota-bundleClient source for only the parts you generated

Requirements read from each tool's documentation on 22 November 2026. Direct REST with curl or fetch needs no generator.

Generate a TypeScript client#

bash
npm install openapi-fetch
npm install --save-dev openapi-typescript
npx openapi-typescript https://skedcast.com/openapi.json -o ./skedcast-api.d.ts
Install openapi-fetch and generate the types.

Make a request#

ts
import createClient from "openapi-fetch";
import type { paths } from "./skedcast-api";

const client = createClient<paths>({
  baseUrl: "https://api.skedcast.com/v1",
  headers: { Authorization: `Bearer ${process.env.SKEDCAST_API_KEY}` },
});

const { data, error } = await client.GET("/clients", {
  params: { query: { limit: 10 } },
});
List clients. Paths are relative to the /v1 base URL. Get a key on the [authentication page](/developers/authentication).
ts
const idempotencyKey = crypto.randomUUID(); // reuse for every retry of this post

const { data, error, response } = await client.POST("/posts", {
  params: { header: { "Idempotency-Key": idempotencyKey } },
  body: {
    clientId: "<clientId>",
    content: "Hello world",
    targets: { mode: "selection", accountIds: ["<accountId>"] },
    schedule: { type: "at", scheduledAt: "2030-01-15T15:00:00Z" },
  },
});

if (response.status === 429) {
  const seconds = Number(response.headers.get("Retry-After") ?? "1");
  await new Promise((resolve) => setTimeout(resolve, seconds * 1000));
  // retry the same request with the same idempotencyKey
} else if (error) {
  throw new Error(`SkedCast request failed with status ${response.status}`);
}
Schedule a post and back off on a 429. Every write needs an Idempotency-Key, except `POST /posts/preview`.

Fetch one post by id#

ts
const { data, error } = await client.GET("/posts/{id}", {
  params: { path: { id: postId } },
});

if (error !== undefined) throw new Error(`Could not read the post: ${error.code}`);
The path stays a literal and the id goes in params.path.

Authenticate#

ts
import createClient, { type Middleware } from "openapi-fetch";
import type { paths } from "./skedcast-api";

const auth: Middleware = {
  async onRequest({ request }) {
    request.headers.set("Authorization", `Bearer ${process.env.SKEDCAST_API_KEY ?? ""}`);
    return request;
  },
};

export const client = createClient<paths>({ baseUrl: "https://api.skedcast.com/v1" });
client.use(auth);
A client that sends the API key on every request. Server-side only; pass the `Idempotency-Key` at each write call, not here. OAuth for third-party apps changes only the token: see [OAuth](/developers/oauth).

Handle errors#

ts
const { data, error, response } = await client.GET("/clients", { params: { query: { limit: 10 } } });

if (error !== undefined) {
  throw new Error(`SkedCast returned ${response.status} ${error.code} (correlationId ${error.correlationId})`);
}
console.log(data.data.length);
A failed call leaves `data` undefined; `error` is the problem+json body with a stable `code` and a `correlationId`. The [error catalogue](/developers/data/api-error-catalogue) lists every code.

Paginate a list#

ts
const clients = [];
let cursor: string | undefined;

do {
  const { data, error } = await client.GET("/clients", { params: { query: { limit: 100, cursor } } });
  if (error !== undefined) throw new Error(`List failed with code ${error.code}`);
  clients.push(...data.data);
  cursor = data.page.hasMore ? (data.page.nextCursor ?? undefined) : undefined;
} while (cursor !== undefined);
Follow nextCursor until hasMore is false. The paging model is in the [conventions](/developers/conventions).

Other languages#

bash
curl -o skedcast-openapi.json https://skedcast.com/openapi.json
npx @openapitools/openapi-generator-cli generate -i skedcast-openapi.json -g python -o ./skedcast-python
kiota generate -l python -d skedcast-openapi.json -c SkedCastClient -o ./skedcast-kiota
Fetch the document, then generate a Python client with OpenAPI Generator or with Kiota. Send `Authorization: Bearer <key>` and an `Idempotency-Key` on writes as above.
  • API keys and the REST API are included from Studio, and MCP access for AI clients from Solo. See the pricing page for the current plans.

OpenAPI document contents#

OpenAPI document contents
Part of the documentWhat it gives a generated client
serversThe base URL, https://api.skedcast.com/v1.
operationIdA unique name for each operation, such as createPost or listClients.
parametersA required Idempotency-Key header on writes, and cursor and limit query parameters on lists (limit runs from 1 to 100).
securityTwo schemes: ApiKey, an HTTP bearer key, and OAuth2, the authorization code flow with PKCE for third-party apps and agents.
x-required-scopeThe scope an operation needs, for example clients.read on the list of clients.
responsesThe success body, and for 4xx answers a shared problem response with the media type application/problem+json.

Keep types current#

bash
"scripts": {
  "api:types": "openapi-typescript https://skedcast.com/openapi.json -o ./skedcast-api.d.ts",
  "api:check": "openapi-typescript https://skedcast.com/openapi.json -o ./skedcast-api.d.ts --check",
  "test:ts": "tsc --noEmit"
}
Regenerate on purpose, commit the generated file, check in CI, then typecheck. Read `git diff` of the generated file and the [changelog](/developers/changelog) before you merge.

TypeScript settings#

json
{
  "compilerOptions": {
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "noUncheckedIndexedAccess": true
  }
}
The compiler options the openapi-typescript and openapi-fetch documentation recommend.

What a generated client does not do#

  • Retries, timeouts and backoff: see conventions.
  • The Idempotency-Key on writes: you pass it at each call.
  • Plan and scope checks: a key with too few scopes gets 403 insufficient_scope; see scopes.
  • Events: results arrive through webhooks, and an AI agent can use the MCP server.

Verify#

POST /posts/preview checks a post without scheduling it and needs no Idempotency-Key. POST /posts/bulk with validateOnly: true dry-runs a batch. Neither checks plan limits or pacing. Fields are in the API reference.

Troubleshoot#

Troubleshoot
AnswerCauseFix
401The key is missing or invalidCheck the header your middleware sets
403 insufficient_scopeThe key lacks a scopeRead x-required-scope for the operation and add it to the key
422 validation_failedThe body is invaliderrors names each bad path and message
429A request budget ran outWait the seconds in Retry-After

Log `response.status`, `error.code` and `error.correlationId`; the `correlationId` identifies the request for support.

Diagram: download the OpenAPI document, generate the types, create the client with your API key, and send typed requests.
From the OpenAPI document to a typed client, in four steps.

Sources#