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

# Add Wallet

> Adds a crypto wallet address to a customer, or updates it if it already exists. Wallets with a label form the customer's address book.

<Prompt description="Add Wallet" actions={["cursor"]}>
  Add the Zapyd "Add Wallet" call (`POST /cms/api/v1/customer/wallet/add`) to my backend. Adds a crypto wallet address to a customer, or updates it if it already exists. Wallets with a label form the customer's address book.

  * Sandbox: `POST https://sandbox.zapyd.com/cms/api/v1/customer/wallet/add`
  * Production: `POST https://api.zapyd.com/cms/api/v1/customer/wallet/add`

  JSON body:

  * `customer_id` (string, uuid, required): Customer's unique identifier.
  * `wallet_address` (string, required): Wallet address. Must match the network's address format (0x… for EVM networks, T… for Tron, base58 for Solana). Example: `0x1234567890123456789012345678901234567890`.
  * `network` (string, required): Blockchain network, case-insensitive: Ethereum, Polygon, Arbitrum, Bsc, Sepolia, Solana, Tron. Example: `Ethereum`.
  * `label` (string, optional): Optional label. Wallets with a label are shown in List Wallets (address book). Example: `Main wallet`.

  Success: HTTP 200, `{status: true, message, data}`. `data`: `id` (Wallet ID (integer). Use it in the fetch and delete paths), `wallet_address`, `network`, `label` (Label shown in the address book. Only labelled wallets are returned by List Wallets), `status`, `is_visible` (True when the wallet has a non-empty label), `created_at` (Creation time (ISO 8601)).
  Every endpoint can also return 401 `AUTH_*` (signature, timestamp or key: fix, don't retry), and 429 or 5xx (retry with backoff).

  Rules:

  * Saves a customer's own crypto address (an address book). Payin crypto doesn't go here: it goes to your organization's delivery wallet.
  * Re-adding an existing address for the customer updates it. The address must match the network's format (`0x…` EVM, `T…` Tron, base58 Solana). `Sepolia` is sandbox only.
  * Only wallets with a `label` appear in `GET /customer/wallet/list`. Save `data.id` (an integer) as `wallet_id`.

  Signing (every request):

  * Headers: `X-API-KEY`, `X-TIMESTAMP` (Unix seconds, within 300 s of server time; generate per request) and `X-SIGNATURE`.
  * `X-SIGNATURE` = Base64(HMAC-SHA256(key = API secret, message = apiKey + "|" + timestamp + "|" + canonicalBody)). Base64 of the raw digest, not hex.
  * canonicalBody: the JSON body with keys sorted at every nesting level, no whitespace (separators `,` and `:`), and every non-ASCII character escaped as lowercase `\uXXXX` (Python `json.dumps(body, sort_keys=True, separators=(",", ":"))`). Requests with no body (GET, DELETE) sign `{}`. Query parameters are not signed.
  * Send the exact canonicalBody string you signed as the request body, with `Content-Type: application/json`.
  * Test vector: key `3f1b2c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d`, secret `test-secret-do-not-use`, timestamp `1735689600`. Signing `{}` gives `6sCtVSRQjU9+2/af8gdwUAvY1l6Ii6ENcbRfanPkhY0=`. Body `{"customer_id":"78c99d71-f28f-47a9-8302-93b286efbe0e","amount":100.5,"currency":"INR","meta":{"note":"Café","b":2,"a":1}}` gives `l+DvQrzlKbsOSxSYOdWoWHEehcFRZfDJPKlLDkm2cSI=`.

  Deliver:

  1. A typed `addWallet` function in this codebase's language and HTTP client. Reuse an existing Zapyd client and signer, or write one small shared client.
  2. Config from `ZAPYD_API_KEY`, `ZAPYD_API_SECRET` and `ZAPYD_BASE_URL`. The secret stays on the server, never in a browser or app.
  3. Return `data`. When `status` is false, throw an error with the HTTP status, `err_code`, `message` and `errors`. Don't show raw errors to end users.
  4. Retry only 429 and 5xx: exponential backoff from 1 s, capped at 30 s, at most 5 attempts.
  5. Amounts as strings. Types for every field above.
  6. Tests: the signer against the test vector, and this call against sandbox.

  Reference: `https://docs.zapyd.com/api-reference-exchange/endpoint/wallet/add.md`
</Prompt>


## OpenAPI

````yaml POST /customer/wallet/add
openapi: 3.1.0
info:
  title: Zapyd API
  description: API for Zapyd - Customer, Payout, and Webhook services
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://sandbox.zapyd.com/pos/api/v1
    description: Payout API Base URL
    variables:
      base_url:
        default: https://sandbox.zapyd.com
  - url: https://sandbox.zapyd.com/cms/api/v1
    description: Customer API Base URL
    variables:
      base_url:
        default: https://sandbox.zapyd.com
security:
  - ApiKeyAuth: []
    TimestampAuth: []
    SignatureAuth: []
tags:
  - name: Customer
    description: Customer related operations
    x-displayName: Customer
    x-traitTag: true
  - name: Payout
    description: Payout related operations
  - name: Webhooks
    description: Webhook related operations
  - name: Widget
    description: Hosted buy/sell widget session initialization
paths:
  /customer/wallet/add:
    post:
      tags:
        - Wallet
      description: >-
        Add a crypto wallet to a customer, or update it if the address already
        exists for that customer. `network` is matched case-insensitively and
        the address is validated against the network's format. Only wallets
        saved with a non-empty `label` appear in List Wallets.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                customer_id:
                  type: string
                  description: Customer's unique identifier
                  example: c2cf861b-342b-4318-a90e-85cd0312e82f
                  format: uuid
                wallet_address:
                  type: string
                  description: >-
                    Wallet address. Must match the network's address format (0x…
                    for EVM networks, T… for Tron, base58 for Solana).
                  example: '0x1234567890123456789012345678901234567890'
                network:
                  type: string
                  description: >-
                    Blockchain network, case-insensitive: Ethereum, Polygon,
                    Arbitrum, Bsc, Sepolia, Solana, Tron
                  example: Ethereum
                label:
                  type: string
                  description: >-
                    Optional label. Wallets with a label are shown in List
                    Wallets (address book).
                  example: Main wallet
              required:
                - customer_id
                - wallet_address
                - network
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Wallet added/updated successfully
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: >-
                          Wallet ID (integer). Use it in the fetch and delete
                          paths.
                        example: 42
                      wallet_address:
                        type: string
                        description: Wallet address
                        example: '0x1234567890123456789012345678901234567890'
                      network:
                        type: string
                        description: Canonical network name
                        example: Ethereum
                        enum:
                          - Ethereum
                          - Polygon
                          - Arbitrum
                          - Bsc
                          - Sepolia
                          - Solana
                          - Tron
                      label:
                        type: string
                        description: >-
                          Label shown in the address book. Only labelled wallets
                          are returned by List Wallets.
                        example: Main wallet
                      status:
                        type: string
                        description: Wallet status
                        example: ACTIVE
                        enum:
                          - ACTIVE
                          - INACTIVE
                      is_visible:
                        type: boolean
                        description: True when the wallet has a non-empty label
                        example: true
                      created_at:
                        type: string
                        description: Creation time (ISO 8601)
                        example: '2026-09-30T10:00:00Z'
                        format: date-time
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Bad Request
                  data:
                    type: 'null'
                  errors:
                    type: object
                    example:
                      network:
                        - This field is required.
                  err_code:
                    type: string
                    example: REQ_FIELD_MISSING
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: boolean
                    example: false
                  message:
                    type: string
                    example: Internal Server Error
                  data:
                    type: 'null'
                  errors:
                    type: object
                    example: {}
                  err_code:
                    type: string
                    example: SYS_INTERNAL_ERROR
      servers:
        - url: https://sandbox.zapyd.com/cms/api/v1
          description: Customer API Base URL
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API Key for authentication
    TimestampAuth:
      type: apiKey
      in: header
      name: X-TIMESTAMP
      description: Current timestamp in seconds since epoch
    SignatureAuth:
      type: apiKey
      in: header
      name: X-SIGNATURE
      description: HMAC SHA256 signature of the request encoded in Base64

````

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