OverviewProductsPlatformsAPI ReferenceResources

Quickstart

Create an API key and run one script to schedule a post, send a WhatsApp message, reply to a DM or create an ad campaign.


What do you want to build?

Before you start

  • A Zernio account (sign up).
  • A login for one of the 16 platforms. The example connects LinkedIn.
  • A card only if you connect X (twitter), because X bills every API call. Your first 2 other accounts need none (pricing).

Using a coding agent? Give it this prompt.

Run it

Create an API key

  1. Sign up or log in.
  2. Open API keys and click Create API key.
  3. Copy the key now. Zernio stores a SHA-256 hash of it and never shows it again.

A key is sk_ followed by 64 hex characters (67 in total). Every request to https://zernio.com/api/v1 sends it in the Authorization: Bearer header. The SDKs read it from the ZERNIO_API_KEY environment variable.

Install the SDK and set the key

Terminal
npm install @zernio/node
export ZERNIO_API_KEY="sk_..."

Create one key per app and rotate keys through the API.

Go, Ruby, Java, PHP, .NET and Rust SDKs are on the SDKs page.

Run the script

Save this as quickstart.mjs (Node.js) or quickstart.py (Python) and run it.

It prints a URL, waits while you approve the account in a browser, then schedules the post.

quickstart.mjs
import Zernio from '@zernio/node';
import { createInterface } from 'node:readline/promises';

const zernio = new Zernio(); // reads ZERNIO_API_KEY

// 1. A profile groups accounts: one per brand, or one per user of your app.
const { data: created } = await zernio.profiles.createProfile({
  body: { name: 'My first profile' }
});

const profileId = created.profile._id;

// 2. Get the URL where the account owner authorizes Zernio, and approve it.
const { data: connect } = await zernio.connect.getConnectUrl({
  path: { platform: 'linkedin' },
  query: { profileId }
});

console.log('Open this URL and approve:', connect.authUrl);
const prompt = createInterface({ input: process.stdin, output: process.stdout });
await prompt.question('Press Enter once the account is connected ');
prompt.close();

// 3. Posts target accounts by _id, not by username.
const { data: listed } = await zernio.accounts.listAccounts();

const accountId = listed.accounts[0]._id;

// 4. Schedule the post. scheduledFor is read in the timezone you send.
const { data: scheduled } = await zernio.posts.createPost({
  body: {
    content: 'Hello world. This is my first post from the Zernio API.',
    scheduledFor: '2027-01-01T12:00:00',
    timezone: 'America/New_York',
    platforms: [
      { platform: 'linkedin', accountId }
    ]
  }
});

const postId = scheduled.post._id;

// 5. Read it back: scheduled now, published after the scheduled time.
const { data: fetched } = await zernio.posts.getPost({
  path: { postId }
});

console.log(fetched.post.status);
Terminal
node quickstart.mjs

The last line it prints is scheduled.

What just happened

  • A profile was created. A profile groups accounts: one per brand, or one per user of your app.
  • An account was connected to it. GET /v1/connect/{platform} returned the URL where the account owner authorized Zernio.
  • The script looked up the account id. Posts target accounts by _id, not by username.
  • A post was scheduled. POST /v1/posts took the content, the time, the timezone and one platforms entry.
  • The status was read back. It is scheduled until the scheduled time, then publishing, then published.

Every id is a 24-character string in an _id field. Each call returns the id the next one needs.

If your users connect their own accounts, the calls are the same with one profile per user: read Build a platform after your first post.

The calls, one by one

The connecting accounts guide covers the connect call for every platform, and the API reference has each call with its response: create a profile, list accounts, create a post and get a post.

If it fails

A 409 means the same content is already scheduled or was posted to this account in the last 24 hours. Running the script twice causes it:

JSON
{
  "error": "This exact content is already scheduled, publishing, or was posted to this account within the last 24 hours.",
  "details": {
    "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
    "platform": "linkedin",
    "existingPostId": "65f1c0a9e2b5af0012ab34cd"
  }
}

Change the content, or send an x-request-id header so a retry returns the original post instead (idempotency).

Every error uses the same envelope, described in error handling.

Next steps

The same key serves the inbox, WhatsApp, phone numbers, ads, broadcasts, workflows, comment-to-DM automations and analytics.

Was this page helpful?

On this page