SDKs & Libraries

There is no OmniPost package to install. The API is plain JSON over HTTPS, so any HTTP client in any language works — fetch in Node.js/browsers, requests in Python, curl from a shell, or an HTTP client generated from an OpenAPI spec.

Every code sample throughout these docs is copy-pasteable and uses only what's already in your language's standard toolchain — no dependency on a published omnipost npm or pip package.

Node.js wrapper

If you're calling OmniPost from more than one place in your codebase, a thin wrapper keeps the base URL, auth header, and error handling in one spot.

// omnipost.js
const BASE_URL = "https://api.omnipost.dev/v1";

class OmniPostError extends Error {
  constructor(code, message, status) {
    super(message);
    this.code = code;
    this.status = status;
  }
}

export function createClient(apiKey = process.env.OMNIPOST_API_KEY) {
  async function request(path, { method = "GET", body, headers } = {}) {
    const res = await fetch(`${BASE_URL}${path}`, {
      method,
      headers: {
        Authorization: `Bearer ${apiKey}`,
        ...(body ? { "Content-Type": "application/json" } : {}),
        ...headers,
      },
      body: body ? JSON.stringify(body) : undefined,
    });

    if (res.status === 204) return null;

    const data = await res.json();

    if (!res.ok) {
      throw new OmniPostError(data.error.code, data.error.message, res.status);
    }

    return data;
  }

  return {
    upload: (body, opts) => request("/upload", { method: "POST", body, ...opts }),
    listPosts: (params = {}) =>
      request(`/posts?${new URLSearchParams(params)}`),
    getPost: (id) => request(`/posts/${id}`),
    listAccounts: (params = {}) =>
      request(`/accounts?${new URLSearchParams(params)}`),
    connectAccount: (platform, body = {}) =>
      request(`/accounts/${platform}/connect`, { method: "POST", body }),
    disconnectAccount: (id) => request(`/accounts/${id}`, { method: "DELETE" }),
    createWebhook: (body) => request("/webhooks", { method: "POST", body }),
  };
}

Usage:

import { createClient } from "./omnipost.js";

const omnipost = createClient();

const post = await omnipost.upload({
  caption: "Shipped with OmniPost",
  media: [{ url: "https://cdn.yourapp.com/hero.jpg", type: "image" }],
  platforms: ["instagram", "x"],
});

console.log(post.id, post.status);

Python wrapper

# omnipost.py
import os

import requests

BASE_URL = "https://api.omnipost.dev/v1"


class OmniPostError(Exception):
    def __init__(self, code, message, status):
        super().__init__(f"{code}: {message}")
        self.code = code
        self.status = status


class OmniPostClient:
    def __init__(self, api_key: str | None = None):
        self.api_key = api_key or os.environ["OMNIPOST_API_KEY"]
        self.session = requests.Session()
        self.session.headers["Authorization"] = f"Bearer {self.api_key}"

    def _request(self, method: str, path: str, **kwargs):
        res = self.session.request(method, f"{BASE_URL}{path}", **kwargs)
        if res.status_code == 204:
            return None
        data = res.json()
        if not res.ok:
            raise OmniPostError(data["error"]["code"], data["error"]["message"], res.status_code)
        return data

    def upload(self, **body):
        return self._request("POST", "/upload", json=body)

    def list_posts(self, **params):
        return self._request("GET", "/posts", params=params)

    def get_post(self, post_id: str):
        return self._request("GET", f"/posts/{post_id}")

    def list_accounts(self, **params):
        return self._request("GET", "/accounts", params=params)

    def connect_account(self, platform: str, **body):
        return self._request("POST", f"/accounts/{platform}/connect", json=body)

    def disconnect_account(self, account_id: str):
        return self._request("DELETE", f"/accounts/{account_id}")

    def create_webhook(self, **body):
        return self._request("POST", "/webhooks", json=body)

Usage:

from omnipost import OmniPostClient

omnipost = OmniPostClient()

post = omnipost.upload(
    caption="Shipped with OmniPost",
    media=[{"url": "https://cdn.yourapp.com/hero.jpg", "type": "image"}],
    platforms=["instagram", "x"],
)

print(post["id"], post["status"])

Other languages

Since the API is standard REST + JSON, it works out of the box with generic HTTP tooling in any language — HttpClient in .NET, net/http in Go, Faraday/Net::HTTP in Ruby, or an OpenAPI-generated client if you maintain a spec internally. See the API Reference for exact request/response shapes to model against.

Shell / curl

For scripts, cron jobs, or quick debugging, every endpoint works directly from a shell:

curl https://api.omnipost.dev/v1/posts \
  -H "Authorization: Bearer $OMNIPOST_API_KEY" | jq