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

# アイデンティティを更新する

> Forward アイデンティティを更新します。

`POST /api/v1/forward/identities/{identity_id}`

変更可能な Identity フィールドを更新します。省略されたフィールドは変更されません。`metadata` はマージされ、空文字列のメタデータ値はそのキーを削除します。

## Headers

| Header            | Required | Description              |
| ----------------- | -------- | ------------------------ |
| `Authorization`   | Yes      | `Bearer <PAT>`           |
| `Content-Type`    | Yes      | `application/json`       |
| `Idempotency-Key` | No       | 安全でないリクエストに対する任意のべき等性キー。 |

## Path parameters

| Parameter     | Type   | Required | Description          |
| ------------- | ------ | -------- | -------------------- |
| `identity_id` | string | Yes      | Forward Identity ID。 |

## Body parameters

| Parameter     | Type    | Required | Description                         |
| ------------- | ------- | -------- | ----------------------------------- |
| `external_id` | string  | No       | 既存のエンドユーザー ID を置き換えます。              |
| `name`        | string  | No       | 表示名を置き換えます。                         |
| `enabled`     | boolean | No       | この Identity を使用できるかどうかを更新します。       |
| `metadata`    | object  | No       | カスタムメタデータをマージ更新します。空文字列の値はキーを削除します。 |

## Example request

```bash theme={null}
curl -s -X POST 'https://api.qoder.com/api/v1/forward/identities/idn_019eabc123' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Example User",
    "enabled": false,
    "metadata": {
      "channel": "app"
    }
  }'
```

## Example response

**HTTP 200 OK**

```json theme={null}
{
  "id": "idn_019eabc123",
  "external_id": "user_456",
  "name": "Example User",
  "enabled": false,
  "metadata": {
    "channel": "app"
  },
  "created_at": "2026-06-18T10:00:00Z",
  "updated_at": "2026-06-18T10:30:00Z"
}
```

## Response fields

更新された Identity オブジェクトを返します。

## Errors

| HTTP | Type                    | Trigger                    |
| ---- | ----------------------- | -------------------------- |
| 400  | `invalid_request_error` | リクエストボディが無効です。             |
| 401  | `authentication_error`  | PAT が無効または期限切れです。          |
| 404  | `not_found_error`       | Identity が存在しません。          |
| 409  | `conflict_error`        | Identity が既存のレコードと競合しています。 |

## Notes

* `enabled=false` は、アクティブな Identity を必要とする新しい操作を防ぎます。
* 過去のセッションおよび監査レコードは変更されません。

## Related

<CardGroup cols={2}>
  <Card title="アイデンティティを取得する" icon="file-lines" href="/cloud-agents/api/forward/identities/get" />

  <Card title="アイデンティティを削除する" icon="trash" href="/cloud-agents/api/forward/identities/delete" />
</CardGroup>
