# Test without publishing

> Index of all OmniSocials docs pages: https://docs.omnisocials.com/llms.txt

Every API key starts with `omsk_live_` and works on the real social accounts connected to its workspace. The workspace API has no separate sandbox and no test keys. You test without publishing with these tools:

- **Dry run.** `dry_run: true` on a post create runs every check of a real call and creates nothing.
- **File check.** `POST /media/check` tells you which connected platforms would refuse a file.
- **Drafts.** A draft never publishes on its own.
- **A test workspace and private posts**, for the tests that must publish.

[OmniSocials Connect](https://docs.omnisocials.com/connect/overview.md), the product for partners who post for their own customers, has a full sandbox with test accounts and simulated posts. See [Connect sandbox and live](https://docs.omnisocials.com/connect/sandbox-and-live.md).

:::caution
A request with `publish_now: true`, `POST /posts/create-and-publish`, `POST /posts/:id/publish`, or a `schedule_at` that you leave in place goes live on real accounts. Treat a test key like a production key. Only `dry_run: true` makes these requests safe.
:::

## Dry run

Add `dry_run: true` to the body of `POST /posts/create` or `POST /posts/create-and-publish`, or add `?dry_run=true` to the URL (`True` works too). The request runs the same checks as a real call, in the same order, and stops before it stores anything.

```bash
curl -X POST https://api.omnisocials.com/v1/posts/create \
  -H "Authorization: Bearer $OMNISOCIALS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Our winter menu is here",
    "accounts": ["instagram", "linkedin"],
    "media_ids": ["482913"],
    "schedule_at": "2026-12-01T09:00:00Z",
    "tags": ["Winter menu"],
    "dry_run": true
  }'
```

A request that passes answers `200` (a real create answers `201`). `data` says what the real call would create:

```json
{
  "data": {
    "dry_run": true,
    "valid": true,
    "status": "scheduled",
    "type": "post",
    "schedule_at": "2026-12-01T09:00:00.000Z",
    "accounts": [
      {
        "platform": "instagram",
        "type": "post",
        "publish": "scheduled",
        "schedule_at": "2026-12-01T09:00:00.000Z",
        "content": "Our winter menu is here",
        "media": [{ "id": "482913", "url": "https://cdn.omnisocials.com/file/library-omnisocials/.../menu.jpg", "crop": "4:5" }]
      },
      {
        "platform": "linkedin",
        "type": "post",
        "publish": "scheduled",
        "schedule_at": "2026-12-01T09:00:00.000Z",
        "content": "Our winter menu is here",
        "media": [{ "id": "482913", "url": "https://cdn.omnisocials.com/file/library-omnisocials/.../menu.jpg" }]
      }
    ],
    "tags": { "ids": [], "new_names": ["Winter menu"] }
  },
  "warnings": [
    {
      "code": "image_fit",
      "platform": "instagram",
      "action": "would_crop",
      "message": "Instagram: This image is 9:16. Instagram shows feed images between 4:5 and 1.91:1, and Meta cannot boost a feed post outside that range. The real call crops it to 4:5 around the subject. To send the original, pass media_fit: { \"instagram\": \"keep\" }."
    }
  ]
}
```

- `status` is the status the post would get: `draft`, `scheduled`, `posting` (published right away) or `in_approval`.
- Each entry of `accounts` has `publish`: `now`, `scheduled`, `after_approval` or `draft`, the text the account would get, and its media. A media item with `crop` is posted as a crop at that ratio. Also `thread_parts` (the number of posts in a thread) and `first_comment` when set.
- `approval_workflow` (with `approval_workflow_id`), `tags` (the tag ids that exist and the names the real call would create) and `comment_dm_automation` (the channels that would get one) show when the request has them.
- `warnings` has the same notices as the real call, plus `media_urls_not_fetched` and `draft_not_checked` (see below).

A request that fails a check answers exactly what the real call answers: the same status and the same `error` body, for example `400 validation_error` for a caption over a platform's limit or `400 platform_not_connected` for an account that is not connected. Send the same request without `dry_run` to create the post.

`dry_run` must be a boolean: `"true"`, `1` or `null` answer `400 validation_error`, and so does a query value other than `true` or `false` (any case). A value the API cannot read is never treated as `false`.

Only post creation has a dry run. `PATCH /posts/:id`, `DELETE /posts/:id`, `POST /posts/:id/publish`, `/retry`, `/approve` and `/reject` refuse a request with `dry_run` (`400 validation_error`) and change nothing, so a test that sends it there never acts for real.

### What a dry run checks

Everything a real create checks before it stores the post:

- the key and its `posts:write` scope, the rate limit and the subscription;
- the size of every text, the format of every field, the post type for each platform;
- that each account is connected to the workspace;
- `media_ids`: each file exists in the workspace's library and is ready;
- `schedule_at` in the future, `draft`, `publish_now` and `approval_workflow_id` (the workflow exists and every step has an approver);
- for a post you schedule or publish: the character limits, the required media, the number and mix of media, video length and size, file type and size per platform, the aspect ratio (an image the real call crops is checked as that crop), Pinterest carousel ratios, the Google Business location, Threads permissions, and the credits an X post with a link needs;
- polls, thread parts, hashtag sets, tags (a new tag name is checked, not made) and the comment-to-DM settings.

### What a dry run never does

A dry run stores no post, draft, media file, image crop, tag, approval or comment-to-DM automation. It does not download `media_urls`, queue a publish, call a social network, send a webhook, use credits, or notify approvers.

It is still an API request: it counts toward the [rate limit](https://docs.omnisocials.com/rate-limits-and-errors.md), it is logged like every other request, and it marks the key as used.

### What a dry run does not check

- **The files behind `media_urls`.** Their address and file extension are checked, the files are not downloaded. The real call downloads each file and can still refuse it (unreachable, too large, wrong type, a video too long for a platform). A PDF becomes one image per page only in the real call. The answer carries the warning `media_urls_not_fetched` and marks each such item `not_fetched: true`. To check a file first, send its `url` to `POST /media/check`, or upload it and pass its `media_ids`.
- **The image crop itself.** The crop is not made. It is checked by the type and pixel size it will have; its file size, and a crop that fails to render, are not checked. The Pinterest carousel ratio check uses the crop's size too.
- **Drafts.** A draft skips the platform checks in a real call, so it skips them in a dry run too (warning `draft_not_checked`). Add `schedule_at` or `publish_now` to the dry run to check them.
- **Changes after the dry run.** An account that disconnects, a file that is deleted or a credits balance that another post uses before your real call, and a database fault during the real write.
- **The platform.** A network can still refuse a post when it publishes: an account restriction, a rate limit on its side, a rule it does not publish. See [Known issues](https://docs.omnisocials.com/known-issues.md).

### Dry run in the MCP server

The hosted MCP server (`mcp.omnisocials.com`) takes `dry_run` on `create_post` and `create_and_publish_post`. The result says "Dry Run: Nothing Was Created" and lists the accounts and warnings. `update_post`, `delete_post`, `publish_post`, `retry_post`, `approve_post` and `reject_post` refuse `dry_run: true` with an error and change nothing. The npm package `@omnisocials/mcp-server` takes it from its next release. The SDKs and the CLI have no `dry_run` option yet: send the request to the REST endpoint.

## Check a file

`POST /media/check` checks one file against the platforms connected to the workspace and stores nothing. Pass a public `url` (its size and type are read with a HEAD request), a `media_id` of a library file, or `size_bytes` with `mime`. The answer lists the platforms that would refuse the file and why, and for an image how each channel shows it as a feed post (`fit`). It needs the `media:read` scope. See [Media](https://docs.omnisocials.com/media.md#check-compatibility-before-posting).

## Use a test workspace

Every API key belongs to one workspace. You pick it in the **Workspace** field when you create the key under **Settings → API**, and the key only sees that workspace's accounts, posts and media.

1. Create a workspace for testing in the dashboard and connect test accounts to it.
2. Create a key for that workspace, with only the scopes your tests need.
3. Check the target before a test run: `GET /accounts` returns `workspace_id` and `workspace_name`.

A workspace is part of your subscription, see [Billing](https://docs.omnisocials.com/billing.md#how-the-subscription-is-structured). A trial has full API access. When a trial or subscription lapses, requests fail with `402 subscription_inactive` until it is reactivated.

Webhooks you create with a key only receive events for that key's workspace, so test deliveries stay apart from production ones.

## Post to accounts you can test on

Some tests must publish: the webhook events `post.published` and `post.failed`, or how a post looks on the platform. Connect social accounts that exist for testing, not your brand's main accounts. A few channels can keep a test post out of public view:

| Channel | How to keep a test post private |
|---------|----------------------------------|
| `tiktok` | `tiktok.privacy_level: "SELF_ONLY"` |
| `youtube` | `youtube.privacy_status: "private"` or `"unlisted"` |
| `pinterest` | Pin to a secret board. The `boards` array of `GET /accounts/:id` includes secret boards |
| `telegram` | Connect a channel or group that only your team is in |
| `discord` | Connect a channel in a test server that only your team is in |

The other channels have no visibility option in the API, so a test post there is public on that account. Mastodon posts are always public, and Threads accounts must be public profiles to connect.

## Drafts never publish

Every post is a draft unless the request has `publish_now` or `schedule_at`. The scheduler only picks up scheduled posts and posts sent with `publish_now`, so a draft never publishes on its own. You can create, read, update and delete drafts as often as you like:

```bash
curl -X POST https://api.omnisocials.com/v1/posts/create \
  -H "Authorization: Bearer $OMNISOCIALS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": { "default": "Integration test" },
    "accounts": ["your-account-id"],
    "source": "integration-test"
  }'
```

A [planned draft](https://docs.omnisocials.com/creating-posts.md#planned-drafts) (`draft: true` with `schedule_at`) keeps its time on the dashboard calendar and still never publishes.

:::tip
Drafts skip most per-platform checks: character limits, media rules, Pinterest carousel ratios and the X credits check run when a post is scheduled or published. To run those checks without publishing, send the request with `schedule_at` and `dry_run: true`.
:::

Scheduling for real has side effects of its own: it fires `post.scheduled` to your webhooks, and a scheduled X post with a link reserves its credits until it publishes. A dry run does neither.

For a human safety net, attach an [approval workflow](https://docs.omnisocials.com/creating-posts.md#approval-workflows): the post waits as `in_approval` and publishes only after the last step approves it.

## Clean up test posts

- `DELETE /posts/:id` removes a post from OmniSocials. On a scheduled post it cancels the publish.
- It never deletes a live post on a platform. To take one down, use "Delete from [platform]" on the post in the dashboard (every platform except Instagram and TikTok, whose APIs have no delete) or delete it in the platform's app. Telegram allows removal only in the first 48 hours.
- Label test posts with `source` (a free-form string, returned on every post) so a cleanup script can find them. `GET /posts` has no `source` filter, so filter the list on your side.

## Test webhooks

Webhook URLs must use HTTPS and resolve to a public host; private and loopback addresses are refused with `validation_error`. Two ways to receive test deliveries:

- **A request bin.** Register the URL of a request inspection service as a webhook. It shows each delivery's raw body and headers (`X-OmniSocials-Signature`, `X-OmniSocials-Delivery` and the rest), which is what you need to check your signature code.
- **A tunnel to your machine.** Expose your dev server with `cloudflared tunnel` or `ngrok http 3000` and register the tunnel URL.

The workspace API has no endpoint that sends a test event (Connect has one for its own webhook endpoints, see [Connect webhooks](https://docs.omnisocials.com/connect/webhooks.md#send-a-test-event)). A dry run sends no event. Trigger real events without publishing anything:

| Event | How to trigger it in a test |
|-------|-----------------------------|
| `post.scheduled` | Create a post with `schedule_at` in the future through the API, then delete it |
| `post.approved`, `post.rejected` | Create a post with `approval_workflow_id` and a future `schedule_at`, approve or reject it, then delete it. An approved post publishes at its time |
| `post.published`, `post.failed` | These need a real publish. Use a private test post from the table above |

After a run, `GET /webhooks/:id` shows `failure_count` and `last_failure` for deliveries your endpoint did not accept. See [Webhooks](https://docs.omnisocials.com/webhooks.md) for the payloads and signature verification.

## Mind the limits

- The rate limit is 100 requests per minute per key, dry runs included. Give tests their own key, so a test run never uses up the production key's budget. See [Rate limits and errors](https://docs.omnisocials.com/rate-limits-and-errors.md).
- Each workspace can send 1,000 inbox replies per 24 hours, and every reply goes to a real person.
- X posts with a link cost 20 credits each when they publish, in tests too. A dry run uses none. Test X with link-free text unless the link is what you are testing.
- YouTube's daily API quota is shared by every OmniSocials customer. Keep YouTube test uploads few.

## Postman and OpenAPI

- **Postman collection:** import [omnisocials.postman_collection.json](https://docs.omnisocials.com/omnisocials.postman_collection.json) into Postman and add your API key as the Bearer token.
- **OpenAPI file:** [openapi.json](https://docs.omnisocials.com/openapi.json) describes every endpoint. Use it to generate a client, import it into another API tool, or validate responses in contract tests. The dry-run answer is the schema `PostDryRun`.

The [CLI](https://docs.omnisocials.com/cli.md) is handy for scripted checks too: every command takes `--json`.
