すべてのプロダクト
Search
ドキュメントセンター

Qoder CN シリーズ:セッションの作成

最終更新日:Jul 04, 2026

アイデンティティとテンプレートから Forward セッションを作成します。

リクエストヘッダー

ヘッダー

必須

説明

Authorization

はい

Bearer <PAT>

Content-Type

はい

application/json

Idempotency-Key

いいえ

安全でないリクエストに対するオプションのべき等性キー。

リクエストボディ

パラメーター

タイプ

必須

説明

identity_id

string

はい

Forward アイデンティティ ID。

template_id

string

はい

Forward テンプレート ID。

title

string

いいえ

セッションのタイトル。

incremental_streaming_enabled

boolean

いいえ

アシスタントのインクリメンタルストリーミングイベントを有効にします。デフォルトは false です。

metadata

object

いいえ

カスタムメタデータ。

config

object

いいえ

セッションごとの設定オーバーライド。許可リストに登録されたフィールドのみが受け入れられます。

config.environment_variables

object

いいえ

キーと値のペアとしてのセッション環境変数。

resources

array

いいえ

セッションレベルのリソース。現在はファイルマウントです。

resources[].type

string

resources が使用される場合は必須

リソースタイプ。現在は file です。

resources[].file_id

string

resources が使用される場合は必須

Files API からのファイル ID。

resources[].mount_path

string

いいえ

エージェントコンテナ内のマウントパス。省略した場合、Forward はファイル名からパスを派生させます。

リクエスト例

curl -s -X POST 'https://api.qoder.com.cn/api/v1/forward/sessions' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "identity_id": "idn_xxx",
    "template_id": "tmpl_support",
    "title": "Customer support session",
    "incremental_streaming_enabled": true,
    "metadata": {
      "source": "web",
      "biz_id": "ticket_123"
    },
    "config": {
      "environment_variables": {
        "API_KEY": "sk-xxx"
      }
    },
    "resources": [
      {
        "type": "file",
        "file_id": "file_019e6a18dc09abcd",
        "mount_path": "/data/input.py"
      }
    ]
  }'

レスポンス例

HTTP 200 OK

{
  "id": "sess_xxx",
  "type": "session",
  "identity_id": "idn_xxx",
  "template": {
    "id": "tmpl_support",
    "type": "template",
    "name": "Support assistant",
    "model": "ultimate",
    "version": 3
  },
  "source_type": "api",
  "status": "idle",
  "title": "Customer support session",
  "incremental_streaming_enabled": true,
  "metadata": {
    "source": "web",
    "biz_id": "ticket_123"
  },
  "config": {
    "environment_variables": {
      "API_KEY": "sk-xxx"
    }
  },
  "stats": {
    "active_seconds": 0,
    "duration_seconds": 0
  },
  "archived_at": null,
  "created_at": "2026-06-22T10:00:00Z",
  "updated_at": "2026-06-22T10:00:00Z"
}

レスポンスフィールド

フィールド

タイプ

説明

id

string

セッション ID。

type

string

常に session

identity_id

string

Forward アイデンティティ ID。

template

object

テンプレートの概要。

source_type

string

セッションソース。直接の API 作成では api を使用します。

status

string

idlerunningreschedulingcanceling、または terminated

incremental_streaming_enabled

boolean

このセッションでインクリメンタルストリーミングが有効になっているかどうか。

archived_at

string|null

アーカイブ日時。

created_at

string

作成日時。

updated_at

string

更新日時。

エラー

HTTP

タイプ

コード

発生条件

400

invalid_request_error

invalid_request_body

リクエストボディが無効です。

403

permission_error

template_access_denied

アイデンティティはテンプレートを使用できません。

404

not_found_error

identity_not_found

アイデンティティが存在しないか、削除されています。

404

not_found_error

template_not_found

テンプレートが存在しません。

409

conflict_error

identity_disabled

アイデンティティが無効になっています。

422

invalid_request_error

runtime_config_invalid

適用されるランタイム設定が無効です。

401

authentication_error

authentication_required

PAT が無効であるか、有効期限が切れています。

  • source_type は Forward によって割り当てられ、作成リクエストでは受け入れられません。

  • incremental_streaming_enabled はセッションに永続化され、後で変更することはできません。

  • アップロードされたファイルは、resources で渡される前に、Files API にすでに存在している必要があります。