> For the complete documentation index, see [llms.txt](https://getsquish.gitbook.io/squish/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://getsquish.gitbook.io/squish/ja/hajimeni/quickstart-api.md).

# クイックスタート: ホスト型 API

**AI に動画へのランダムアクセスを提供します。** ホスト型 API は、CLI および MCP サーバーと同じエンジンへリモートからアクセスする経路です: `POST` 動画を送ると、タイムスタンプ付きのコンタクトシート JPG と、各セルのタイムコードを含む JSON メタデータが返ります。ワークフローがローカルツールを実行できない場合 — CI、サーバーレス、ホスト型エージェント、または ffmpeg のないマシンなど — に使用します。

{% hint style="info" %}
**この経路は意図的なアップロードです。保存サービスではなく、計算サービスへ送信します。** アップロードされた動画は、ジョブが終了した瞬間に成功・失敗を問わず削除されます。保持されることも、学習に使われることもありません。出力シートは capability URL 上の一時キャッシュ（約 24 時間）で、その後は自動的に期限切れになります。保持したい場合はダウンロードしてください。より強い保証が必要ですか？ Squish をローカルで実行してください。 [CLI](/squish/ja/hajimeni/quickstart-cli.md) と [MCP サーバー](/squish/ja/hajimeni/quickstart-mcp.md) 動画をアップロードしないでください。
{% endhint %}

## キーを取得する

1. 開く [getsquish.app/api-keys](https://getsquish.app/api-keys) そして、メールコードでサインインします。
2. クレジットパックを購入します（$3 = 30、$9 = 120、$29 = 500 クレジット）— あるいはこの手順は省略できます。これまでに何も購入したことがないアカウントには、最初のリクエスト時に無料の1日分の利用枠が自動的に適用されます。
3. キーを作成してコピーする **一度**。キーは次のような形式です `sq_live_` + 40 桁の 16 進文字列です。保存されるのはハッシュのみなので、紛失したキーは復元できず、再発行のみ可能です。

## 最初のリクエスト

エンドポイント: `POST https://api.getsquish.app/v1/squish`。認証には `Authorization: Bearer <key>`；送信します `multipart/form-data` という名前のファイルフィールドをちょうど 1 つ含めて **`video`**:

```bash
curl -s -X POST https://api.getsquish.app/v1/squish \
  -H "Authorization: Bearer sq_live_…" \
  -F "video=@clip.mov" \
  -F "density=3x3"
```

任意のフィールド: `density` (`3x3`–`6x6`、既定値は `3x3` — 密度が高いほど 1 シートあたりの消費クレジットは増えます）と `レスポンス` (`JSON` 既定値、または `画像` 最初のシート JPG を直接取得し、メタデータは `x-squish-job` と `x-credits-remaining` ヘッダーに含まれます）。

## レスポンスには

```json
{
  "job_id": "...",
  "input": "clip.mov",
  "duration": 10.0,
  "frames": 9,
  "sheets": 1,
  "density": "3x3",
  "credits_charged": 1,
  "credits_remaining": 33,
  "files": ["https://api.getsquish.app/v1/sheets/<job_id>/video.sheet-1.jpg"],
  "timecodes": [["0:00", "0:01", "0:02", "0:03", "0:05", "0:06", "0:07", "0:08", "0:10"]],
  "warnings": [],
  "contract": "squish-http-v0"
}
```

1 回の同期リクエストでライフサイクル全体が完結します。ジョブキューもポーリングも Webhook もなく、接続は処理時間中ずっと開いたままです（通常のクリップなら数秒です）。 `job_id` は受領証です。シートの URL と、あなたの利用状況テーブルに表示されます。 [getsquish.app/api-keys](https://getsquish.app/api-keys)。 `契約` フィールド（`squish-http-v0`）はバージョン識別子です。破壊的変更を検出するために解析してください。

## クレジットと無料の1日利用枠

クレジットは前払いで、出力シートごとに密度に応じて消費されます: `3x3` ＝ 1 · `4x4` ＝ 2 · `5x5` ＝ 3 · `6x6` ＝ 5。正確な費用は **前に** いずれかのフレームが抽出される前に確定し、課金後にエンジンが失敗した場合は自動的に返金されます。

あるアカウントは **何も購入したことがない** （Web Pro なし、クレジットパックなし）は、少額の下限値まで補充されます — 現在は **7 クレジット** — 最大でも 1 回／ **UTC 日ごとに**、その日の最初の有料リクエストで残高が下限を下回っている場合に適用されます。これは下限値までの補充であり、加算ではありません。未使用の利用枠は繰り越されず、下限値以上では何も付与されず、購入済み残高が触れられることもありません。

## 知っておくべき制限

* アップロード上限: **300 MB**。長さ上限: **30 分**.
* 一度に処理されるジョブは 1 件のみで、短いキューがあります — 過負荷時は `429 busy` （課金は発生しません。約 10〜30 秒後に安全に再試行できます）。
* **なし `start`/`end` まだウィンドウはありません。** ホスト型リクエストは常にクリップ全体を対象とします。 `start`/`end` フィールドは無視されます。ローカルの [CLI](/squish/ja/hajimeni/quickstart-cli.md) と [MCP サーバー](/squish/ja/hajimeni/quickstart-mcp.md) 受け付ける `start`/`end` に対して [ナビゲーションループ](/squish/ja/purimitibu/the-navigation-loop.md).
* 稼働確認: `GET https://api.getsquish.app/healthz` （認証不要） — 「API 停止」と「自分のリクエストが誤っている」を切り分けます。

完全なエラー表（`401` / `402` / `413` / `422` / `429` / `500` に加え、 `返金済み` フィールド）と再試行ポリシーは [HTTP API リファレンス](/squish/ja/rifarensu/http-api.md).

## 次へ

* [HTTP API リファレンス](/squish/ja/rifarensu/http-api.md) — エラー、再試行ポリシー、上限、そして固定された契約です。
* [プライバシーとデータフロー](/squish/ja/purimitibu/privacy-and-data-flow.md) — 3 つの処理経路（Web、ローカル CLI/MCP、ホスト型 API）の違いです。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://getsquish.gitbook.io/squish/ja/hajimeni/quickstart-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
