# Connect quickstart: a test customer and a test post

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

This guide takes you from a sandbox key to a published test post for one customer. Everything runs in the sandbox: the account that connects is a test account, and the post is simulated. Nothing reaches a real social account.

## Before you start

- Access to the Connect console. Connect is in a private beta, see [Overview](https://docs.omnisocials.com/connect/overview.md).
- A sandbox key. Create it in the console under **API keys**, after you confirmed your email address. Sandbox keys start with `omsk_org_test_`.

Keep the key on your server, in an environment variable:

```bash
export OMNISOCIALS_KEY="omsk_org_test_<YOUR_KEY>"
```

## 1. Create a customer

Create one customer per customer of yours. Use your own id as `external_id`, so you can name the customer as `ext:<your id>` from then on.

```bash
curl -X POST https://sandbox-api.omnisocials.com/connect/v1/customers \
  -H "Authorization: Bearer $OMNISOCIALS_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "name": "Harbor Coffee", "external_id": "hc-1042" }'
```

The answer is the customer: `{ "id": "cust_…", "external_id": "hc-1042", "name": "Harbor Coffee", … }`.

Send an `Idempotency-Key` on every `POST` to `/connect/v1`. A retry with the same key returns the first answer, so a dropped connection never creates the customer twice.

## 2. Create a connect link

```bash
curl -X POST https://sandbox-api.omnisocials.com/connect/v1/customers/ext:hc-1042/connect-links \
  -H "Authorization: Bearer $OMNISOCIALS_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "platforms": ["instagram", "facebook"],
    "return_url": "https://app.example.com/settings/social"
  }'
```

The answer holds the link: `{ "id": "cl_…", "url": "https://connect.omnisocials.com/c/…", "expires_at": "…" }`. Without `expires_in`, the link works for one hour.

## 3. Connect a test account

Open `url` in your browser. The page says it is the sandbox. Pick Instagram, then Facebook: in the sandbox each one connects a test account at once, without a sign-in.

Press **Done**. The page sends you to your `return_url` with the outcome:

```text
https://app.example.com/settings/social?status=connected&connected=instagram,facebook&customer=cust_…&external_id=hc-1042&connect_link_id=cl_…
```

The example return URL does not exist, but the address bar shows what your page would receive.

## 4. List the customer's accounts

```bash
curl https://sandbox-api.omnisocials.com/connect/v1/customers/ext:hc-1042/accounts \
  -H "Authorization: Bearer $OMNISOCIALS_KEY"
```

Each account has `platform`, `username`, `display_name`, `picture` and `status`. Both test accounts are `active`.

## 5. Send a test post

Posts go to the posting API (`/v1`) with the customer in the `OmniSocials-Customer` header:

```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": ["facebook"],
    "publish_now": true
  }'
```

Instagram needs a picture or a video. To post there too, add `"instagram"` to `channels` and a public `https` image in `"media_urls"`.

Take the post's `id` from the answer and read the post back:

```bash
curl https://sandbox-api.omnisocials.com/v1/posts/<id> \
  -H "Authorization: Bearer $OMNISOCIALS_KEY" \
  -H "OmniSocials-Customer: ext:hc-1042"
```

`status` moves from `posting` to `published`. The sandbox simulates the publish: no network is called.

## Next steps

- Make a post fail on purpose with a [test word in the caption](https://docs.omnisocials.com/connect/sandbox-and-live.md#test-a-failure).
- Add a [webhook endpoint](https://docs.omnisocials.com/connect/webhooks.md) and send it a test event.
- Build the connect button in your product: [Customers and connect links](https://docs.omnisocials.com/connect/connect-links.md).
- Schedule posts, read statistics and answer comments: [Posting for a customer](https://docs.omnisocials.com/connect/posting.md).
