# Quick start

From nothing to a post waiting for approval, with `curl`. You need a Postaki workspace on the beta plan, a brand with at
least one connected channel, and to be the workspace owner (only owners create keys).

## 1. Make a key

In the Postaki app open Settings, "For developers", "API keys and webhooks", then "New API key". Give it a name and the scopes it needs:

- `read` sees brands, channels, posts and media.
- `write` creates and changes drafts, uploads media, submits posts for approval and manages webhooks.

Creating a key asks you to confirm your identity again. The key is shown once: copy it now. It looks like
`pk_live_` followed by 8 characters, an underscore and 32 more. Only a hash is stored, so a lost key cannot be shown
again: revoke it and make a new one.

```bash
export POSTAKI_KEY="pk_live_xxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
```

## 2. Check that it works

```bash
curl https://app.postaki.io/api/v1/me -H "Authorization: Bearer $POSTAKI_KEY"
```

The answer names the workspace, the role the key acts with, its scopes, the plan limits and what is left of today's
allowances. The key acts as the person who made it, with that person's current role.

## 3. Find the brand and the channel

```bash
curl https://app.postaki.io/api/v1/brands -H "Authorization: Bearer $POSTAKI_KEY"
curl https://app.postaki.io/api/v1/brands/12/channels -H "Authorization: Bearer $POSTAKI_KEY"
```

Each channel comes with its `capabilities`: formats, media rules, limits and the `options` it accepts, with allowed
values. See [Concepts](https://postaki.io/docs/concepts/) and the platform pages, for example [YouTube](https://postaki.io/docs/platform-youtube/) and
[TikTok](https://postaki.io/docs/platform-tiktok/).

## 4. Check a post without saving it

`POST /posts/validate` takes exactly what `POST /posts` takes and saves nothing. Use it as the dry run.

```bash
curl https://app.postaki.io/api/v1/posts/validate \
  -H "Authorization: Bearer $POSTAKI_KEY" -H "Content-Type: application/json" \
  -d '{
    "brand_id": 12,
    "text": "Fresh bread every morning from 7.",
    "ai_generated": false,
    "scheduled_at": "2026-12-01T09:00:00+02:00",
    "channels": [{"channel_id": 345}]
  }'
```

`ai_generated` is required: leave it out and you get 422 `required`. Times are RFC 3339 with an offset
(`+02:00` or `Z`); a time without an offset is refused with 422 `naive_datetime`.

## 5. Create the post and send it for approval

```bash
curl https://app.postaki.io/api/v1/posts \
  -H "Authorization: Bearer $POSTAKI_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1d1c1e-2b0b-4c3e-9a55-0d6a3f0e8a11" \
  -d '{
    "brand_id": 12,
    "text": "Fresh bread every morning from 7.",
    "ai_generated": false,
    "scheduled_at": "2026-12-01T09:00:00+02:00",
    "submit": true,
    "channels": [{"channel_id": 345}]
  }'
```

Without `"submit": true` the post stays a draft. With it, and a `scheduled_at` in the future, the post goes to
"Awaiting approval", the approvers of the workspace are told, and the answer carries `approval_url`.

Use a new `Idempotency-Key` for every intended action and reuse it only to retry that same action: a retry after a
timeout then returns the first answer instead of making a second post. See [Idempotency](https://postaki.io/docs/idempotency/).

## 6. A person approves

Open `approval_url` (or the post in the Postaki app). A person with the approver role reads the post and approves it.
Postaki records who approved, when and on which device, and publishes at the scheduled time. Nothing in the API can do
this step, whatever the scope.

## 7. Follow it

Poll `GET /posts/{id}` and read each copy's `status` (`awaiting_approval`, `scheduled`, `sent`, `failed`, and so on),
or register a [webhook](https://postaki.io/docs/webhooks/) and get told when it changes.

## Next

- Add photos or video: [Media](https://postaki.io/docs/media/).
- Handle errors and limits: [Errors](https://postaki.io/docs/errors/), [Rate limits](https://postaki.io/docs/rate-limits/).
- Do the same from an AI assistant: [Agent setup](https://postaki.io/docs/agent-setup/).
