# Quickstart

Keyless demo, then submit, poll, and render your first clip in about ten minutes.

## 0. See the output before you write code

No key needed. A real finished job from our house account, in the exact shape
your integration will see:

```bash
curl https://www.cliphi.com/api/v1/demo
```

The `preview_page_url` links are live; open one to watch a finished-looking
clip.

## 1. Create a key

Sign in and create a key at
[Settings → API Keys](https://www.cliphi.com/studio/settings/api-keys). Keys
look like `chp_live_...` and are shown once. Send them as
`Authorization: Bearer` or `X-API-Key`; see
[Authentication](/docs/authentication).

## 2. Submit a video

```bash
curl -X POST https://www.cliphi.com/api/v1/jobs \
  -H "Authorization: Bearer $CLIPHI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"video_url": "https://www.youtube.com/watch?v=VIDEO_ID"}'
```

Returns in about two seconds with `job_id`, a relative `status_url`, a
`studio_url` (the human progress page), and a `message` to relay. Processing
bills per video minute; see [Credits and billing](/docs/credits-and-billing).
Optional fields: `instructions` (plain-language detection guidance, max 500
chars), `quality`, `start_time`/`end_time`, `language`, `force_new`.

## 3. Poll until complete

```bash
curl "https://www.cliphi.com/api/v1/jobs/$JOB_ID?wait=40" \
  -H "Authorization: Bearer $CLIPHI_API_KEY"
```

- `wait=40` long-polls server-side (values under 3 behave as 0).
- Respect `poll_after_seconds` between polls.
- Branch on the `status` field (`processing` | `completed` | `failed`): a
  failed job arrives inside a successful HTTP response.
- While processing, `phase_label` and `eta_seconds` narrate progress.

## 4. Render the picks

Show the free previews to a human first, then:

```bash
curl -X POST https://www.cliphi.com/api/v1/jobs/$JOB_ID/moments/$MOMENT_ID/render \
  -H "Authorization: Bearer $CLIPHI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"aspect_ratio": "9:16"}'
```

The response states `estimated_credits` before the clip exists. Poll the job
(`wait=40`) until the moment's `render_status` is `rendered` (clip URL in
`clips[]`) or `failed` (relay `render_error`; `render_error_code` says why).

Full request/response shapes with JSON examples:
[Agent API walkthrough](/docs/agents). Machine-readable spec:
[/cliphi-actions.json](https://www.cliphi.com/cliphi-actions.json).
