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

# 获取提现签名数据

> 构建提现交易的签名数据。

构建提现交易的签名数据。

> [!NOTE]
>
> 使用 Broker API Key 调用，并在请求头提供 `X-User-Wallet-Address`。网关会校验钱包与 Broker 的归属关系。 认证规则见[Broker API Key 与签名](https://dexbuilder.mintlify.site/api-reference/common/broker-authentication.md)。

## 使用说明

* `address` 为用户已绑定的签名钱包，也是到账地址。`to_address` 可省略；如提供，须与 `address` 一致。此平台接口不支持提现到第三方地址。
* EVM 场景下，响应中的 `data` 为 EIP-712 TypedData 的十六进制编码，用于钱包签名，不是链上交易数据；`contract_address` 不应作为该数据的广播目标。
* `timestamp` 为 Unix 毫秒时间戳。用户签名后，将签名分量和原样 `timestamp` 用于[提交提现](https://dexbuilder.mintlify.site/api-reference/dexbuilder/withdraw-submit.md)。


## OpenAPI

````yaml openapi/dexbuilder.yaml POST /api/v4/dexbuilder/withdraw/sign_data
openapi: 3.0.3
info:
  title: DexBuilder 平台 Broker API
  version: 1.0.0
  description: DexBuilder 平台 Broker API，涵盖资产配置、用户、充值与提现能力。认证和用户钱包校验见本站统一网关说明。
servers:
  - url: https://api.dexbuilder.com
security: []
paths:
  /api/v4/dexbuilder/withdraw/sign_data:
    post:
      tags:
        - 提现
      summary: 获取提现签名数据
      operationId: dexBuilderWithdrawSignData
      parameters:
        - $ref: '#/components/parameters/SubUserWalletAddr'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PerpWithdrawSignDataRequest'
      responses:
        '200':
          description: 成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnvelopeWithdrawSignData'
        '400':
          $ref: '#/components/responses/OpenAPIBadRequest'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '401':
          $ref: '#/components/responses/GatewayUnauthorized'
        '403':
          $ref: '#/components/responses/ProjectAccessDenied'
      security:
        - BrokerAPIKey: []
          Timestamp: []
          Signature: []
components:
  parameters:
    SubUserWalletAddr:
      name: X-User-Wallet-Address
      in: header
      required: true
      description: 目标终端用户钱包地址。网关校验该钱包对应的用户属于当前 Broker。
      schema:
        type: string
  schemas:
    PerpWithdrawSignDataRequest:
      type: object
      properties:
        chain:
          $ref: '#/components/schemas/OpenAPIChainId'
        token_symbol:
          type: string
          description: 代币符号
        token_address:
          type: string
          description: 代币合约
        token_amount:
          type: string
          description: >-
            提现数量，十进制字符串（EIP-712 message.amount 按 token 链上 decimals 编码，如 ETH 主网
            USDT 1 → 1000000）
        to_address:
          type: string
          description: 可选；省略时等于 `address`。OpenAPI 仅允许提到已绑定钱包，若填写须与 `address` 一致（EVM 大小写不敏感）
        address:
          type: string
          description: 用户已绑定钱包（签名主体且为到账地址），须与 X-User-Wallet-Address 一致
      required:
        - chain
        - token_symbol
        - token_address
        - token_amount
        - address
    EnvelopeWithdrawSignData:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          properties:
            data:
              $ref: '#/components/schemas/PerpWithdrawSignDataResponse'
    ErrorEnvelope:
      allOf:
        - $ref: '#/components/schemas/EnvelopeBase'
        - type: object
          required:
            - label
          properties:
            label:
              type: string
              description: 稳定的机器可读错误标识
            data:
              nullable: true
              description: 错误时一般为 null
    OpenAPIChainId:
      type: string
      enum:
        - base
        - bsc
        - ethereum
        - solana
        - arbitrum
      description: |
        链标识，与 GET /networks 的 `network` 一致。仅接受上述 canonical 值；
        不接受简写别名 `eth`、`sol`、`arb`（请求将返回 INVALID_ARGUMENT）。
      example: ethereum
    EnvelopeBase:
      type: object
      properties:
        code:
          type: integer
          example: 0
          description: 业务码，`0` 表示成功
        message:
          type: string
          example: success
          description: 人类可读说明，成功时为 success
        reason:
          type: string
          description: 错误原因标识；成功时通常为空字符串
        trace_id:
          type: string
          description: 链路追踪 ID，排障时提供
    PerpWithdrawSignDataResponse:
      type: object
      properties:
        data:
          type: string
          description: >-
            EVM 为完整 EIP-712 TypedData JSON 的 UTF-8 hex（0x
            前缀；`domain.verifyingContract` 为 Ledger）。 钱包对 TypedData 做 EIP-712
            哈希并签名，**不是**链上交易 input；勿 cast send / 勿发往 Vault。
        contract_address:
          type: string
          description: >-
            该链 Vault 地址（展示/对账用）；与 `data` 内 EIP-712 domain 的 Ledger
            地址不同，均不可作为用户广播 calldata 目标
        timestamp:
          type: integer
          format: int64
          description: 签名时间戳（毫秒，与 sign_data 响应一致），提交 withdraw/submit 时必须原样带回
  responses:
    OpenAPIBadRequest:
      description: 请求无效（参数、请求体、用户身份或业务校验）
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            invalidArgument:
              summary: 参数无效
              value:
                label: INVALID_ARGUMENT
                message: invalid argument
            userNotFound:
              summary: 用户不存在
              value:
                label: USER_NOT_FOUND
                message: User not found
            missingHeader:
              summary: 缺少必要请求头
              value:
                label: MISSING_REQUIRED_HEADER
                message: invalid headers
    GatewayUnauthorized:
      description: Broker API Key、签名或时间戳无效
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            invalidKey:
              summary: 无效 API Key
              value:
                label: INVALID_KEY
                message: Invalid key provided
                code: 401
                trace_id: abc123
            invalidSignature:
              summary: 签名错误
              value:
                label: INVALID_SIGNATURE
                message: Invalid signature
                code: 401
                trace_id: abc123
    ProjectAccessDenied:
      description: 项目未绑定或 Broker/API Key 不匹配
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            code: 40300801
            reason: P_DEX_BUILDER_IN_PROJECT_ACCESS_DENIED
            label: PROJECT_ACCESS_DENIED
            message: project access denied
            data: null
  securitySchemes:
    BrokerAPIKey:
      type: apiKey
      in: header
      name: KEY
      description: Broker API Key
    Timestamp:
      type: apiKey
      in: header
      name: Timestamp
      description: Unix 秒级时间戳
    Signature:
      type: apiKey
      in: header
      name: SIGN
      description: 使用 Broker Secret Key 生成的 HMAC-SHA512 十六进制签名

````

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