> ## 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：下载已采用签名 PNG

> 通过 Didit 下载签署人在电子签名文档字段中添加的签名或首字母，格式为 PNG。

返回签署人为某个字段应用的签名或姓名首字母，格式为 PNG。图片路径位于字段的 `image_url` 中，具体位于 `signatures[].documents[].fields[]` 下，因此无需自行构造路径。调用此接口需要 `read:sessions` 权限。

```bash theme={null}
curl -L 'https://verification.didit.me/v3/session/{session_id}/signatures/{node_id}/fields/{field_id}/image/' \
  -H 'x-api-key: YOUR_API_KEY' \
  -o signature.png
```

手绘签名是签署人绘制的图像，也是盖印到已签名 PDF 中的图像。键入签名是签署人经过验证的姓名，采用其所选的手写风格；已签名 PDF 会以相同风格的文本形式保存该签名。如需提供签名本身的证明，请使用[已签署文档](https://docs.didit.me/zh/sessions-api/electronic-signature/download-signed-document.md)和[证据](https://docs.didit.me/zh/sessions-api/electronic-signature/download-evidence.md)。

如果字段不属于该签署人，或未应用签名或姓名首字母，则返回 `404`，并附带 `signature_field_not_found`。如果已存储的图像与其记录的 SHA-256 不再匹配，则返回 `400`，并附带 `signature_document_changed`。[删除会话](https://docs.didit.me/zh/sessions-api/delete-session.md)后，该路由返回 `404`。

## 相关内容

* [文档上的字段](https://docs.didit.me/zh/core-technology/electronic-signature/overview.md#文档上的字段)
* [电子签名报告](https://docs.didit.me/zh/core-technology/electronic-signature/report-electronic-signature.md#字段)


## OpenAPI

````yaml zh/openapi-25.json GET /v3/session/{sessionId}/signatures/{nodeId}/fields/{fieldId}/image/
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/session/{sessionId}/signatures/{nodeId}/fields/{fieldId}/image/:
    get:
      tags:
        - Sessions
      summary: 下载签名图像
      description: >-
        以 PNG 格式下载签署人应用于字段的签名或首字母签名。请使用 `signatures[].documents[].fields[]`
        中该字段的 `image_url`。需要 `read:sessions` 权限；您的 API 密钥有效。
      operationId: get_v3_session_signature_field_image
      parameters:
        - name: sessionId
          in: path
          required: true
          description: 用户验证（KYC）或企业验证（KYB）会话。
          schema:
            type: string
            format: uuid
            example: 11111111-2222-3333-4444-555555555555
        - name: nodeId
          in: path
          required: true
          description: 电子签名步骤：`signatures[]` 中项目的 `node_id`。
          schema:
            type: string
            example: feature_signature
        - name: fieldId
          in: path
          required: true
          description: 该签名人副本上的字段，如该字段的 `image_url` 中所示。
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: 图像。
          content:
            image/png:
              schema:
                type: string
                format: binary
        '400':
          description: 存储的图像与其记录的 SHA-256 不再匹配。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                  code:
                    type: string
              example:
                code: signature_document_changed
                detail: signature_document_changed
        '403':
          description: 缺少凭据，或凭据无法读取此会话。缺少密钥返回 `403`；错误、已撤销或已过期的密钥返回 `401`。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
              example:
                detail: You do not have permission to perform this action.
        '404':
          description: 无匹配图像：会话、步骤或字段不存在、已被删除，或未应用任何签名或姓名缩写。
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: string
                  code:
                    type: string
              examples:
                Unknown field:
                  summary: 不存在该字段
                  value:
                    code: signature_field_not_found
                    detail: signature_field_not_found
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from didit import Didit

            # Reads DIDIT_API_KEY.
            client = Didit()

            content = client.sessions.signatures.download_field_image(
                "11111111-2222-3333-4444-555555555555",
                "feature_signature",
                "11111111-2222-3333-4444-555555555555",
            )
            with open("download.png", "wb") as file:
                file.write(content)
        - lang: javascript
          label: Node.js
          source: >-
            import { writeFile } from "node:fs/promises";

            import Didit from "@didit-protocol/sdk-node";


            // Reads DIDIT_API_KEY.

            const didit = new Didit();


            const content = await didit.sessions.signatures.downloadFieldImage(
              "11111111-2222-3333-4444-555555555555",
              "feature_signature",
              "11111111-2222-3333-4444-555555555555",
            );

            await writeFile("download.png", Buffer.from(await
            content.arrayBuffer()));
        - lang: go
          label: Go
          source: "ctx := context.Background()\n// Reads DIDIT_API_KEY.\nclient := didit.NewClient()\n\nresp, err := client.Sessions.Signatures.DownloadFieldImage(ctx, \"11111111-2222-3333-4444-555555555555\", \"feature_signature\", \"11111111-2222-3333-4444-555555555555\")\nif err != nil {\n\tlog.Fatal(err)\n}\ndefer resp.Body.Close()\nfile, err := os.Create(\"download.png\")\nif err != nil {\n\tlog.Fatal(err)\n}\ndefer file.Close()\nif _, err := io.Copy(file, resp.Body); err != nil {\n\tlog.Fatal(err)\n}"
        - lang: java
          label: Java
          source: >-
            import java.nio.file.Path;

            import me.didit.Didit;


            // Reads DIDIT_API_KEY.

            Didit client = new Didit();


            client.sessions().signatures().downloadFieldImage("11111111-2222-3333-4444-555555555555",
            "feature_signature", "11111111-2222-3333-4444-555555555555")
                    .writeTo(Path.of("download.png"));
        - lang: php
          label: PHP
          source: >-
            <?php


            require 'vendor/autoload.php';


            use Didit\DiditClient;


            // Reads DIDIT_API_KEY.

            $didit = new DiditClient();


            $content =
            $didit->sessions->signatures->downloadFieldImage('11111111-2222-3333-4444-555555555555',
            'feature_signature', '11111111-2222-3333-4444-555555555555');

            $content->saveTo('download.png');
        - lang: ruby
          label: Ruby
          source: |-
            require "didit"

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

            content = didit.sessions.signatures.download_field_image(
              "11111111-2222-3333-4444-555555555555",
              "feature_signature",
              "11111111-2222-3333-4444-555555555555"
            )
            File.binwrite("download.png", content)
        - lang: csharp
          label: .NET
          source: >-
            using System;

            using Didit;


            // Reads DIDIT_API_KEY.

            using var client = new DiditClient();


            var content = await
            client.Sessions.Signatures.DownloadFieldImageAsync("11111111-2222-3333-4444-555555555555",
            "feature_signature", "11111111-2222-3333-4444-555555555555");

            await content.SaveToAsync("download.png");
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        您的应用 API 密钥，可在 Business Console 的“开发者 -> API
        密钥”中获取。主密钥拥有完整访问权限。指定名称的密钥可设置作用域：针对每个资源设为无权限、只读或读写，限定于特定工作流或已通过的会话、限定于
        IP 地址列表，以及设置到期日期。401 表示密钥错误、已撤销或已过期；403 表示未发送密钥、密钥无权访问该资源或操作，或请求来自其 IP
        列表之外的地址；在会话路由上返回 404 表示该会话不在该密钥允许的工作流或状态范围内。没有媒体访问权限的密钥获取到的图片、视频和 PDF
        URL 将为 null；没有会话写入权限的密钥获取到的会话链接和 token 将为 null。请参阅
        https://docs.didit.me/console/api-keys。

````

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