# Post, read and reply for a customer

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

Everything you do for one customer goes through the posting API, `/v1`. These are the endpoints of the [OmniSocials API](https://docs.omnisocials.com/api), called with your Connect key and one extra header that names the customer.

The examples use the sandbox address. For live, use `https://api.omnisocials.com` with a live key.

## The customer header

Name the customer on every `/v1` call:

```text
OmniSocials-Customer: cust_…
OmniSocials-Customer: ext:hc-1042
```

`ext:` takes your own id, the `external_id` you gave the customer. The call then works on that customer's accounts, posts, media and statistics only.

Two parts of `/v1` are not open to Connect keys and answer `403 not_available_for_connect`:

- `/v1/webhooks`. Use the webhook endpoints of the Connect API, see [Events and webhooks](https://docs.omnisocials.com/connect/webhooks.md).
- Approval workflows. Keep reviews in your product, see [Review before posting](#review-before-posting).

## Create a post

```bash
curl -X POST https://sandbox-api.omnisocials.com/v1/posts/create \
  -H "Authorization: Bearer $OMNISOCIALS_KEY" \
  -H "OmniSocials-Customer: ext:hc-1042" \
  -H "Content-Type: application/json" \
  -d '{
    "content": { "default": "Fresh croissants at 7." },
    "channels": ["instagram", "facebook"],
    "media_urls": ["https://cdn.example.com/croissants.jpg"],
    "schedule_at": "2026-11-02T07:00:00Z"
  }'
```

- `schedule_at` (ISO 8601, in the future) schedules the post.
- `"publish_now": true`, or `POST /v1/posts/create-and-publish`, publishes it at once.
- Without either, the post is a draft. `"draft": true` with `schedule_at` keeps a draft with a planned time.
- `content` can hold one text per network next to `default`, for example `"instagram": "…"`.
- Media: public `https` URLs in `media_urls`, or upload first and send the ids in `media_ids` (see [Media library](#media-library)).

Read the post back with `GET /v1/posts/{id}`, with the same header. `status` is one of:

| `status` | Meaning |
|----------|---------|
| `draft` | Saved, never publishes on its own |
| `scheduled` | Publishes at `schedule_at` |
| `posting` | Publishing now |
| `published` | Live on every network |
| `failed` | No network took it |
| `warning` | Some networks failed |

A failed network carries the reason. `POST /v1/posts/{id}/retry` tries the failed networks again.

The [Creating posts](https://docs.omnisocials.com/creating-posts.md) guide and the [Posts reference](https://docs.omnisocials.com/api/posts) cover every field.

## A calendar

```bash
curl "https://sandbox-api.omnisocials.com/v1/posts?start_date=2026-11-01&end_date=2026-11-30&limit=100" \
  -H "Authorization: Bearer $OMNISOCIALS_KEY" \
  -H "OmniSocials-Customer: ext:hc-1042"
```

- `start_date` and `end_date` filter on `schedule_at`: the time a post is planned for, or, for a post sent at once, the moment it was sent. Both ends are inclusive.
- With a range, the posts come in calendar order, earliest first.
- `YYYY-MM-DD` is a whole UTC day and `YYYY-MM` a whole month. For your customer's own days, send ISO 8601 datetimes with their offset, such as `2026-11-01T00:00:00+01:00`, with the `+` URL-encoded as `%2B`.
- A draft without a date never matches. A draft with `schedule_at` does. Add `status=scheduled` (or `published`, `failed`) to narrow the list.
- Read every page: `limit` goes up to 100, then send `offset` while `pagination.has_more` is true.

Move a post with `PATCH /v1/posts/{id}` and `{ "schedule_at": "…" }`.

## Media library

- The files, newest first: `GET /v1/media`, with `limit`, `offset`, `folder_id` and `search`.
- Upload: `POST /v1/media/upload` (multipart, field `file`) or `POST /v1/media/upload-from-url` with `{ "url" }`. The answer's `id` goes in `media_ids` on a post.
- Folders: `GET /v1/folders`, and `POST /v1/folders` with `{ "name" }`.
- Delete a file: `DELETE /v1/media/{id}`.

See the [Media guide](https://docs.omnisocials.com/media.md) for formats and sizes, and the [Media](https://docs.omnisocials.com/api/media) and [Folders](https://docs.omnisocials.com/api/folders) reference.

## Statistics

- One or more posts: `GET /v1/analytics/posts?ids=101,102`, or one post with `GET /v1/analytics/posts/{id}`.
- Account numbers, such as followers per day: `GET /v1/analytics/accounts`.
- The customer's connected accounts: `GET /v1/accounts`.

Simulated posts in the sandbox get no statistics. See the [Analytics reference](https://docs.omnisocials.com/api/analytics).

## Comments and DMs

- The newest conversations, comments under a post and DMs: `GET /v1/inbox/conversations`.
- One conversation: `GET /v1/inbox/conversations/{id}/messages`.
- Answer: `POST /v1/inbox/conversations/{id}/reply` with `{ "text": "Thanks!" }`. Add `message_id` to answer one comment in a thread.
- Mark read: `POST /v1/inbox/conversations/{id}/read`.

See the [Inbox guide](https://docs.omnisocials.com/inbox.md) and the [Inbox reference](https://docs.omnisocials.com/api/inbox).

## Comment to DM

On Instagram and Facebook, an automation sends a DM to everyone who comments a keyword under a post:

```bash
curl -X POST https://sandbox-api.omnisocials.com/v1/automations \
  -H "Authorization: Bearer $OMNISOCIALS_KEY" \
  -H "OmniSocials-Customer: ext:hc-1042" \
  -H "Content-Type: application/json" \
  -d '{
    "post_id": "83778183",
    "trigger": { "keywords": ["guide"] },
    "actions": {
      "dm": { "text": "Here is the guide: https://example.com/guide" },
      "public_reply": { "enabled": true, "variations": ["Sent you a DM!"] }
    },
    "limits": { "max_sends": 500 }
  }'
```

- `platform` is `instagram` (the default) or `facebook`.
- Pause or resume with `PATCH /v1/automations/{id}`. Who got a DM: `GET /v1/automations/{id}/events`.
- Meta allows one private reply per comment, within 7 days, and an automatic message only within 24 hours after the person's last DM or button tap. A `follow_up` on the automation sends one more DM inside that window (see [Follow-up](https://docs.omnisocials.com/automations.md#follow-up)).

See the [Automations guide](https://docs.omnisocials.com/automations.md) and the [Automations reference](https://docs.omnisocials.com/api/automations).

## Review before posting

The approval workflows of the OmniSocials app are not open to Connect keys. Keep the review in your product:

1. Create the post as a draft: `POST /v1/posts/create` without `publish_now`. With `"draft": true` and `schedule_at`, it keeps its planned time.
2. When your reviewer approves, `PATCH /v1/posts/{id}` with `{ "draft": false }` schedules it at the stored time, or `POST /v1/posts/{id}/publish` posts it at once.
3. Keep who approved, and any comments, in your own database.

## Differences from the OmniSocials API guides

The guides of the OmniSocials API apply to Connect, with these differences:

- One Connect key works for all your customers. The `OmniSocials-Customer` header picks the customer of each call.
- X posts go through your own X app, so X bills its API use to you. OmniSocials charges no X credits to a Connect account. See [X through your own app](https://docs.omnisocials.com/connect/connect-links.md#x-through-your-own-app).
- The connect links of the Connect API connect social accounts. The dashboard steps in the OmniSocials API guides do not apply.
- Webhooks and approval workflows work as described on this page, not as in those guides.
