---
name: kickline-api
description: Use when the user wants to make, schedule, list or cancel social posts through kickline — "generate a post", "what is scheduled", "schedule that for Friday", "cancel the Tuesday post", "how many credits are left". Drives the kickline v1 HTTP API with a bearer key.
---

# kickline API

kickline turns a brand's own positioning into short-form social posts. This skill drives its HTTP
API: list posts, generate one from a source, schedule it, cancel it.

## Setup

Two things are needed, and you must ask for them rather than guessing:

- `KICKLINE_HOST` — the deployment's origin, e.g. `https://kickline.example.com`
- `KICKLINE_KEY` — an API key, `kk_live_…` or `kk_test_…`, made in the app under
  **Workspace › API**. It is shown once.

A key is scoped to **one workspace**. If the user has several brands, each has its own key.

Never print the key, never write it into a file the user did not ask for, and never put it in a
URL — it goes in the `Authorization` header.

## Start here, always

```bash
curl -s "$KICKLINE_HOST/api/v1/workspace" -H "Authorization: Bearer $KICKLINE_KEY"
```

This confirms the key works, says which workspace it points at, and returns the plan's limits
and the credit balance. Read `credits.available` before generating: a generation costs **10
credits** and will be refused with `402` if there are not enough.

If `billing_enforced` is `false`, `credits` and `limits` are `null` and nothing is metered.

## The four things you can do

### List posts

```bash
curl -s "$KICKLINE_HOST/api/v1/posts?status=scheduled&limit=50" \
  -H "Authorization: Bearer $KICKLINE_KEY"
```

`status` is one of `saved`, `scheduled`, `publishing`, `published`, `failed`, `cancelled`, or
omit it for everything. Paginate by passing the previous response's `next_cursor` back as
`?cursor=`; stop when it is `null`.

One post: `GET /api/v1/posts/{id}`.

### Generate a post

```bash
curl -s "$KICKLINE_HOST/api/v1/sources" -H "Authorization: Bearer $KICKLINE_KEY"

curl -s -X POST "$KICKLINE_HOST/api/v1/posts/generate" \
  -H "Authorization: Bearer $KICKLINE_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"source_id":"SOURCE_ID","prompt":"optional steer, 400 chars max"}'
```

**The `Idempotency-Key` header is required.** Generating costs credits, so a retry without one
would charge twice. Generate a fresh uuid per *intent*, and reuse the same one when retrying that
same intent — a retry then replays the first answer instead of making a second post.

It takes up to a few minutes. `409 busy` means a generation is already running for that
workspace; wait and retry with the **same** key.

The result is a **`saved`** post — it is in the library and going nowhere. Generating never
publishes. Scheduling is the next, separate step.

### Schedule a post

```bash
curl -s -X POST "$KICKLINE_HOST/api/v1/posts/POST_ID/schedule" \
  -H "Authorization: Bearer $KICKLINE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"at":"2026-09-20T09:00:00Z","platform":"instagram"}'
```

`at` must be **in the future**; a past time is refused rather than quietly published now. Omit
`platform` to use every connected account, or check `GET /api/v1/accounts` first — scheduling with
nothing connected answers `409 not_connected`.

**Read `warning` in the response and tell the user what it says.** When it is present, the post
was scheduled but nothing will actually publish it.

### Cancel a post

```bash
curl -s -X POST "$KICKLINE_HOST/api/v1/posts/POST_ID/cancel" \
  -H "Authorization: Bearer $KICKLINE_KEY"
```

Only a `scheduled` post can be cancelled. A published post cannot be unsent — say so plainly
rather than trying something else.

## Rules for you

1. **Never publish, schedule or cancel without the user asking for that specific post and that
   specific time.** A post going out is not undoable. Read the list, say what you found, and wait.
2. **One generation per request the user made.** If a generate call times out, retry with the
   *same* `Idempotency-Key` rather than starting a new one — otherwise you spend their credits
   twice.
3. **Quote `warning` verbatim.** It is the only signal that a schedule will not actually post.
4. **Do not invent a `source_id`.** List `/sources` and pick from it.
5. **Report a `402` as it is.** `insufficient_credits` carries `needed` and `available`;
   `post_limit` carries `limit` and `used`. Tell the user the numbers rather than "it failed".
6. **Rate limit is 60 a minute per key.** On `429`, honour `Retry-After` in seconds.
7. Every error is `{ "error": { "code", "message" } }`. Show the `message`; it is written for a
   person.

## Errors worth recognising

| code | what to do |
|---|---|
| `unauthorized` (401) | the key is missing, wrong or revoked — ask for a new one |
| `plan_required` (403) | API keys need Growth or Pro |
| `plan_inactive` (403) | the workspace's plan lapsed; nothing can be made or posted |
| `insufficient_credits` (402) | say how many are needed and how many are left |
| `post_limit` (402) | the month's post allowance is used up; it resets on the 1st |
| `in_flight` (409) | your earlier identical request is still running; wait, then retry |
| `busy` (409) | another generation is running in that workspace |
| `not_connected` (409) | no social account is connected; the user must connect one in the app |
| `time_in_past` (400) | pick a future time |

Full reference: `/docs/api` on the deployment.
