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

# 質問票更新API：KYCフォームを編集

> DiditのKYC質問票を編集するAPI。名前の変更、順序付きの質問の置き換え、多言語ラベルの更新が可能です。コンプライアンスフォームをプログラムで管理でき、料金は呼び出しごとの従量課金です。



アンケート更新APIのプロンプト
        プロンプトをクリップボードにコピー



      
      

\<pre>

\`Update a simple Didit questionnaire through the Management API.

Endpoint:
PATCH https://verification.didit.me/v3/questionnaires/{questionnaire_uuid}/

Authentication:
Use the x-api-key header with my Didit API key.

Requirements:
\- Use PATCH and include only the fields I want to change.
\- To rename the questionnaire, send title or description only.
\- To change questions, send the full desired form_elements array. This replaces the existing question list.
\- Do not send graph, branches, next, required_if, or conditional logic.
\- Keep languages consistent with the questionnaire. Include en labels for every form element.
\- Capture the questionnaire_id returned by the response because published updates may return a new version id.

Example metadata update body:
\{
"title": "Updated Customer Onboarding"
}

Example full question replacement body:
\{
"form_elements": [
\{
  "id": "occupation",
  "element_type": "short_text",
  "label": { "en": "What is your occupation?" },
  "is_required": true
},
\{
  "id": "source_of_funds",
  "element_type": "multiple_choice",
  "label": { "en": "Source of funds" },
  "options": [
    \{ "value": "employment", "label": { "en": "Employment" } },
    \{ "value": "business", "label": { "en": "Business" } }
  ]
}
]
}

Build the API call, handle validation errors, and return the latest questionnaire_id from the response.`

\</pre>



      
      

貼り付け先

部分的な更新には`PATCH`を使用します。アンケートの名前を変更する場合は、`title`または`description`のみを送信します。```json theme={null}
{
  "title": "Updated Customer Onboarding"
}
```質問を更新する場合は、更新後の`form_elements`配列全体を送信します。この配列は以前の質問リストを置き換えます。引き続き表示したい既存の質問はすべて含めてください。```json theme={null}
{
  "form_elements": [
    {
      "id": "occupation",
      "element_type": "short_text",
      "label": { "en": "What is your occupation?" },
      "is_required": true
    },
    {
      "id": "source_of_funds",
      "element_type": "multiple_choice",
      "label": { "en": "Source of funds" },
      "options": [
        { "value": "employment", "label": { "en": "Employment" } },
        { "value": "business", "label": { "en": "Business" } }
      ]
    }
  ]
}
```v3 APIはシンプルな直線型のアンケートのみをサポートします。`graph`、`branches`、`next`および条件付きルールは拒否されます。レスポンスには`questionnaire_id`が含まれます。`published`のアンケートを更新すると、APIが新しいバージョンを作成する場合があります。URL内のIDが最新バージョンのままであると想定せず、返された`questionnaire_id`を取得してワークフローで使用してください。


## OpenAPI

````yaml ja/openapi-25.json PATCH /v3/questionnaires/{questionnaire_uuid}/
openapi: 3.0.0
info:
  version: 3.0.0
  title: Didit Verification API
  description: 本人確認API。x-api-keyヘッダーで認証します。
servers:
  - url: https://verification.didit.me
security: []
tags: []
paths:
  /v3/questionnaires/{questionnaire_uuid}/:
    patch:
      tags:
        - Questionnaires
      summary: アンケートを更新
      description: >-
        アンケートを更新します。バージョン管理は、送信する`status`フィールドとバージョンの現在の状態によって決まります。(1)
        **公開済み**バージョンで`status`を指定しない場合→公開済みバージョンがその場で更新されます（同じ`questionnaire_id`、同じ`version`）。(2)
        **下書き**で`status`を指定しない場合→下書きが更新され、直ちに公開されます。(3) **公開済み**バージョンで`status:
        "published"`を指定した場合→同じ`questionnaire_group_id`の下に新しい公開済みバージョンが作成されて返され（新しい`questionnaire_id`、`version`
        + 1）、グループ内の既存の下書きは削除されます。(4) `status:
        "draft"`は下書きを下書きのまま保持します（自動保存）が、公開済みバージョンでは400で拒否されます（`"Cannot revert a
        published version to draft."`）。
      operationId: update_questionnaire
      parameters:
        - name: questionnaire_uuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: 更新するアンケートのバージョンごとのUUIDです。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SimpleQuestionnaireUpdateRequest'
            examples:
              Rename:
                summary: アンケートの名前を変更する
                value:
                  title: Updated Customer Onboarding
              Replace questions:
                summary: 線形の質問リスト全体を置き換え
                value:
                  form_elements:
                    - id: occupation
                      element_type: short_text
                      label:
                        en: What is your occupation?
                      is_required: true
                    - id: source_of_funds
                      element_type: multiple_choice
                      label:
                        en: Source of funds
                      options:
                        - value: employment
                          label:
                            en: Employment
                        - value: business
                          label:
                            en: Business
      responses:
        '200':
          description: >-
            アンケートが更新されました。本文は、結果として得られたバージョンの最新の状態です。つまり、その場で更新されたバージョン、または公開済みの行に`status:
            "published"`を送信した場合は新たに作成された公開バージョンです（この場合、`questionnaire_id`と`version`はパッチを適用したものと異なります）。レスポンスの`questionnaire_id`はバージョンごとのUUIDです。安定したグループ識別子が必要な場合は`questionnaire_group_id`を使用してください。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuestionnaireDetail'
        '400':
          description: >-
            検証エラー：不明な`element_type`、翻訳の欠落、サポートされていない分岐/条件フィールド、`en`を含まない`languages`、`languages`に含まれない`default_language`、ラベルのないオプション、生の`graph`の送信、または公開済みバージョンでの`status:
            "draft"`（`"Cannot revert a published version to
            draft."`）。レスポンスボディは、フィールド名をキーとするDRFの検証エラーです。
        '403':
          description: APIキーがないか、無効です。
          content:
            application/json:
              examples:
                Invalid token:
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: 認証済みのアプリケーションに、この`questionnaire_uuid`のアンケートは存在しません。
        '415':
          description: 'サポートされていないメディアタイプです。`Content-Type: application/json`を設定してください。'
        '429':
          description: レート制限を超過しました。指数バックオフで再試行してください。
        '500':
          description: 予期しないサーバーエラーです。安全に再試行できます。
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl -X PATCH
            'https://verification.didit.me/v3/questionnaires/11111111-2222-3333-4444-555555555555/'
            \
              -H 'x-api-key: YOUR_API_KEY' \
              -H 'Content-Type: application/json' \
              -d '{"title": "Updated Customer Onboarding"}'
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            result = client.questionnaires.update(
                "11111111-2222-3333-4444-555555555555",
                title="Updated Customer Onboarding",
            )
            print(result)
        - lang: javascript
          label: Node.js
          source: >-
            import Didit from "@didit-protocol/sdk-node";


            // Reads DIDIT_API_KEY.

            const didit = new Didit();


            const result = await
            didit.questionnaires.update("11111111-2222-3333-4444-555555555555",
            {
              title: "Updated Customer Onboarding",
            });

            console.log(result);
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresult, err := client.Questionnaires.Update(ctx, \"11111111-2222-3333-4444-555555555555\", didit.SimpleQuestionnaireUpdateRequest{\n\tTitle: didit.String(\"Updated Customer Onboarding\"),\n})\nif err != nil {\n\tlog.Fatal(err)\n}\nfmt.Printf(\"%+v\\n\", result)"
        - lang: java
          label: Java
          source: >-
            import me.didit.Didit;

            import me.didit.types.SimpleQuestionnaireUpdateRequest;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            var result =
            client.questionnaires().update("11111111-2222-3333-4444-555555555555",
            SimpleQuestionnaireUpdateRequest.builder()
                    .title("Updated Customer Onboarding")
                    .build());
            System.out.println(result);
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $result =
            $didit->questionnaires->update('11111111-2222-3333-4444-555555555555',
            [
                'title' => 'Updated Customer Onboarding',
            ]);

            print_r($result->toArray());
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

            # Reads DIDIT_API_KEY.
            didit = Didit::Client.new

            result = didit.questionnaires.update(
              "11111111-2222-3333-4444-555555555555",
              title: "Updated Customer Onboarding"
            )
            puts result.to_h
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using System.Text.Json;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var result = await
            client.Questionnaires.UpdateAsync("11111111-2222-3333-4444-555555555555",
            new SimpleQuestionnaireUpdateRequest

            {
                Title = "Updated Customer Onboarding",
            });

            Console.WriteLine(JsonSerializer.Serialize(result));
components:
  schemas:
    SimpleQuestionnaireUpdateRequest:
      type: object
      description: アンケートのメタデータを更新するか、線形の`form_elements`リスト全体を置き換えます。
      properties:
        title:
          type: string
        description:
          type: string
          nullable: true
        languages:
          type: array
          items:
            type: string
        default_language:
          type: string
        is_active:
          type: boolean
        status:
          type: string
          enum:
            - draft
            - published
        form_elements:
          type: array
          minItems: 1
          description: 指定した場合、線形の質問リスト全体がこの値で置き換えられます。
          items:
            $ref: '#/components/schemas/SimpleQuestionnaireElement'
    QuestionnaireDetail:
      type: object
      description: GET、POST（作成）、PATCH（更新）の各エンドポイントから返されるアンケートの完全な詳細。
      properties:
        questionnaire_id:
          type: string
          format: uuid
          description: アンケートの一意の識別子。ワークフローからアンケートを参照する場合や、以降の更新・削除リクエストでこのIDを使用します。
        title:
          type: string
        description:
          type: string
          nullable: true
        languages:
          type: array
          items:
            type: string
        default_language:
          type: string
        is_active:
          type: boolean
        is_simple_questionnaire:
          type: boolean
        graph:
          type: object
          description: start_nodeとnodesマップを含むグラフ構造。
        sections:
          type: array
          description: セクションごとにまとめられたアンケートの内容（グラフから導出）。
          items:
            type: object
        questionnaire_group_id:
          type: string
          format: uuid
          description: 同じアンケートのすべてのバージョンをまとめる不変の識別子。
        version:
          type: integer
        status:
          type: string
          enum:
            - draft
            - published
        published_at:
          type: string
          format: date-time
          nullable: true
        is_editable:
          type: boolean
          description: アンケートをその場で編集できる場合（ドラフトバージョン）はtrue。
    SimpleQuestionnaireElement:
      type: object
      required:
        - element_type
        - label
      properties:
        id:
          type: string
          description: >-
            任意の固定の質問IDです。省略すると、APIが`q1`、`q2`などを生成します。読みやすさのため、小文字の英字、数字、アンダースコアを使用してください。
          example: source_of_funds
        element_type:
          type: string
          description: 質問タイプ。APIはこれらの小文字の値と、対応する大文字の値を受け付けます。
          enum:
            - short_text
            - long_text
            - dropdown
            - single_choice
            - multiple_choice
            - number
            - image
            - file_upload
            - time
            - email
            - address
            - phone
            - country
            - date_picker
            - consent
            - section_header
            - separator
            - heading
            - paragraph
        label:
          type: object
          description: '言語コードごとの質問ラベル。例えば`{ "en": "Source of funds" }`のように指定します。'
          additionalProperties:
            type: string
        description:
          type: object
          nullable: true
          additionalProperties:
            type: string
        placeholder:
          type: object
          nullable: true
          additionalProperties:
            type: string
        is_required:
          type: boolean
          default: false
        options:
          type: array
          description: >-
            `dropdown`、`single_choice`、`multiple_choice`で使用します。`value`を省略した場合、APIがオプションのラベルから値を生成します。
          items:
            type: object
            required:
              - label
            properties:
              value:
                type: string
              label:
                type: object
                additionalProperties:
                  type: string
        max_files:
          type: integer
          minimum: 1
          maximum: 5
          description: '`file_upload`または`image`と併用します。'
        validation:
          type: object
          nullable: true
          description: >-
            `short_text`、`long_text`、`number`に対する任意の形式検証です。ユーザーがフィールドに入力している間に適用され（検証を通過するまで先に進めません）、送信時にAPIでも再チェックされます。
          properties:
            pattern:
              type: string
              description: >-
                値が完全に一致する必要がある正規表現（ECMA-262のサブセット）。`short_text`と`long_text`で使用します。^/$アンカーは追加しないでください。値全体が照合されます。
            min_length:
              type: integer
              minimum: 0
              description: 最小文字数。`short_text`と`long_text`で使用します。
            max_length:
              type: integer
              minimum: 0
              description: 最大文字数です。`short_text`および`long_text`で使用します。
            min:
              type: number
              description: 数値の最小値。`number`で使用します。
            max:
              type: number
              description: 数値の最大値です。`number`で使用します。
            error_message:
              type: object
              description: 検証に失敗したときに表示される翻訳済みメッセージ。言語コードをキーとします。
              additionalProperties:
                type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        お客様のアプリケーションのAPIキーです。Business ConsoleのDevelopers -> API
        keysで取得できます。プライマリキーはフルアクセス権を持ちます。名前付きキーにはスコープを設定できます。リソースごとのアクセス権（なし、読み取り、書き込み）、一部のワークフローまたは承認済みセッションへの限定、IPアドレスのリストへの限定、有効期限の設定です。401は、キーが誤っている、失効している、または期限切れであることを意味します。403は、キーが送信されていない、キーにこのリソースやアクションへのアクセス権がない、またはIPリスト外のアドレスからリクエストが送信されたことを意味します。セッションのルートでの404は、セッションがキーのワークフローまたはステータスの対象外であることを意味します。メディアへのアクセス権がないキーでは、画像、動画、PDFのURLがnullで返されます。セッションの書き込み権限がないキーでは、セッションのリンクとトークンがnullで返されます。詳細は次を参照してください:
        https://docs.didit.me/console/api-keys

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.