Developer8 min readApr 3, 2026

CodivUpload TypeScript SDK — Publish to 12 Platforms with Full Type Safety

Raw HTTP calls to a social media API mean hand-typing URLs, remembering header formats, and parsing untyped JSON responses. The CodivUpload TypeScript SDK replaces all of that with typed methods like codiv.posts.create() that autocomplete every parameter, every platform override, and every response field. Four lines of code to publish a video to TikTok and Instagram simultaneously.

Install

The SDK is published on npm as codivupload. It works in Node.js 18+, Bun, Deno, and any TypeScript project. Zero dependencies beyond the runtime's built-in fetch.

npm
npm install codivupload
yarn
yarn add codivupload
pnpm
pnpm add codivupload

Quick start — 4 lines to publish

Get an API key from your CodivUpload dashboard, initialize the client, and call posts.create(). That's it. The SDK handles authentication, serialization, and error parsing.

publish.ts
import CodivUpload from "codivupload";

const codiv = new CodivUpload("cdv_your_api_key");

const post = await codiv.posts.create({
  platforms: ["tiktok", "instagram"],
  description: "Hello world!",
  media_urls: ["https://cdn.example.com/video.mp4"],
});

console.log(post.id, post.status);
// "post_a1b2c3d4" "queued"

The response is fully typed. post.id is a string, post.platforms is a string[], post.status is a union type. Your editor catches mistakes before your code runs.

Why an SDK instead of raw HTTP?

You can absolutely call the CodivUpload REST API directly with fetch or Axios. Nobody is stopping you. But here's what you're signing up for:

Raw fetch — 10 lines

const res = await fetch(
  "https://api.codivupload.com/v1/posts",
  {
    method: "POST",
    headers: {
      "Authorization": "Bearer cdv_...",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      platforms: ["tiktok"],
      description: "Hello",
      media_urls: ["https://..."],
    }),
  }
);
const data = await res.json();
// data is `any` — no autocomplete

SDK — 4 lines

const codiv = new CodivUpload("cdv_...");

const post = await codiv.posts.create({
  platforms: ["tiktok"],
  description: "Hello",
  media_urls: ["https://..."],
});
// post is typed — full autocomplete

Autocomplete and type safety

Every parameter, every platform override, every response field is typed. Your editor tells you that tiktok_privacy_level accepts "public", "friends", or "self" before you even check the docs.

Structured error handling

The SDK throws CodivUploadError with .status and .message properties. No more checking res.ok, parsing JSON, and guessing what went wrong.

Zero auth boilerplate

Pass your API key once in the constructor. Every subsequent call is authenticated automatically. No repeated headers, no token management.

Platform overrides autocomplete

Fields like tiktok_privacy_level, youtube_category_id, instagram_media_type, and linkedin_visibility all show up in autocomplete. No more guessing parameter names from the docs.

Full API reference

The SDK covers every resource in the CodivUpload API. Here's each one with working examples you can copy straight into your project.

Posts

Create, schedule, list, read, update, and delete posts across any combination of the 9 supported platforms.

posts.ts
// Create — publish immediately
const post = await codiv.posts.create({
  platforms: ["tiktok", "instagram", "youtube"],
  description: "New product drop!",
  media_urls: ["https://cdn.example.com/video.mp4"],
});

// Schedule — publish at a specific time
const scheduled = await codiv.posts.schedule({
  platforms: ["linkedin", "x"],
  description: "Monday motivation.",
  media_urls: ["https://cdn.example.com/carousel.mp4"],
  scheduled_date: "2026-04-05T14:00:00Z",
});

// List — filter by status and paginate
const list = await codiv.posts.list({
  status: "completed",
  limit: 20,
});

// Get — single post by ID
const single = await codiv.posts.get("post_a1b2c3d4");

// Update — modify before it publishes
await codiv.posts.update("post_a1b2c3d4", {
  description: "Updated description",
});

// Delete
await codiv.posts.delete("post_a1b2c3d4");

Profiles

Profiles are the connected social accounts you publish through. List your existing connections, create whitelabel profiles for agency clients, or remove a profile when a client offboards.

profiles.ts
// List all connected profiles
const profiles = await codiv.profiles.list();

// Create a whitelabel profile for a client
const profile = await codiv.profiles.create({
  username: "client_brand",
  profile_name: "Acme Corp",
});

// Delete a profile
await codiv.profiles.delete("uuid-of-profile");

Media

Upload media to CodivUpload's CDN first, then reference the returned URL in your post. This is useful when you want to reuse the same asset across multiple posts or when the original URL is temporary.

media.ts
// Upload from a public URL
const media = await codiv.media.upload(
  "https://example.com/raw-video.mp4"
);

// Use the CDN URL in a post
await codiv.posts.create({
  platforms: ["tiktok", "instagram"],
  description: "Fresh content",
  media_urls: [media.url],
});

Live streaming

Start 24/7 live streams on YouTube with a single API call. The stream runs on CodivUpload's infrastructure — no OBS, no local machine left running overnight.

broadcasts.ts
// Start a looping live stream
await codiv.broadcasts.create({
  profile_name: "my_channel",
  title: "24/7 Lo-fi Radio",
  media_url: "https://cdn.example.com/mix.mp4",
  loop: true,
});

// List active broadcasts
const streams = await codiv.broadcasts.list();

// Stop a broadcast
await codiv.broadcasts.stop("broadcast_id");

Platform-specific overrides

Cross-posting doesn't mean every platform gets identical content. Each platform has unique fields — TikTok's privacy level, YouTube's category ID, Instagram's media type, LinkedIn's visibility. The SDK types all of these as optional top-level parameters. Pass only what you need; everything else uses sensible defaults.

cross-post-with-overrides.ts
await codiv.posts.create({
  platforms: ["tiktok", "instagram", "youtube", "linkedin", "x"],
  description: "Product launch!",
  media_urls: ["https://cdn.example.com/launch.mp4"],

  // TikTok
  tiktok_privacy_level: "public",

  // Instagram
  instagram_media_type: "REELS",

  // YouTube
  youtube_type: "video",
  youtube_privacy_status: "public",
  youtube_category_id: "28",

  // LinkedIn
  linkedin_visibility: "PUBLIC",

  // X (Twitter)
  x_reply_settings: "following",
});

Every override parameter autocompletes in your editor. Hover over tiktok_privacy_level and your IDE shows the valid values: "public" | "friends" | "self". No guessing, no typos, no 422 errors at runtime because you spelled a field wrong.

Error handling

The SDK throws a CodivUploadError for any non-2xx response. The error object includes .status (the HTTP status code) and .message (a human-readable explanation). Use instanceof to catch SDK errors specifically while letting unexpected exceptions bubble up.

error-handling.ts
import CodivUpload, { CodivUploadError } from "codivupload";

const codiv = new CodivUpload("cdv_your_api_key");

try {
  await codiv.posts.create({
    platforms: ["tiktok"],
    description: "Testing error handling",
    media_urls: ["https://cdn.example.com/video.mp4"],
  });
} catch (err) {
  if (err instanceof CodivUploadError) {
    console.error(err.status);  // 422
    console.error(err.message); // "media_urls: URL is not accessible"
  }
}
StatusMeaningWhat to do
401UnauthorizedAPI key is missing or invalid. Check the Authorization header.
403ForbiddenYour plan does not include this endpoint, or the platform is not connected.
404Not FoundThe post or resource ID does not exist, or belongs to another user.
422Validation ErrorA required field is missing or has an invalid value. Check the error message for details.
429Rate LimitedToo many requests. Back off and retry after the Retry-After header value.

SDK vs MCP vs REST API

CodivUpload offers three ways to interact with the platform programmatically. The TypeScript SDK, the MCP server (for AI agents), and the raw REST API. They all hit the same backend. The difference is ergonomics.

SDKMCPREST API
InterfaceTypeScript methodsNatural languageHTTP calls
Best forApps & automationAI agentsAny language
Type safetyFull autocompleteN/AManual
Installnpm install codivuploadnpx codivupload-mcpNone
AuthConstructorEnv variableHeader

Building a Node.js backend, a Next.js app, or a cron job? Use the SDK. Wiring CodivUpload into Claude, ChatGPT, or Cursor? Use the MCP server. Working in Python? Use the official Python SDK (pip install codivupload). Working in Go or another language? Use the REST API directly.

Open Source

Fully open source, auto-generated from the OpenAPI spec

The SDK is generated directly from CodivUpload's OpenAPI specification. When a new platform override or endpoint is added to the API, the SDK updates automatically. No manual sync, no version drift. The types always match what the server accepts.

MIT license

Use it in commercial projects, modify it, fork it — no restrictions

Auto-generated types

Every parameter and response field comes straight from the OpenAPI spec

Community contributions

Issues and PRs welcome — the repo includes a contributing guide

Resources

Get API Key — Start Free

Create your API key in 30 seconds. The free plan includes 50 posts/month across all 12 platforms — enough to test every SDK method.