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

# コントロール状態取得

> タスクコントロール状態の取得

## エンドポイント

```http theme={null}
GET http://localhost:8080/api/v1/tasks/{id}/control-state
```

## 説明

ワークフローの**現在の制御状態**を返します：一時停止中、キャンセルされたか、アクションをトリガーした人とその時刻に関するメタデータ。

これは以下に役立ちます：

* **一時停止 / 再開**ボタンの状態を表示するUIの構築
* 他のシステムを調整するためのバックエンドサービスからのポーリング

## 認証

**必要**: はい

ヘッダーにAPIキーを含めてください：

```http theme={null}
X-API-Key: sk_test_123456
```

## リクエスト

### ヘッダー

| ヘッダー          | 必要  | 説明            |
| ------------- | --- | ------------- |
| `X-API-Key`   | はい  | API認証キー       |
| `traceparent` | いいえ | W3Cトレースコンテキスト |

### パスパラメータ

| パラメータ | タイプ    | 必要 | 説明                      |
| ----- | ------ | -- | ----------------------- |
| `id`  | string | はい | タスクID（TemporalワークフローID） |

## レスポンス

### 200 OK

```json theme={null}
{
  "is_paused": true,
  "is_cancelled": false,
  "paused_at": "2025-10-29T06:00:01Z",
  "pause_reason": "User requested pause",
  "paused_by": "user-123",
  "cancel_reason": "",
  "cancelled_by": ""
}
```

注意：

* `paused_at`は、ワークフローが一度も一時停止されていない場合は空の文字列になります。
* `is_cancelled`は、制御信号からの論理的なキャンセル状態を反映しており、Temporalの終了だけではありません。

### 404 Not Found

```json theme={null}
{ "error": "Task not found" }
```

### 401 / 403

```json theme={null}
{ "error": "Unauthorized" }
```

または

```json theme={null}
{ "error": "Forbidden" }
```
