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

# 获取自定义字段架构

返回您的商家已发布的自定义字段模式，格式为 JSON Schema（默认）或 Localpayment 原生字段定义（?format=definition）。在调用 API 之前，可用它来构建表单并验证 attributes。

* 模式由 Localpayment 在入驻期间为您的商家定义并发布；如需更改，请通过您的客户经理申请。
* 未发布模式时，attributes 将不经验证直接被接受，且此接口返回 404。
* 该模式同时适用于 INDIVIDUAL 和 COMPANY 实体。

错误使用带有固定 `code` 的 `application/problem+json`。完整目录：[实体状态和错误代码](https://docs.localpayment.com/zh/reference/entity-statuses-and-error-codes.md)。


## OpenAPI

````yaml openapi/zh/localpayment.json GET /api/entity/v1/custom-fields/schema
openapi: 3.1.0
info:
  version: '1.0'
  title: Localpayment
  contact:
    name: Support
    url: mailto:support@localpayment.com
servers:
  - url: https://api.stage.localpayment.com
    description: Stage
security:
  - token: []
paths:
  /api/entity/v1/custom-fields/schema:
    get:
      summary: 获取自定义字段架构
      operationId: get-custom-fields-schema
      parameters:
        - name: Authorization
          in: header
          description: >-
            用于身份验证的 Bearer
            访问令牌。该令牌可从[获取访问令牌](/zh/reference/get-token)或[刷新访问令牌](/zh/reference/refresh-token)endpoint
            获取。系统将据此识别您的商户账户和执行操作的用户。
          required: true
          schema:
            type: string
            examples:
              - Bearer <your_access_token>
        - name: X-Correlation-ID
          in: header
          description: 跟踪标识符（UUID）。会在响应中原样返回；如未提供，则由 Localpayment 生成。
          required: false
          schema:
            type: string
            examples:
              - 0e8f6a2c-5b3d-4c1e-9a7f-6d5e4c3b2a10
        - name: format
          in: query
          description: 用于接收原生字段列表的定义。默认值：JSON Schema 2020-12。
          required: false
          schema:
            type: string
            enum:
              - definition
      responses:
        '200':
          description: OK。
          content:
            application/json:
              schema:
                type: object
                properties:
                  $schema:
                    type: string
                    examples:
                      - https://json-schema.org/draft/2020-12/schema
                  type:
                    type: string
                    examples:
                      - object
                  properties:
                    type: object
                    properties:
                      reasonForAccountOpening:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                          title:
                            type: string
                            examples:
                              - Reason for account opening
                          enum:
                            type: array
                            items:
                              type: string
                              examples:
                                - receive_payments_for_goods_and_services
                      sourceOfFundsAndIncome:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      numberOfEmployees:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                          enum:
                            type: array
                            items:
                              type: string
                              examples:
                                - 1-10
                      estimatedAnnualRevenueUsd:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      estimatedMonthlyVolumeUsd:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      businessActivityDescription:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                          minLength:
                            type: integer
                            examples:
                              - 1
                          maxLength:
                            type: integer
                            examples:
                              - 2000
                      countryTaxResidence:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                          minLength:
                            type: integer
                            examples:
                              - 3
                          maxLength:
                            type: integer
                            examples:
                              - 3
                      socialMedia:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      emailPixKey:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      percentageOfOwnership:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      hasControl:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      documentCountry:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                      countryOfTaxId:
                        type: object
                        properties:
                          type:
                            type: string
                            examples:
                              - string
                  additionalProperties:
                    type: boolean
                    examples:
                      - false
              examples:
                Example 1:
                  value:
                    $schema: https://json-schema.org/draft/2020-12/schema
                    type: object
                    properties:
                      reasonForAccountOpening:
                        type: string
                        title: Reason for account opening
                        enum:
                          - receive_payments_for_goods_and_services
                          - payroll
                          - other
                      sourceOfFundsAndIncome:
                        type: string
                      numberOfEmployees:
                        type: string
                        enum:
                          - 1-10
                          - 11-50
                          - 51-200
                          - 200+
                      estimatedAnnualRevenueUsd:
                        type: string
                      estimatedMonthlyVolumeUsd:
                        type: string
                      businessActivityDescription:
                        type: string
                        minLength: 1
                        maxLength: 2000
                      countryTaxResidence:
                        type: string
                        minLength: 3
                        maxLength: 3
                      socialMedia:
                        type: string
                      emailPixKey:
                        type: string
                      percentageOfOwnership:
                        type: string
                      hasControl:
                        type: string
                      documentCountry:
                        type: string
                      countryOfTaxId:
                        type: string
                    additionalProperties: false
                Example 2 - Response with ?format=definition:
                  value:
                    version: 9
                    status: PUBLISHED
                    fields:
                      - key: reasonForAccountOpening
                        label: Reason for account opening
                        description: null
                        type: ENUM
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options:
                            - receive_payments_for_goods_and_services
                            - payroll
                            - other
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: sourceOfFundsAndIncome
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: numberOfEmployees
                        label: null
                        description: null
                        type: ENUM
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options:
                            - 1-10
                            - 11-50
                            - 51-200
                            - 200+
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: estimatedAnnualRevenueUsd
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: estimatedMonthlyVolumeUsd
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: businessActivityDescription
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: 1
                          maxLength: 2000
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: countryTaxResidence
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: 3
                          maxLength: 3
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: socialMedia
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: emailPixKey
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: percentageOfOwnership
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: hasControl
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: documentCountry
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                      - key: countryOfTaxId
                        label: null
                        description: null
                        type: STRING
                        required: false
                        constraints:
                          minLength: null
                          maxLength: null
                          pattern: null
                          min: null
                          max: null
                          options: null
                          minItems: null
                          maxItems: null
                        children: []
                        items: null
                    createdBy: '12345'
                    createdAt: '2024-01-15T17:18:41Z'
                    approvedBy: '67890'
                    approvedAt: '2024-01-15T17:18:46Z'
        '401':
          description: 未授权。UNAUTHORIZED：缺少或无效的访问令牌。
          content:
            application/problem+json:
              schema:
                type: object
                description: RFC 9457 问题详情（application/problem+json）。
                properties:
                  type:
                    type: string
                    examples:
                      - about:blank
                  title:
                    type: string
                    description: 问题简述。
                  status:
                    type: integer
                    description: HTTP状态码。
                  detail:
                    type: string
                    description: 易于理解的解释。
                  instance:
                    type: string
                    description: 请求路径。
                  code:
                    type: string
                    description: 稳定的机器可读错误代码。根据此值进行分支。
                  correlationId:
                    type: string
                    format: uuid
                    description: 请求标识符。联系客服时请提供此标识符。
                    examples:
                      - 0e8f6a2c-5b3d-4c1e-9a7f-6d5e4c3b2a10
                  details:
                    type: array
                    description: 出错字段（如适用）。
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          examples:
                            - numberOfEmployees
                        issue:
                          type: string
                          examples:
                            - NOT_IN_OPTIONS
              examples:
                Example 1 - UNAUTHORIZED:
                  value:
                    type: about:blank
                    title: Unauthorized
                    status: 401
                    detail: Missing or invalid access token.
                    instance: /api/entity/v1/custom-fields/schema
                    code: UNAUTHORIZED
                    correlationId: 0e8f6a2c-5b3d-4c1e-9a7f-6d5e4c3b2a10
                    details: []
        '404':
          description: 未找到。CUSTOM_FIELD_SCHEMA_NOT_FOUND：您的商户未发布任何自定义字段架构。
          content:
            application/problem+json:
              schema:
                type: object
                description: RFC 9457 问题详情（application/problem+json）。
                properties:
                  type:
                    type: string
                    examples:
                      - about:blank
                  title:
                    type: string
                    description: 问题简述。
                  status:
                    type: integer
                    description: HTTP状态码。
                  detail:
                    type: string
                    description: 易于理解的解释。
                  instance:
                    type: string
                    description: 请求路径。
                  code:
                    type: string
                    description: 稳定的机器可读错误代码。根据此值进行分支。
                  correlationId:
                    type: string
                    format: uuid
                    description: 请求标识符。联系客服时请提供此标识符。
                    examples:
                      - 0e8f6a2c-5b3d-4c1e-9a7f-6d5e4c3b2a10
                  details:
                    type: array
                    description: 出错字段（如适用）。
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                          examples:
                            - numberOfEmployees
                        issue:
                          type: string
                          examples:
                            - NOT_IN_OPTIONS
              examples:
                Example 1 - CUSTOM_FIELD_SCHEMA_NOT_FOUND:
                  value:
                    type: about:blank
                    title: Not found
                    status: 404
                    detail: No custom-fields schema is published for your merchant.
                    instance: /api/entity/v1/custom-fields/schema
                    code: CUSTOM_FIELD_SCHEMA_NOT_FOUND
                    correlationId: 0e8f6a2c-5b3d-4c1e-9a7f-6d5e4c3b2a10
                    details: []
      security:
        - token: []
components:
  securitySchemes:
    token:
      type: http
      scheme: bearer

````

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