> ## Documentation Index
> Fetch the complete documentation index at: https://docs.postinger.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API quickstart

> Verify your key, find an account, and create a draft.

## Create a key

In Postinger, open **API keys** as a project admin. For this guide, select `accounts-read`, `posts-read`, and `posts-write`. Add `media-write` for uploads and `posts-publish` when ready to publish.

Store the customer key in `POSTINGER_API_KEY` using your environment or secret manager, then set the base URL:

```bash theme={null}
export POSTINGER_API_URL=https://api.dev.postinger.dev
```

## Verify access

```bash theme={null}
curl --fail-with-body "$POSTINGER_API_URL/public/v1/auth/session" \
  -H "Authorization: Bearer $POSTINGER_API_KEY"
```

The response identifies the project, key expiry, and effective permissions. It never returns the credential itself.

## Find a connected account

```bash theme={null}
curl --fail-with-body "$POSTINGER_API_URL/public/v1/accounts" \
  -H "Authorization: Bearer $POSTINGER_API_KEY"
```

Use an account's `id` to request `/public/v1/accounts/ACCOUNT_ID/capabilities`. Check `available` and the returned publishing rules before preparing a post.

## Create a draft

```bash theme={null}
curl --fail-with-body "$POSTINGER_API_URL/public/v1/posts" \
  -H "Authorization: Bearer $POSTINGER_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: api-draft-001' \
  -d '{"content":"Hello from the API","targets":[],"mediaIds":[]}'
```

A successful create returns `201` with the post at `data`. Save `data.id`. This example creates an editable draft without targets; follow [media uploads](/guides/media) and [publishing](/guides/publishing) to add an account and publish.

Use a new idempotency key for each new draft. If retrying this exact creation, reuse both the key and the payload.


## Related topics

- [Your first draft](/quickstart.md)
- [CLI quickstart](/cli/quickstart.md)
- [CLI command reference](/cli/commands.md)
- [API overview](/api-reference/overview.md)
- [Verify API credentials and inspect project, expiry and effective permissions](/api-reference/authentication/verify-api-credentials-and-inspect-project-expiry-and-effective-permissions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.