SDKsAPI

Pick the package that fits your stack

Official SDKs for JavaScript, Python, PHP, Go, Ruby, Java, Kotlin, .NET, Rust, Swift, Dart, Elixir wrap the hosted FoPost API, plus a CLI for scripts and CI. The PHP core and Laravel wrapper are MIT-licensed and can also publish straight from your own server with your own platform credentials. The WordPress plugin connects a self-hosted site to your workspace, and the live OpenAPI spec covers anything else.

npm install @fopost/sdk
import { FoPost } from '@fopost/sdk';

const client = new FoPost({ apiKey: process.env.FOPOST_API_KEY });

const [workspace] = await client.workspaces.list();
const accounts = await client.accounts.list({ workspaceId: workspace.id });

const post = await client.posts.create({
  workspaceId: workspace.id,
  status: 'scheduled',
  scheduleAt: '2026-09-01T09:00:00Z',
  content: [{ text: 'Shipped a new release today.' }],
  accounts: accounts.map((a) => ({ id: a.id })),
});

Install an SDK

TypeScript

@fopost/sdk

Install · npm

npm install @fopost/sdk

Quick start

import { FoPost } from '@fopost/sdk';

const client = new FoPost({ apiKey: process.env.FOPOST_API_KEY! });

const accounts = await client.accounts.list({ workspaceId: '9b2f6c1e-…' });

const post = await client.posts.create({
  workspaceId: '9b2f6c1e-…',
  content: [{ text: 'Hello from the SDK' }],
  accounts: accounts.map((a) => a.id),
});
await client.posts.publish(post.id);

Python

fopost

Install · pip

pip install fopost

Quick start

from fopost import Fopost

client = Fopost()  # reads FOPOST_API_KEY

workspace = client.workspaces.list()[0]
accounts = client.accounts.list(workspace_id=workspace.id)

post = client.posts.create(
    workspace_id=workspace.id,
    content="Hello from Python",
    accounts=[a.id for a in accounts],
)
client.posts.publish(post.id)

Install · Composer

composer require fopost/sdk

Quick start

use Fopost\Sdk\Client;

$client = new Client(); // reads FOPOST_API_KEY

$workspace = $client->workspaces()->list()[0];
$accounts = $client->accounts()->list($workspace->id);

$post = $client->posts()->create(
    workspaceId: $workspace->id,
    content: 'Hello from PHP',
    accounts: array_map(fn ($a) => $a->id, $accounts),
);
$client->posts()->publish($post->id);

Install · Go modules

go get github.com/fopost/fopost-go

Quick start

client, err := fopost.New("") // reads FOPOST_API_KEY

workspaces, err := client.Workspaces.List(ctx)
workspace := workspaces[0]
accounts, err := client.Accounts.List(ctx, workspace.ID)

ids := make([]string, 0, len(accounts))
for _, account := range accounts {
	ids = append(ids, account.ID)
}

post, err := client.Posts.Create(ctx, &fopost.CreatePostRequest{
	WorkspaceID: workspace.ID,
	Accounts:    ids,
	Content:     fopost.Text("Hello from Go"),
})
_, err = client.Posts.Publish(ctx, post.ID, nil)

Ruby

fopost

Install · RubyGems

gem install fopost

Quick start

require 'fopost'

client = Fopost.new # reads FOPOST_API_KEY

workspace = client.workspaces.list.first
accounts = client.accounts.list(workspace_id: workspace.id)

post = client.posts.create(
  workspace_id: workspace.id,
  content: 'Hello from Ruby',
  accounts: accounts.map(&:id)
)
client.posts.publish(post.id)

Install · Gradle

implementation("com.fopost:fopost-java:0.3.0")

Quick start

FoPost client = FoPost.create(System.getenv("FOPOST_API_KEY"));

Workspace workspace = client.workspaces().list().get(0);
List<Account> accounts = client.accounts().list(workspace.id());

Post post = client.posts().create(
        CreatePostParams.of(workspace.id())
                .content("Hello from Java")
                .accounts(accounts.stream().map(Account::id).toList()));

client.posts().publish(post.id());

Install · Gradle

implementation("com.fopost:fopost-kotlin:0.3.0")

Quick start

FoPost(System.getenv("FOPOST_API_KEY")).use { client ->
    val workspace = client.workspaces.list().first()
    val accounts = client.accounts.list(workspace.id)

    val post = client.posts.create(
        CreatePostParams(
            workspaceId = workspace.id!!,
            accounts = accounts.mapNotNull { it.id },
            content = contentOf("Hello from Kotlin"),
        ),
    )
    client.posts.publish(post.id!!)
}

Install · NuGet

dotnet add package FoPost.Sdk

Quick start

using var client = new FoPostClient(Environment.GetEnvironmentVariable("FOPOST_API_KEY")!);

var accounts = await client.Accounts.ListAsync("9b2f6c1e-…");

var post = await client.Posts.CreateAsync(
    workspaceId: "9b2f6c1e-…",
    text: "Hello from the SDK",
    accounts: accounts.Select(account => account.Id));

await client.Posts.PublishAsync(post.Id);

Rust

fopost

Install · Cargo

cargo add fopost

Quick start

let client = Client::from_env()?; // reads FOPOST_API_KEY

let workspaces = client.workspaces().list().await?;
let workspace = &workspaces[0];
let accounts = client.accounts().list(Some(&workspace.id)).await?;
let ids: Vec<_> = accounts.iter().map(|a| a.id.clone()).collect();

let post = client
    .posts()
    .create(&CreatePost::text(&workspace.id, "Hello from Rust").accounts(ids))
    .await?;
client.posts().publish(&post.id, &Default::default()).await?;

Install · Swift Package Manager

.package(url: "https://github.com/fopost/fopost-swift.git", from: "0.3.0")

Quick start

let client = try FoPostClient() // reads FOPOST_API_KEY

let workspace = try await client.workspaces.list()[0]
let accounts = try await client.accounts.list(workspaceID: workspace.id)

let post = try await client.posts.create(
    CreatePostRequest(
        workspaceID: workspace.id,
        accounts: accounts.map(\.id),
        content: .text("Hello from Swift")))

try await client.posts.publish(post.id)

Dart

fopost

Install · pub

dart pub add fopost

Quick start

final client = FoPost(); // reads FOPOST_API_KEY

final workspace = (await client.workspaces.list()).first;
final accounts = await client.accounts.list(workspaceId: workspace.id);

final post = await client.posts.create(
  workspaceId: workspace.id,
  accounts: accounts.map((account) => account.id).toList(),
  content: 'Hello from Dart',
);
await client.posts.publish(post.id);

client.close();

Elixir

fopost

Install · Hex

{:fopost, "~> 0.3"}

Quick start

client = FoPost.new() # reads FOPOST_API_KEY

{:ok, [workspace | _]} = FoPost.Workspaces.list(client)
{:ok, accounts} = FoPost.Accounts.list(client, workspace_id: workspace.id)

{:ok, post} =
  FoPost.Posts.create(client,
    workspace_id: workspace.id,
    content: "Hello from Elixir",
    accounts: Enum.map(accounts, & &1.id)
  )

{:ok, _} = FoPost.Posts.publish(client, post.id)

TypeScript, fully typed

Every endpoint, request body, and response has a type. Autocomplete does the reading.

PHP without an account

The core and Laravel packages run on your server and need no hosted account.

12 languages and a CLI

JavaScript, Python, PHP, Go, Ruby, Java, Kotlin, .NET, Rust, Swift, Dart, Elixir, each published to its own package registry.

TypeScript

The whole API as typed methods

@fopost/sdk covers posts, deliveries, accounts, workspaces, labels, and the AI caption, rewrite, and repurpose helpers. It runs in Node and edge runtimes, retries transient errors, and surfaces rate-limit headers so you can back off. The MCP server is built on it.

Read the SDK docs
Deliveries and account health
const deliveries = await client.posts.deliveries(post.id);
for (const d of deliveries) {
  console.log(d.platform, d.status, d.external_url);
}

const health = await client.accounts.health(accounts[0].id);
console.log(health);

Every resource

One client object, one method per endpoint, typed end to end.

Retries and backoff

Network blips and 429s are retried before an error reaches you.

Same core as MCP

@fopost/mcp uses this SDK, so agent and script behave the same way.

PHP

Publish from PHP with your own credentials

fopost/social-core is a standalone publishing library with an adapter per network and zero framework dependencies. fopost/social-laravel adds a service provider, facade, events, and queue support. Neither talks to the hosted product; you bring platform credentials and it posts directly.

See the PHP packages
composer require fopost/social-laravel
use Fopost\Social\Laravel\Facades\FopostSocial;

$result = FopostSocial::linkedin('Shipped a new release today.');

if ($result->success) {
    logger()->info("Published: {$result->externalUrl}");
}

MIT, on your server

Composer install, no account, no key, no usage limits from us.

Laravel wiring

Config, facade, events, and queued publishing out of the box.

Same formatting rules

Length limits and media handling match the hosted adapters.

WordPress, CLI and OpenAPI

A plugin for WordPress, a live spec for anything else

The WordPress plugin connects a self-hosted site to your workspace with a scoped site token, so posts you compose in FoPost land on the site. For any other language, the OpenAPI spec is served live from the API; point a generator at it and get a client that matches what is deployed today.

Start building
OpenAPI
curl https://api.fopost.com/v1/openapi.json -o openapi.json

npx @openapitools/openapi-generator-cli generate \
  -i openapi.json -g python -o ./client

WordPress plugin

Free in the plugin directory. Paste a site token and publish to your site.

Live spec

GET /v1/openapi.json always describes the running API.

Any language

Any language not covered by an official SDK, through an OpenAPI generator.

SDKs questions, answered

Which packages need an account?

The TypeScript SDK and the MCP server talk to the hosted API, so they need a FoPost account and an API key. The PHP core, Laravel package, and WordPress plugin need neither.

What is the difference between the PHP package and the TypeScript SDK?

The SDK is a client for the FoPost API: you get scheduling, the queue, retries, analytics, and every connected account. The PHP package is a standalone library that posts directly to each network with credentials you supply, and no hosted service is involved.

Is the TypeScript SDK open source?

Yes. It is MIT-licensed and published on npm as @fopost/sdk. The MCP server, @fopost/mcp, is MIT as well.

Does the SDK work in the browser?

It runs anywhere fetch exists, but an API key is a server secret. Call it from a server, an edge function, or a CLI, never from client-side code.

Does the WordPress plugin use the hosted service?

Yes. It is the connector for a self-hosted site: you generate a site token in the plugin, paste it into FoPost, and posts you compose there are created on your site. FoPost for WooCommerce, also in the plugin directory, posts products as they go live, go on sale, or come back in stock.

How do I get a client in another language?

There are official SDKs for JavaScript, Python, PHP, Go, Ruby, Java, Kotlin, .NET, Rust, Swift, Dart, Elixir, each in its own package registry. For anything else, download the OpenAPI spec from the API and run it through the generator for your language; the spec is versioned with the API, so regenerate whenever you upgrade.

Build on the SDKs today

Starting is free and the full API is included. Create a key and make your first call in minutes.

Get your API key